Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to train ScratchDet with mmdetection? #9

Open
yanlongbinluck opened this issue Jul 30, 2019 · 9 comments
Open

How to train ScratchDet with mmdetection? #9

yanlongbinluck opened this issue Jul 30, 2019 · 9 comments

Comments

@yanlongbinluck
Copy link

thanks for your great repo.
I put ssd300_scratchdet_coco.py into folder of mmdetection/configs;
put ssd_root34_300.py into mmdetection/mmdet/model/backbones,
and put ssdbn_head.py into mmdetection/mmdet/model/anchor_heads.

run ./tools/train.py configs/ssd300_scratchdet_coco.py, there are some errors: None is not in the backbone registry.
is my method right? or I need to set some other parameters?
thanks

@jshuzi
Copy link

jshuzi commented Aug 20, 2019

@yanlongbinluck
Have you find out how to train ScratchDet with mmdetection? Recently, i've been trying this too.

@jshuzi
Copy link

jshuzi commented Aug 27, 2019

I have met the same error.

@zwh-l
Copy link

zwh-l commented Sep 3, 2019

in the ssd_root34_300.py, 'from ..registry import BACKBONES' and '@BACKBONES.register_module' are lost.

@jshuzi
Copy link

jshuzi commented Sep 30, 2019

@zwh-l while i run the command ./tools/dist_train.sh configs/ssd300_scratchdet_coco.py 2 --validate, i got an error:
Traceback (most recent call last):
File "./tools/train.py", line 108, in
main()
File "./tools/train.py", line 104, in main
logger=logger)
File "/home/jshuzi/mmdetection/mmdet/apis/train.py", line 58, in train_detector
_dist_train(model, dataset, cfg, validate=validate)
File "/home/jshuzi/mmdetection/mmdet/apis/train.py", line 186, in _dist_train
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/home/jshuzi/mmcv/mmcv/runner/runner.py", line 358, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/jshuzi/mmcv/mmcv/runner/runner.py", line 264, in train
self.model, data_batch, train_mode=True, **kwargs)
File "/home/jshuzi/mmdetection/mmdet/apis/train.py", line 38, in batch_processor
losses = model(**data)
File "/home/jshuzi/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/jshuzi/mmcv/mmcv/parallel/distributed.py", line 50, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/jshuzi/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/jshuzi/mmdetection/mmdet/core/fp16/decorators.py", line 49, in new_func
return old_func(*args, **kwargs)
File "/home/jshuzi/mmdetection/mmdet/models/detectors/base.py", line 86, in forward
return self.forward_train(img, img_meta, **kwargs)
File "/home/jshuzi/mmdetection/mmdet/models/detectors/single_stage.py", line 60, in forward_train
*loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore)
TypeError: loss() got an unexpected keyword argument 'gt_bboxes_ignore'
Traceback (most recent call last):
File "./tools/train.py", line 108, in
main()
File "./tools/train.py", line 104, in main
logger=logger)
File "/home/jshuzi/mmdetection/mmdet/apis/train.py", line 58, in train_detector
_dist_train(model, dataset, cfg, validate=validate)
File "/home/jshuzi/mmdetection/mmdet/apis/train.py", line 186, in _dist_train
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/home/jshuzi/mmcv/mmcv/runner/runner.py", line 358, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/jshuzi/mmcv/mmcv/runner/runner.py", line 264, in train
self.model, data_batch, train_mode=True, **kwargs)
File "/home/jshuzi/mmdetection/mmdet/apis/train.py", line 38, in batch_processor
losses = model(**data)
File "/home/jshuzi/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/jshuzi/mmcv/mmcv/parallel/distributed.py", line 50, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/jshuzi/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/jshuzi/mmdetection/mmdet/core/fp16/decorators.py", line 49, in new_func
return old_func(*args, **kwargs)
File "/home/jshuzi/mmdetection/mmdet/models/detectors/base.py", line 86, in forward
return self.forward_train(img, img_meta, **kwargs)
File "/home/jshuzi/mmdetection/mmdet/models/detectors/single_stage.py", line 60, in forward_train
*loss_inputs, gt_bboxes_ignore=gt_bboxes_ignore)
TypeError: loss() got an unexpected keyword argument 'gt_bboxes_ignore'
Traceback (most recent call last):
File "/home/jshuzi/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/jshuzi/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/jshuzi/.local/lib/python3.6/site-packages/torch/distributed/launch.py", line 235, in
main()
File "/home/jshuzi/.local/lib/python3.6/site-packages/torch/distributed/launch.py", line 231, in main
cmd=process.args)
subprocess.CalledProcessError: Command '['/home/jshuzi/anaconda3/bin/python', '-u', './tools/train.py', '--local_rank=0', 'configs/ssd300_scratchdet_coco.py', '--launcher', 'pytorch', '--validate']' returned non-zero exit status 1.
Have you met the problem? thank you for your reply.

@zwh-l
Copy link

zwh-l commented Sep 30, 2019

@jshuzi single_stage have no parameter of gt_bboxes_ignore
and two_stage have it. in mmdetection , pull requests:Allow gt_bboxes_ignore for RPN and single-stage detectors can solve it.

@jshuzi
Copy link

jshuzi commented Oct 8, 2019

@zwh-l sorry, i don't quite understand, which parts of the code should I modify?

@zwh-l
Copy link

zwh-l commented Oct 8, 2019

@jshuzi
Copy link

jshuzi commented Oct 9, 2019

@zwh-l thank you very much. i have solved the above problem with your help. i use the ScratchDet to train my own data. But, i meet an new error, valueerror: expected input batch_size (8764) to match target batch_size (8732), have you met the error before?

@zwh-l
Copy link

zwh-l commented Oct 9, 2019

@jshuzi , I met,but I can't solve it. So I gave up and run ssd512_scratchdet. It can work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants