Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError #45

Open
smilerichpse opened this issue Sep 7, 2021 · 5 comments
Open

AssertionError #45

smilerichpse opened this issue Sep 7, 2021 · 5 comments

Comments

@smilerichpse
Copy link

smilerichpse commented Sep 7, 2021

❓ 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 of lr_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
Copy link
Author

I solved this error with rebuilng dataset

@jodumagpi
Copy link

@smilerichpse what do you mean rebuilding the dataset?

@AidenFather
Copy link

I solved this error with rebuilng dataset

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

@aimshirley
Copy link

@smilerichpse Can you share how to slove this problem?

@fariba87
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants