Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
test_on_pytorch
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
30cf7dbe
authored
2022-12-14 16:51:24 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
modify evaluate
1 parent
f3fbac1b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
solver/vit_solver.py
solver/vit_solver.py
View file @
30cf7db
...
...
@@ -37,7 +37,10 @@ class VITSolver(object):
self
.
logger
,
self
.
log_dir
=
get_logger_and_log_dir
(
**
cfg
[
'solver'
][
'logger'
])
@staticmethod
def
evaluate
(
y_pred
,
y_true
,
thresholds
=
0.5
):
def
evaluate
(
y_pred
,
y_true
,
thresholds
=
0.5
,
no_other
=
False
):
if
no_other
:
return
(
y_pred
.
argmax
(
1
)
==
y_true
.
argmax
(
1
))
.
type
(
torch
.
float
)
.
sum
()
.
item
()
else
:
y_pred_idx
=
torch
.
argmax
(
y_pred
,
dim
=
1
)
+
1
y_pred_is_other
=
(
torch
.
amax
(
y_pred
,
dim
=
1
)
>
0.5
)
.
int
()
y_pred_rebuild
=
torch
.
multiply
(
y_pred_idx
,
y_pred_is_other
)
...
...
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