Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Swin-Transformer-Object-Detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wanggh
Swin-Transformer-Object-Detection
Commits
58adc05b
Commit
58adc05b
authored
3 years ago
by
Guo-Hua Wang
Browse files
Options
Downloads
Patches
Plain Diff
fix bug
parent
168632c7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mmdet/apis/train.py
+2
-1
2 additions, 1 deletion
mmdet/apis/train.py
mmdet/models/necks/cbnet_fpn.py
+26
-0
26 additions, 0 deletions
mmdet/models/necks/cbnet_fpn.py
tools/dist_fgd_train.sh
+9
-0
9 additions, 0 deletions
tools/dist_fgd_train.sh
with
37 additions
and
1 deletion
mmdet/apis/train.py
+
2
−
1
View file @
58adc05b
...
...
@@ -80,7 +80,8 @@ def train_detector(model,
if
distiller_cfg
is
None
:
optimizer
=
build_optimizer
(
model
,
cfg
.
optimizer
)
else
:
optimizer
=
build_optimizer
(
model
.
module
.
base_parameters
(),
cfg
.
optimizer
)
#optimizer = build_optimizer(model.module.base_parameters(), cfg.optimizer)
optimizer
=
build_optimizer
(
model
.
base_parameters
(),
cfg
.
optimizer
)
# use apex fp16 optimizer
if
cfg
.
optimizer_config
.
get
(
"
type
"
,
None
)
and
cfg
.
optimizer_config
[
"
type
"
]
==
"
DistOptimizerHook
"
:
...
...
This diff is collapsed.
Click to expand it.
mmdet/models/necks/cbnet_fpn.py
+
26
−
0
View file @
58adc05b
import
torch.nn
as
nn
import
torch.nn.functional
as
F
from
mmcv.cnn
import
xavier_init
from
..builder
import
NECKS
from
.fpn
import
FPN
@NECKS.register_module
()
class
CBFPN
(
FPN
):
'''
FPN with weight sharing
which support mutliple outputs from cbnet
'''
def
forward
(
self
,
inputs
):
if
not
isinstance
(
inputs
[
0
],
(
list
,
tuple
)):
inputs
=
[
inputs
]
if
self
.
training
:
outs
=
[]
for
x
in
inputs
:
out
=
super
().
forward
(
x
)
outs
.
append
(
out
)
return
outs
else
:
out
=
super
().
forward
(
inputs
[
-
1
])
return
out
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tools/dist_fgd_train.sh
0 → 100755
+
9
−
0
View file @
58adc05b
#!/usr/bin/env bash
CONFIG
=
$1
GPUS
=
$2
PORT
=
${
PORT
:-
29500
}
PYTHONPATH
=
"
$(
dirname
$0
)
/.."
:
$PYTHONPATH
\
python
-m
torch.distributed.launch
--nproc_per_node
=
$GPUS
--master_port
=
$PORT
\
$(
dirname
"
$0
"
)
/fgd_train.py
$CONFIG
--launcher
pytorch
${
@
:3
}
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