flyingshan / Learning-Polar-Encodings-For-Arbitrary-Oriented-Ship-Detection-In-SAR-Images

Code for paper "Learning-Polar-Encodings-For-Arbitrary-Oriented-Ship-Detection-In-SAR-Images"
MIT License
24 stars 7 forks source link

TypeError: 'float' object is not iterable #4

Closed ghost closed 2 years ago

ghost commented 3 years ago

I used the data you provided and run the code "python main.py --data_dir data/ssdd --num_epoch 120 --batch_size 8 --dataset ssdd --phase train --K 100" It seems that there are some data problems. And not all data could cause this.

Traceback (most recent call last): File "main.py", line 59, in ctrbox_obj.train_network(args) File "/data/rocket/SGDD/Learning-Polar-Encodings-For-Arbitrary-Oriented-Ship-Detection-In-SAR-Images/train.py", line 145, in train_network criterion=criterion) File "/data/rocket/SGDD/Learning-Polar-Encodings-For-Arbitrary-Oriented-Ship-Detection-In-SAR-Images/train.py", line 190, in run_epoch loss = criterion(pr_decs, data_dict) File "/root/anaconda3/envs/mmdetection/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "/data/rocket/SGDD/Learning-Polar-Encodings-For-Arbitrary-Oriented-Ship-Detection-In-SAR-Images/loss.py", line 126, in forward wh_loss, iou_loss = self.L_wh(pr_decs['wh'], gt_batch['reg_mask'], gt_batch['ind'], gt_batch['wh']) TypeError: 'float' object is not iterable

Thansk a lot

flyingshan commented 3 years ago

you can try modifying polar.py L506 <return 0.> to <return 0., 0.>.