mrlooi / rotated_maskrcnn

Rotated Mask R-CNN: From Bounding Boxes to Rotated Bounding Boxes
MIT License
349 stars 62 forks source link

AssertionError #45

Open smilerichpse opened 3 years ago

smilerichpse commented 3 years ago

❓ Questions and Help

When I train as below command, I met the AssertionError. I don't know why happened and how to fix this error. Could you give me a help. Thank you in advance

Ubunutu 20.04 / CUDA 11.1 Pytorch 1.10.0 / Python 3.6

command python tools/train_net.py --config-file "configs/rotated/e2e_ms_rcnn_R_50_FPN_1x.yaml" SOLVER.IMS_PER_BATCH 1 SOLVER.BASE_LR 0.0025 SOLVER.MAX_ITER 720000 SOLVER.STEPS "(480000, 640000)" TEST.IMS_PER_BATCH 1

ErrorMessage 2021-09-07 21:39:22,520 maskrcnn_benchmark.trainer INFO: Start training /home/anthony/dev/virtuealenv/py36/rotated_maskrcnn/lib/python3.6/site-packages/torch/optim/lr_scheduler.py:134: UserWarning: Detected call oflr_scheduler.step()beforeoptimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order:optimizer.step()beforelr_scheduler.step()`. Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate "https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate", UserWarning)

/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/structures/bounding_box.py:268: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at ../aten/src/ATen/native/IndexingUtils.h:30.) bbox = BoxList(self.bbox[item], self.size, self.mode)

/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/structures/bounding_box.py:270: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead. (Triggered internally at ../aten/src/ATen/native/IndexingUtils.h:30.) bbox.add_field(k, v[item])

Traceback (most recent call last): File "tools/train_net.py", line 196, in main() File "tools/train_net.py", line 189, in main model = train(cfg, args.local_rank, args.distributed) File "tools/train_net.py", line 89, in train arguments, File "/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/engine/trainer.py", line 71, in do_train loss_dict = model(images, targets) File "/home/anthony/dev/virtuealenv/py36/rotated_maskrcnn/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1056, in _call_impl return forward_call(input, kwargs) File "/home/anthony/dev/virtuealenv/py36/rotated_maskrcnn/lib/python3.6/site-packages/apex-0.1-py3.6-linux-x86_64.egg/apex/amp/_initialize.py", line 197, in new_fwd applier(kwargs, input_caster)) File "/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 66, in forward proposals, proposal_losses = self.rpn(images, features, targets) File "/home/anthony/dev/virtuealenv/py36/rotated_maskrcnn/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1056, in _call_impl return forward_call(input, *kwargs) File "/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/modeling/rrpn/rrpn.py", line 72, in forward return self._forward_train(anchors, objectness, rpn_box_regression, targets) File "/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/modeling/rrpn/rrpn.py", line 96, in _forward_train anchors, objectness, rpn_box_regression, targets File "/home/anthony/dev/virtuealenv/py36/rotated_maskrcnn/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1056, in _call_impl return forward_call(input, **kwargs) File "/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/modeling/rrpn/inference.py", line 197, in forward boxlists = self.add_gt_proposals(boxlists, targets) File "/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/modeling/rrpn/inference.py", line 85, in add_gt_proposals gt_rrect = get_boxlist_rotated_rect_tensor(target, masks_field, rrects_field) File "/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/modeling/rrpn/utils.py", line 32, in get_boxlist_rotated_rect_tensor rrect_tensor = get_segmentation_mask_rotated_rect_tensor(masks) File "/home/anthony/dev/r_maskrcnn/rotated_maskrcnn/maskrcnn_benchmark/modeling/rrpn/utils.py", line 70, in get_segmentation_mask_rotated_rect_tensor assert -90 <= angle <= 0 AssertionError

smilerichpse commented 3 years ago

I solved this error with rebuilng dataset

jodumagpi commented 2 years ago

@smilerichpse what do you mean rebuilding the dataset?

AidenFather commented 2 years ago

I solved this error with rebuilng dataset

@smilerichpse Can you please elaborate how you solved this error? Thank you in advance!

aimshirley commented 10 months ago

@smilerichpse Can you share how to slove this problem?

fariba87 commented 9 months ago

you should downgrade opencv-python to less than 4.5 (example 4.4.0.46) since cv2.minRectArea results in positive angle in newer version