joe-siyuan-qiao / DetectoRS

DetectoRS: Detecting Objects with Recursive Feature Pyramid and Switchable Atrous Convolution
Apache License 2.0
1.14k stars 176 forks source link

AttributeError: 'NoneType' object has no attribute 'squeeze' #42

Closed lgldl closed 4 years ago

lgldl commented 4 years ago

we have prepared the data as follows: data coco annotations trainval2017 testdev2017 minival2017 mask when we train the DetectoRS, the error occured as follows: Traceback (most recent call last): File "/home/lgl/soft/pycharm/pycharm-2018.1.1/helpers/pydev/pydevd.py", line 1664, in main() File "/home/lgl/soft/pycharm/pycharm-2018.1.1/helpers/pydev/pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) File "/home/lgl/soft/pycharm/pycharm-2018.1.1/helpers/pydev/pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/lgl/soft/pycharm/pycharm-2018.1.1/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/lgl/PycharmProjects/DetectoRS/train_crossing.py", line 142, in main() File "/home/lgl/PycharmProjects/DetectoRS/train_crossing.py", line 138, in main meta=meta) File "/home/lgl/PycharmProjects/DetectoRS/mmdet/apis/train.py", line 111, in train_detector meta=meta) File "/home/lgl/PycharmProjects/DetectoRS/mmdet/apis/train.py", line 242, in _non_dist_train runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/home/lgl/anaconda3/envs/DetectoRS/lib/python3.6/site-packages/mmcv/runner/epoch_based_runner.py", line 122, in run epoch_runner(data_loaders[i], kwargs) File "/home/lgl/anaconda3/envs/DetectoRS/lib/python3.6/site-packages/mmcv/runner/epoch_based_runner.py", line 35, in train self.model, data_batch, train_mode=True, kwargs) File "/home/lgl/PycharmProjects/DetectoRS/mmdet/apis/train.py", line 75, in batch_processor losses = model(data) File "/home/lgl/anaconda3/envs/DetectoRS/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, *kwargs) File "/home/lgl/anaconda3/envs/DetectoRS/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward return self.module(inputs[0], kwargs[0]) File "/home/lgl/anaconda3/envs/DetectoRS/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, kwargs) File "/home/lgl/PycharmProjects/DetectoRS/mmdet/core/fp16/decorators.py", line 49, in new_func return old_func(args, kwargs) File "/home/lgl/PycharmProjects/DetectoRS/mmdet/models/detectors/base.py", line 147, in forward return self.forward_train(img, img_metas, kwargs) File "/home/lgl/PycharmProjects/DetectoRS/mmdet/models/detectors/htc.py", line 230, in forward_train loss_seg = self.semantic_head.loss(semantic_pred, gt_semantic_seg) File "/home/lgl/PycharmProjects/DetectoRS/mmdet/core/fp16/decorators.py", line 127, in new_func return old_func(args, kwargs) File "/home/lgl/PycharmProjects/DetectoRS/mmdet/models/mask_heads/fused_semantic_head.py", line 103, in loss labels = labels.squeeze(1).long() AttributeError: 'NoneType' object has no attribute 'squeeze'

can you tell me how to solve it, thank you?

joe-siyuan-qiao commented 4 years ago

Thanks for the question. Please take a look at

https://github.com/joe-siyuan-qiao/DetectoRS/tree/master/configs/htc

to prepare data if you are using DetectoRS based on HTC.

lgldl commented 4 years ago

Thanks for the question. Please take a look at

https://github.com/joe-siyuan-qiao/DetectoRS/tree/master/configs/htc

to prepare data if you are using DetectoRS based on HTC.

Thank you, I have another question. when we want to train our own data with seg, and how to set the num_classes which is as follows, what it means? semantic_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=14, sample_num=2), out_channels=256, featmap_strides=[8]), semantic_head=dict( type='FusedSemanticHead', num_ins=5, fusion_level=1, num_convs=4, in_channels=256, conv_out_channels=256, num_classes=183, ignore_label=255, loss_weight=0.2))