jtvkw2 / DRL-Active-Object-Detection

Deep Reinforcement Learning for Active Object Detection: A novel approach that combines deep reinforcement learning with active learning strategies to improve object detection performance while minimizing annotation costs.
Apache License 2.0
2 stars 0 forks source link

AssertionError: targets should not be none when in training mode #1

Open samakos opened 1 year ago

samakos commented 1 year ago

hello! and amazing work!! could you please help with this error? Traceback (most recent call last): File "/home/ec2-user/SageMaker/DRL-ActiveObjectDetection/main.py", line 32, in main() File "/home/ec2-user/SageMaker/DRL-ActiveObjectDetection/main.py", line 28, in main trainer.train() File "/home/ec2-user/SageMaker/DRL-ActiveObjectDetection/utils/trainer.py", line 64, in train detector_output = self.detector_network(images) ####I added targets) File "/home/ec2-user/anaconda3/envs/pytorch_p39/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, *kwargs) File "/home/ec2-user/SageMaker/DRL-ActiveObjectDetection/models/detector_network.py", line 50, in forward detections = self.model(images) File "/home/ec2-user/anaconda3/envs/pytorch_p39/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(input, **kwargs) File "/home/ec2-user/anaconda3/envs/pytorch_p39/lib/python3.9/site-packages/torchvision/models/detection/generalized_rcnn.py", line 62, in forward torch._assert(False, "targets should not be none when in training mode") File "/home/ec2-user/anaconda3/envs/pytorch_p39/lib/python3.9/site-packages/torch/init.py", line 853, in _assert assert condition, message AssertionError: targets should not be none when in training mode

samakos commented 1 year ago

more specifically I am trying to use your code in a layout analysis dataset (document images and each image has annotations for paragraph, title, section-header, table, etc.)