Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
affective_computing
/
tamper_det
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
65a9577f
authored
2022-10-25 15:04:16 +0800
by
乔峰昇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add draw pr_result.jpg
1 parent
f43822ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
7 deletions
get_pr.py
get_pr.py
View file @
65a9577
...
...
@@ -61,18 +61,38 @@ def get_evaluate_score(true_image_path, true_label_path, predict_label_path, thr
p
=
precision_score
(
targets
,
predicts
)
r
=
recall_score
(
targets
,
predicts
)
conf
=
confusion_matrix
(
targets
,
predicts
)
bg_mask
=
np
.
ones
((
500
,
500
,
3
))
*
255
cv2
.
putText
(
bg_mask
,
f
' authentic tampered '
,
(
20
,
50
),
cv2
.
FONT_ITALIC
,
0.7
,
(
0
,
0
,
255
),
1
)
cv2
.
putText
(
bg_mask
,
f
'authentic {conf[0, 0]} {conf[0, 1]}'
,
(
20
,
80
),
cv2
.
FONT_ITALIC
,
0.7
,
(
0
,
0
,
255
),
1
)
cv2
.
putText
(
bg_mask
,
f
'tempered {conf[1, 0]} {conf[1, 1]}'
,
(
20
,
110
),
cv2
.
FONT_ITALIC
,
0.7
,
(
0
,
0
,
255
),
1
)
cv2
.
putText
(
bg_mask
,
f
'authentic precision:{round(conf[0, 0] / (conf[0, 0] + conf[1, 0]), 3)}'
,
(
20
,
170
),
cv2
.
FONT_ITALIC
,
0.7
,
(
0
,
0
,
255
),
1
)
cv2
.
putText
(
bg_mask
,
f
' recall:{round(conf[0, 0] / (conf[0, 0] + conf[0, 1]), 3)}'
,
(
20
,
200
),
cv2
.
FONT_ITALIC
,
0.7
,
(
0
,
0
,
255
),
1
)
cv2
.
putText
(
bg_mask
,
f
'tampered precision:{round(conf[1, 1] / (conf[0, 1] + conf[1, 1]), 3)}'
,
(
20
,
230
),
cv2
.
FONT_ITALIC
,
0.7
,
(
0
,
0
,
255
),
1
)
cv2
.
putText
(
bg_mask
,
f
' recall:{round(conf[1, 1] / (conf[1, 0] + conf[1, 1]), 3)}'
,
(
20
,
260
),
cv2
.
FONT_ITALIC
,
0.7
,
(
0
,
0
,
255
),
1
)
cv2
.
imwrite
(
f
'pr_result.jpg'
,
bg_mask
)
print
(
'precison:'
,
p
)
print
(
'recall:'
,
r
)
print
(
conf
)
print
(
f
' 预 测 '
)
print
(
f
' authentic tampered '
)
print
(
f
'真 authentic
\t\t
{conf[0, 0]}
\t\t
{conf[0,1]}'
)
print
(
f
'实 tempered
\t\t
{conf[1, 0]}
\t\t\t
{conf[1,1]}'
)
print
(
f
'authentic precision:{conf[0,0]/(conf[0,0]+conf[1,0])}
\t
recall:{conf[0, 0]/(conf[0, 0]+conf[0, 1])}'
)
print
(
f
'tampered precision:{conf[1, 1]/(conf[0, 1]+conf[1, 1])}
\t
recall:{conf[1, 1]/(conf[1, 0]+conf[1, 1])}'
)
print
(
f
'真 authentic
\t\t
{conf[0, 0]}
\t\t
{conf[0, 1]}'
)
print
(
f
'实 tempered
\t\t
{conf[1, 0]}
\t\t\t
{conf[1, 1]}'
)
print
(
f
'authentic precision:{conf[0, 0] / (conf[0, 0] + conf[1, 0])}
\t
recall:{conf[0, 0] / (conf[0, 0] + conf[0, 1])}'
)
print
(
f
'tampered precision:{conf[1, 1] / (conf[0, 1] + conf[1, 1])}
\t
recall:{conf[1, 1] / (conf[1, 0] + conf[1, 1])}'
)
if
__name__
==
'__main__'
:
true_image_path
=
'/data/situ_invoice_bill_data/qfs_train_val_data/
gongshang/images/val
'
true_label_path
=
'/data/situ_invoice_bill_data/qfs_train_val_data/
gongshang/labels/val
'
predict_label_path
=
'/home/situ/qfs/invoice_tamper/09_project/project/tamper_det/runs/detect/exp
4
/labels'
true_image_path
=
'/data/situ_invoice_bill_data/qfs_train_val_data/
test_data/only_human_ps/all/images
'
true_label_path
=
'/data/situ_invoice_bill_data/qfs_train_val_data/
test_data/only_human_ps/all/labels
'
predict_label_path
=
'/home/situ/qfs/invoice_tamper/09_project/project/tamper_det/runs/detect/exp
2
/labels'
threshold
=
0.1
get_evaluate_score
(
true_image_path
,
true_label_path
,
predict_label_path
,
threshold
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment