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
mmdetection3d
Commits
aec41c7f
Commit
aec41c7f
authored
Apr 27, 2020
by
zhangwenwei
Browse files
Merge master
parents
49f06039
4eca6606
Changes
62
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
tools/slurm_train.sh
tools/slurm_train.sh
+1
-2
tools/train.py
tools/train.py
+15
-5
No files found.
tools/slurm_train.sh
View file @
aec41c7f
#!/usr/bin/env bash
#!/usr/bin/env bash
set
-x
set
-x
export
PYTHONPATH
=
`
pwd
`
:
$PYTHONPATH
PARTITION
=
$1
PARTITION
=
$1
JOB_NAME
=
$2
JOB_NAME
=
$2
...
@@ -20,4 +19,4 @@ srun -p ${PARTITION} \
...
@@ -20,4 +19,4 @@ srun -p ${PARTITION} \
--ntasks-per-node
=
${
GPUS_PER_NODE
}
\
--ntasks-per-node
=
${
GPUS_PER_NODE
}
\
--kill-on-bad-exit
=
1
\
--kill-on-bad-exit
=
1
\
${
SRUN_ARGS
}
\
${
SRUN_ARGS
}
\
python
-u
tools/train.py
${
CONFIG
}
--work
_
dir
=
${
WORK_DIR
}
--launcher
=
"slurm"
${
PY_ARGS
}
python
-u
tools/train.py
${
CONFIG
}
--work
-
dir
=
${
WORK_DIR
}
--launcher
=
"slurm"
${
PY_ARGS
}
tools/train.py
View file @
aec41c7f
...
@@ -11,10 +11,11 @@ from mmcv import Config
...
@@ -11,10 +11,11 @@ from mmcv import Config
from
mmcv.runner
import
init_dist
from
mmcv.runner
import
init_dist
from
mmdet3d
import
__version__
from
mmdet3d
import
__version__
from
mmdet3d.apis
import
train_detector
from
mmdet3d.datasets
import
build_dataset
from
mmdet3d.datasets
import
build_dataset
from
mmdet3d.models
import
build_detector
from
mmdet3d.models
import
build_detector
from
mmdet3d.utils
import
collect_env
from
mmdet3d.utils
import
collect_env
from
mmdet.apis
import
get_root_logger
,
set_random_seed
,
train_detector
from
mmdet.apis
import
get_root_logger
,
set_random_seed
def
parse_args
():
def
parse_args
():
...
@@ -27,12 +28,18 @@ def parse_args():
...
@@ -27,12 +28,18 @@ def parse_args():
'--validate'
,
'--validate'
,
action
=
'store_true'
,
action
=
'store_true'
,
help
=
'whether to evaluate the checkpoint during training'
)
help
=
'whether to evaluate the checkpoint during training'
)
parser
.
add_argument
(
group_gpus
=
parser
.
add_mutually_exclusive_group
()
group_gpus
.
add_argument
(
'--gpus'
,
'--gpus'
,
type
=
int
,
type
=
int
,
default
=
1
,
help
=
'number of gpus to use '
help
=
'number of gpus to use '
'(only applicable to non-distributed training)'
)
'(only applicable to non-distributed training)'
)
group_gpus
.
add_argument
(
'--gpu-ids'
,
type
=
int
,
nargs
=
'+'
,
help
=
'ids of gpus to use '
'(only applicable to non-distributed training)'
)
parser
.
add_argument
(
'--seed'
,
type
=
int
,
default
=
0
,
help
=
'random seed'
)
parser
.
add_argument
(
'--seed'
,
type
=
int
,
default
=
0
,
help
=
'random seed'
)
parser
.
add_argument
(
parser
.
add_argument
(
'--deterministic'
,
'--deterministic'
,
...
@@ -73,11 +80,14 @@ def main():
...
@@ -73,11 +80,14 @@ def main():
osp
.
splitext
(
osp
.
basename
(
args
.
config
))[
0
])
osp
.
splitext
(
osp
.
basename
(
args
.
config
))[
0
])
if
args
.
resume_from
is
not
None
:
if
args
.
resume_from
is
not
None
:
cfg
.
resume_from
=
args
.
resume_from
cfg
.
resume_from
=
args
.
resume_from
cfg
.
gpus
=
args
.
gpus
if
args
.
gpu_ids
is
not
None
:
cfg
.
gpu_ids
=
args
.
gpu_ids
else
:
cfg
.
gpu_ids
=
range
(
1
)
if
args
.
gpus
is
None
else
range
(
args
.
gpus
)
if
args
.
autoscale_lr
:
if
args
.
autoscale_lr
:
# apply the linear scaling rule (https://arxiv.org/abs/1706.02677)
# apply the linear scaling rule (https://arxiv.org/abs/1706.02677)
cfg
.
optimizer
[
'lr'
]
=
cfg
.
optimizer
[
'lr'
]
*
cfg
.
gpu
s
/
8
cfg
.
optimizer
[
'lr'
]
=
cfg
.
optimizer
[
'lr'
]
*
len
(
cfg
.
gpu
_ids
)
/
8
# init distributed env first, since logger depends on the dist info.
# init distributed env first, since logger depends on the dist info.
if
args
.
launcher
==
'none'
:
if
args
.
launcher
==
'none'
:
...
...
Prev
1
2
3
4
Next
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