Sense-X / TSD

1st place models in Google OpenImage Detection Challenge 2019
Apache License 2.0
456 stars 64 forks source link

UnboundLocalError: local variable 'pc_cls_loss' referenced before assignment #12

Closed fengepsilon closed 4 years ago

fengepsilon commented 4 years ago

2020-06-07 11:02:32,849 - mmdet - INFO - Epoch [1][15950/36314] lr: 0.04000, eta: 9 days, 19:08:30, time: 2.144, data_time: 0.781, memory: 16486, loss_rpn_cls: 0.0568, loss_rpn_bbox: 0.0406, loss_cls: 0.3449, acc: 90.2331, loss_TSD_cls: 0.3340, TSD_acc: 90.5631, loss_bbox: 0.1293, loss_TSD_bbox: 0.1197, loss_pc_cls: 0.0607, loss_pc_loc: 0.1979, loss: 1.2839 Traceback (most recent call last): File "./tools/train.py", line 151, in main() File "./tools/train.py", line 147, in main meta=meta) File "/home/yckj0114/code/TSD/mmdet/apis/train.py", line 165, in train_detector runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/home/yckj0114/whl/mmcv-0.4.4/mmcv/runner/runner.py", line 380, in run epoch_runner(data_loaders[i], kwargs) File "/home/yckj0114/whl/mmcv-0.4.4/mmcv/runner/runner.py", line 278, in train self.model, data_batch, train_mode=True, kwargs) File "/home/yckj0114/code/TSD/mmdet/apis/train.py", line 75, in batch_processor losses = model(data) File "/home/yckj0114/anaconda3/envs/TSD/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, *kwargs) File "/home/yckj0114/anaconda3/envs/TSD/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 447, in forward output = self.module(inputs[0], kwargs[0]) File "/home/yckj0114/anaconda3/envs/TSD/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call result = self.forward(*input, kwargs) File "/home/yckj0114/code/TSD/mmdet/core/fp16/decorators.py", line 49, in new_func return old_func(args, kwargs) File "/home/yckj0114/code/TSD/mmdet/models/detectors/base.py", line 147, in forward return self.forward_train(img, img_metas, kwargs) File "/home/yckj0114/code/TSD/mmdet/models/detectors/two_stage.py", line 222, in forward_train self.train_cfg.rcnn, img_metas) File "/home/yckj0114/code/TSD/mmdet/core/fp16/decorators.py", line 127, in new_func return old_func(args, kwargs) File "/home/yckj0114/code/TSD/mmdet/models/bbox_heads/tsd_bbox_head.py", line 370, in get_target target_stds=self.target_stds) File "/home/yckj0114/code/TSD/mmdet/core/bbox/bbox_target.py", line 100, in bbox_target_tsd target_stds=target_stds) File "/home/yckj0114/code/TSD/mmdet/core/utils/misc.py", line 24, in multi_apply return tuple(map(list, zip(*map_results))) File "/home/yckj0114/code/TSD/mmdet/core/bbox/bbox_target.py", line 226, in bbox_target_single_tsd return labels, label_weights, bbox_targets, bbox_weights, TSD_labels, TSD_label_weights, TSD_bbox_targets, TSD_bbox_weights, pc_cls_loss, pc_loc_loss UnboundLocalError: local variable 'pc_cls_loss' referenced before assignment

fengepsilon commented 4 years ago

training data: OpenImageV6

songguanglu commented 4 years ago

Hi,thanks for your feedback. This is caused by the num_pos=0 and we will fix this error in the next version (add supports for cascade RCNN, ETA<=6.10). You can also directly set pc_cls_loss=0 and pc_loc_loss=0 if num_pos=0.