open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.44k stars 9.43k forks source link

Cascade R-CNN with OHEM #341

Closed ZengyuanYu closed 5 years ago

ZengyuanYu commented 5 years ago

@hellock Thanks your work! I use mmdetection for my finally thesis. Now I meet some question:

error msg loading annotations into memory... Done (t=0.08s) creating index... index created! 2019-02-24 20:31:17,671 - INFO - Start running, host: yu@xc-pc, work_dir: /home/yu/mmdetection/data/result/cascade_rcnn_r101_OHEM_wheat 2019-02-24 20:31:17,671 - INFO - workflow: [('train', 1)], max: 200 epochs Traceback (most recent call last): File "tools/train.py", line 90, in main() File "tools/train.py", line 86, in main logger=logger) File "/home/yu/mmdetection/mmdet/apis/train.py", line 59, in train_detector _non_dist_train(model, dataset, cfg, validate=validate) File "/home/yu/mmdetection/mmdet/apis/train.py", line 121, in _non_dist_train runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/home/yu/.virtualenvs/mmdetetion/lib/python3.6/site-packages/mmcv/runner/runner.py", line 349, in run epoch_runner(data_loaders[i], kwargs) File "/home/yu/.virtualenvs/mmdetetion/lib/python3.6/site-packages/mmcv/runner/runner.py", line 255, in train self.model, data_batch, train_mode=True, kwargs) File "/home/yu/mmdetection/mmdet/apis/train.py", line 37, in batch_processor losses = model(data) File "/home/yu/.virtualenvs/mmdetetion/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, *kwargs) File "/home/yu/.virtualenvs/mmdetetion/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 121, in forward return self.module(inputs[0], kwargs[0]) File "/home/yu/.virtualenvs/mmdetetion/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(input, kwargs) File "/home/yu/mmdetection/mmdet/models/detectors/base.py", line 80, in forward return self.forward_train(img, img_meta, kwargs) File "/home/yu/mmdetection/mmdet/models/detectors/cascade_rcnn.py", line 141, in forward_train cfg=rcnn_train_cfg) File "/home/yu/mmdetection/mmdet/core/utils/misc.py", line 24, in multi_apply return tuple(map(list, zip(map_results))) File "/home/yu/mmdetection/mmdet/core/bbox/assign_sampling.py", line 30, in assign_and_sample bbox_sampler = build_sampler(cfg.sampler) File "/home/yu/mmdetection/mmdet/core/bbox/assign_sampling.py", line 22, in build_sampler cfg, samplers, default_args=kwargs) File "/home/yu/.virtualenvs/mmdetetion/lib/python3.6/site-packages/mmcv/runner/utils.py", line 72, in obj_from_dict return obj_type(**args) TypeError: init() missing 1 required positional argument: 'context'

ZengyuanYu commented 5 years ago

I use Faster R-CNN with OHEM is OK.

hellock commented 5 years ago

We have not tried OHEM in Cascade R-CNN and it is currently not supported. You can refer to here and here if you want to add OHEM in Cascade R-CNN.

ZengyuanYu commented 5 years ago

We have not tried OHEM in Cascade R-CNN and it is currently not supported. You can refer to here and here if you want to add OHEM in Cascade R-CNN.

OK, I will do it for refer code.Thank you!

1224wxwx commented 5 years ago

I use Faster R-CNN with OHEM is OK.

Could you please tell me whether OHEM helped you? After I used OHEM, it became very difficult for loss to decrease(both on train dataset and test dataset) and the result was worse than before.

zvadaszi commented 5 years ago

Did OHEM helped with Cascade R-CNN?