Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
BSH_Project3
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김재형
2021-06-05 23:29:02 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8e96bb7dee6a3ba0045456ebc943a3c69cf97039
8e96bb7d
1 parent
8d6e4a04
Test 코드 수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
carn/carn/test.py
carn/carn/test.py
View file @
8e96bb7
...
...
@@ -76,11 +76,13 @@ def sample(net, device, dataset, cfg):
def
main
(
cfg
):
module
=
importlib
.
import_module
(
"model.{}"
.
format
(
cfg
.
model
))
net
=
module
.
Net
(
multi_scale
=
True
,
net
=
module
.
Net
(
multi_scale
=
False
,
scale
=
cfg
.
scale
,
group
=
cfg
.
group
)
print
(
json
.
dumps
(
vars
(
cfg
),
indent
=
4
,
sort_keys
=
True
))
state_dict
=
torch
.
load
(
cfg
.
ckpt_path
)
# print(state_dict.keys())
new_state_dict
=
OrderedDict
()
for
k
,
v
in
state_dict
.
items
():
name
=
k
...
...
@@ -88,12 +90,14 @@ def main(cfg):
new_state_dict
[
name
]
=
v
net
.
load_state_dict
(
new_state_dict
)
net
.
eval
()
device
=
torch
.
device
(
"cuda"
if
torch
.
cuda
.
is_available
()
else
"cpu"
)
net
=
net
.
to
(
device
)
dataset
=
TestDataset
(
cfg
.
test_data_dir
,
cfg
.
scale
)
sample
(
net
,
device
,
dataset
,
cfg
)
with
torch
.
no_grad
():
sample
(
net
,
device
,
dataset
,
cfg
)
if
__name__
==
"__main__"
:
...
...
Please
register
or
login
to post a comment