Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
food-pytorch-baseline
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
Model registry
Operate
Environments
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
eric_a_scuccimarra
food-pytorch-baseline
Commits
1fffac8e
Commit
1fffac8e
authored
4 years ago
by
eric_a_scuccimarra
Browse files
Options
Downloads
Patches
Plain Diff
Update train.py
parent
16ec475f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/train.py
+11
-17
11 additions, 17 deletions
tools/train.py
with
11 additions
and
17 deletions
tools/train.py
+
11
−
17
View file @
1fffac8e
...
...
@@ -6,8 +6,8 @@ import torch
from
mmcv
import
Config
from
mmdet
import
__version__
from
mm
cv.runner
import
init_dist
from
mmdet.apis
import
(
get_root_logger
,
set_random_seed
,
train_detector
)
from
mm
det.apis
import
(
get_root_logger
,
init_dist
,
set_random_seed
,
train_detector
)
from
mmdet.datasets
import
build_dataset
from
mmdet.models
import
build_detector
...
...
@@ -97,20 +97,14 @@ def main():
CLASSES
=
datasets
[
0
].
CLASSES
)
# add an attribute for visualization convenience
model
.
CLASSES
=
datasets
[
0
].
CLASSES
try
:
train_detector
(
model
,
datasets
,
cfg
,
distributed
=
distributed
,
validate
=
args
.
validate
,
logger
=
logger
)
except
Exception
as
error
:
print
(
"
Error... saving checkpoint
"
)
torch
.
save
(
model
.
state_dict
(),
'
./models/crash.pth
'
)
raise
error
train_detector
(
model
,
datasets
,
cfg
,
distributed
=
distributed
,
validate
=
args
.
validate
,
logger
=
logger
)
if
__name__
==
'
__main__
'
:
main
()
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