Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mmsegmentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Bartels
mmsegmentation
Commits
aed18867
Unverified
Commit
aed18867
authored
2 years ago
by
Miao Zheng
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Fix] benckmark script (#1991)
parent
cc240ce5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/analysis_tools/benchmark.py
+7
-7
7 additions, 7 deletions
tools/analysis_tools/benchmark.py
with
7 additions
and
7 deletions
tools/analysis_tools/benchmark.py
+
7
−
7
View file @
aed18867
...
...
@@ -6,9 +6,10 @@ import time
import
numpy
as
np
import
torch
from
mmengine
import
Config
from
mmengine.fileio
import
dump
,
mkdir_or_exist
from
mmengine.fileio
import
dump
from
mmengine.model.utils
import
revert_sync_batchnorm
from
mmengine.runner
import
Runner
,
load_checkpoint
,
wrap_fp16_model
from
mmengine.runner
import
Runner
,
load_checkpoint
from
mmengine.utils
import
mkdir_or_exist
from
mmseg.registry
import
MODELS
from
mmseg.utils
import
register_all_modules
...
...
@@ -51,6 +52,7 @@ def main():
benchmark_dict
=
dict
(
config
=
args
.
config
,
unit
=
'
img / s
'
)
overall_fps_list
=
[]
cfg
.
test_dataloader
.
batch_size
=
1
for
time_index
in
range
(
repeat_times
):
print
(
f
'
Run
{
time_index
+
1
}
:
'
)
# build the dataloader
...
...
@@ -59,16 +61,14 @@ def main():
# build the model and load checkpoint
cfg
.
model
.
train_cfg
=
None
model
=
MODELS
.
build
(
cfg
.
model
)
fp16_cfg
=
cfg
.
get
(
'
fp16
'
,
None
)
if
fp16_cfg
is
not
None
:
wrap_fp16_model
(
model
)
if
'
checkpoint
'
in
args
and
osp
.
exists
(
args
.
checkpoint
):
load_checkpoint
(
model
,
args
.
checkpoint
,
map_location
=
'
cpu
'
)
if
torch
.
cuda
.
is_available
():
model
=
model
.
cuda
()
else
:
model
=
revert_sync_batchnorm
(
model
)
model
=
revert_sync_batchnorm
(
model
)
model
.
eval
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment