Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
6e535db2
Unverified
Commit
6e535db2
authored
Aug 12, 2022
by
Federico Pozzi
Committed by
GitHub
Aug 12, 2022
Browse files
refactor: replace LambdaLR with PolynomialLR in segmentation training script (#6405)
parent
7fb8d068
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
references/segmentation/train.py
references/segmentation/train.py
+3
-2
No files found.
references/segmentation/train.py
View file @
6e535db2
...
@@ -10,6 +10,7 @@ import torchvision
...
@@ -10,6 +10,7 @@ import torchvision
import
utils
import
utils
from
coco_utils
import
get_coco
from
coco_utils
import
get_coco
from
torch
import
nn
from
torch
import
nn
from
torch.optim.lr_scheduler
import
PolynomialLR
from
torchvision.transforms
import
functional
as
F
,
InterpolationMode
from
torchvision.transforms
import
functional
as
F
,
InterpolationMode
...
@@ -184,8 +185,8 @@ def main(args):
...
@@ -184,8 +185,8 @@ def main(args):
scaler
=
torch
.
cuda
.
amp
.
GradScaler
()
if
args
.
amp
else
None
scaler
=
torch
.
cuda
.
amp
.
GradScaler
()
if
args
.
amp
else
None
iters_per_epoch
=
len
(
data_loader
)
iters_per_epoch
=
len
(
data_loader
)
main_lr_scheduler
=
torch
.
optim
.
lr_scheduler
.
Lambda
LR
(
main_lr_scheduler
=
Polynomial
LR
(
optimizer
,
lambda
x
:
(
1
-
x
/
(
iters_per_epoch
*
(
args
.
epochs
-
args
.
lr_warmup_epochs
)
))
**
0.9
optimizer
,
total_steps
=
iters_per_epoch
*
(
args
.
epochs
-
args
.
lr_warmup_epochs
)
,
power
=
0.9
)
)
if
args
.
lr_warmup_epochs
>
0
:
if
args
.
lr_warmup_epochs
>
0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment