I’m new to yolox and am using the voc2007 dataset.
<code> File "/content/YOLOX/yolox/data/datasets/voc.py", line 264, in _write_voc_results_file
└ array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
ValueError: operands could not be broadcast together with shapes (3,5) (0,)
<code> File "/content/YOLOX/yolox/data/datasets/voc.py", line 264, in _write_voc_results_file
if dets == []:
└ array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
3.5381533e-02],
[-4.9626112e+00, 3.1...
ValueError: operands could not be broadcast together with shapes (3,5) (0,)
</code>
File "/content/YOLOX/yolox/data/datasets/voc.py", line 264, in _write_voc_results_file
if dets == []:
└ array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
3.5381533e-02],
[-4.9626112e+00, 3.1...
ValueError: operands could not be broadcast together with shapes (3,5) (0,)
Further, this bug only appears whenever I evaluate an epoch. so if I evaluate later it won’t appear.
I’ve updated the config and as far as im aware I’ve ensured the dataset paths are correct. what steps do you think i should take? I tried decreasing the confidence threshold to detect more objects, and it did change the shape of (0,5) in the error below as expected but it’s still being broadcasted with (0,) . I’ve tried to fix this for a long time and can’t think of other things to try.
yolox_base and yolox_voc_s matches in depth, width, and num_classes. The custom dataset is in the VocDevkit > VOC2007> ANnotations, imagesets, jpegimages. The self.data_dir is vocdevkit, and self.train_ann is ‘trainval’ and so on.
For the full bug, it says:
<code>Writing aeroplane VOC results file
2024-06-11 14:43:11 | INFO | yolox.core.trainer:195 - Training of experiment is done and the best AP is 0.00
2024-06-11 14:43:11 | ERROR | yolox.core.launch:98 - An error has been caught in function 'launch', process 'MainProcess' (14805), thread 'MainThread' (136600321028736):
Traceback (most recent call last):
File "/content/YOLOX/tools/train.py", line 138, in <module>
└ <function launch at 0x7c3bec9cab00>
> File "/content/YOLOX/yolox/core/launch.py", line 98, in launch
│ └ (╒═══════════════════╤═══════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <function main at 0x7c3bdb502a70>
File "/content/YOLOX/tools/train.py", line 118, in main
│ └ <function Trainer.train at 0x7c3b5729f370>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 76, in train
│ └ <function Trainer.train_in_epoch at 0x7c3b5729f400>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 86, in train_in_epoch
│ └ <function Trainer.after_epoch at 0x7c3b5729f760>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 222, in after_epoch
self.evaluate_and_save_model()
│ └ <function Trainer.evaluate_and_save_model at 0x7c3b5729fa30>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 336, in evaluate_and_save_model
(ap50_95, ap50, summary), predictions = self.exp.eval(
│ │ └ <function Exp.eval at 0x7c3b5729f2e0>
│ └ ╒═══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/exp/yolox_base.py", line 353, in eval
return evaluator.evaluate(model, is_distributed, half, return_outputs=return_outputs)
│ │ (backbone): YOLOPAFPN(
│ │ (backbone): CSPDarknet(
│ └ <function VOCEvaluator.evaluate at 0x7c3b5729d7e0>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/evaluators/voc_evaluator.py", line 114, in evaluate
eval_results = self.evaluate_prediction(data_list, statistics)
│ │ │ └ tensor([ 19.0988, 4.1687, 309.0000], device='cuda:0')
│ │ └ {0: (tensor([[ 5.9809e+01, 2.5041e+01, 2.9600e+02, 4.4769e+02],
│ │ [ 1.1087e+02, 3.4427e+01, 4.0809e+02, 4.7695e+0...
│ └ <function VOCEvaluator.evaluate_prediction at 0x7c3b5729d900>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/evaluators/voc_evaluator.py", line 186, in evaluate_prediction
mAP50, mAP70 = self.dataloader.dataset.evaluate_detections(all_boxes, tempdir)
│ │ │ │ │ └ '/tmp/tmphog54lk2'
│ │ │ │ └ [[array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
│ │ │ │ [-4.9626112e+00, 3...
│ │ │ └ <function VOCDetection.evaluate_detections at 0x7c3b5729e200>
│ │ └ <yolox.data.datasets.voc.VOCDetection object at 0x7c3b502b6980>
│ └ <torch.utils.data.dataloader.DataLoader object at 0x7c3b502b7430>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/data/datasets/voc.py", line 230, in evaluate_detections
self._write_voc_results_file(all_boxes)
│ │ └ [[array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
│ │ [-4.9626112e+00, 3...
│ └ <function VOCDetection._write_voc_results_file at 0x7c3b5729e320>
└ <yolox.data.datasets.voc.VOCDetection object at 0x7c3b502b6980>
File "/content/YOLOX/yolox/data/datasets/voc.py", line 264, in _write_voc_results_file
└ array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
ValueError: operands could not be broadcast together with shapes (3,5) (0,)
<code>Writing aeroplane VOC results file
2024-06-11 14:43:11 | INFO | yolox.core.trainer:195 - Training of experiment is done and the best AP is 0.00
2024-06-11 14:43:11 | ERROR | yolox.core.launch:98 - An error has been caught in function 'launch', process 'MainProcess' (14805), thread 'MainThread' (136600321028736):
Traceback (most recent call last):
File "/content/YOLOX/tools/train.py", line 138, in <module>
launch(
└ <function launch at 0x7c3bec9cab00>
> File "/content/YOLOX/yolox/core/launch.py", line 98, in launch
main_func(*args)
│ └ (╒═══════════════════╤═══════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <function main at 0x7c3bdb502a70>
File "/content/YOLOX/tools/train.py", line 118, in main
trainer.train()
│ └ <function Trainer.train at 0x7c3b5729f370>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 76, in train
self.train_in_epoch()
│ └ <function Trainer.train_in_epoch at 0x7c3b5729f400>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 86, in train_in_epoch
self.after_epoch()
│ └ <function Trainer.after_epoch at 0x7c3b5729f760>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 222, in after_epoch
self.evaluate_and_save_model()
│ └ <function Trainer.evaluate_and_save_model at 0x7c3b5729fa30>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 336, in evaluate_and_save_model
(ap50_95, ap50, summary), predictions = self.exp.eval(
│ │ └ <function Exp.eval at 0x7c3b5729f2e0>
│ └ ╒═══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/exp/yolox_base.py", line 353, in eval
return evaluator.evaluate(model, is_distributed, half, return_outputs=return_outputs)
│ │ │ │ │ └ True
│ │ │ │ └ False
│ │ │ └ False
│ │ └ YOLOX(
│ │ (backbone): YOLOPAFPN(
│ │ (backbone): CSPDarknet(
│ │ (stem): Focus(
│ │ (conv): BaseConv(
│ │ (conv): ...
│ └ <function VOCEvaluator.evaluate at 0x7c3b5729d7e0>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/evaluators/voc_evaluator.py", line 114, in evaluate
eval_results = self.evaluate_prediction(data_list, statistics)
│ │ │ └ tensor([ 19.0988, 4.1687, 309.0000], device='cuda:0')
│ │ └ {0: (tensor([[ 5.9809e+01, 2.5041e+01, 2.9600e+02, 4.4769e+02],
│ │ [ 1.1087e+02, 3.4427e+01, 4.0809e+02, 4.7695e+0...
│ └ <function VOCEvaluator.evaluate_prediction at 0x7c3b5729d900>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/evaluators/voc_evaluator.py", line 186, in evaluate_prediction
mAP50, mAP70 = self.dataloader.dataset.evaluate_detections(all_boxes, tempdir)
│ │ │ │ │ └ '/tmp/tmphog54lk2'
│ │ │ │ └ [[array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
│ │ │ │ 3.5381533e-02],
│ │ │ │ [-4.9626112e+00, 3...
│ │ │ └ <function VOCDetection.evaluate_detections at 0x7c3b5729e200>
│ │ └ <yolox.data.datasets.voc.VOCDetection object at 0x7c3b502b6980>
│ └ <torch.utils.data.dataloader.DataLoader object at 0x7c3b502b7430>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/data/datasets/voc.py", line 230, in evaluate_detections
self._write_voc_results_file(all_boxes)
│ │ └ [[array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
│ │ 3.5381533e-02],
│ │ [-4.9626112e+00, 3...
│ └ <function VOCDetection._write_voc_results_file at 0x7c3b5729e320>
└ <yolox.data.datasets.voc.VOCDetection object at 0x7c3b502b6980>
File "/content/YOLOX/yolox/data/datasets/voc.py", line 264, in _write_voc_results_file
if dets == []:
└ array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
3.5381533e-02],
[-4.9626112e+00, 3.1...
ValueError: operands could not be broadcast together with shapes (3,5) (0,)
</code>
Writing aeroplane VOC results file
2024-06-11 14:43:11 | INFO | yolox.core.trainer:195 - Training of experiment is done and the best AP is 0.00
2024-06-11 14:43:11 | ERROR | yolox.core.launch:98 - An error has been caught in function 'launch', process 'MainProcess' (14805), thread 'MainThread' (136600321028736):
Traceback (most recent call last):
File "/content/YOLOX/tools/train.py", line 138, in <module>
launch(
└ <function launch at 0x7c3bec9cab00>
> File "/content/YOLOX/yolox/core/launch.py", line 98, in launch
main_func(*args)
│ └ (╒═══════════════════╤═══════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <function main at 0x7c3bdb502a70>
File "/content/YOLOX/tools/train.py", line 118, in main
trainer.train()
│ └ <function Trainer.train at 0x7c3b5729f370>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 76, in train
self.train_in_epoch()
│ └ <function Trainer.train_in_epoch at 0x7c3b5729f400>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 86, in train_in_epoch
self.after_epoch()
│ └ <function Trainer.after_epoch at 0x7c3b5729f760>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 222, in after_epoch
self.evaluate_and_save_model()
│ └ <function Trainer.evaluate_and_save_model at 0x7c3b5729fa30>
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/core/trainer.py", line 336, in evaluate_and_save_model
(ap50_95, ap50, summary), predictions = self.exp.eval(
│ │ └ <function Exp.eval at 0x7c3b5729f2e0>
│ └ ╒═══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <yolox.core.trainer.Trainer object at 0x7c3b572c3070>
File "/content/YOLOX/yolox/exp/yolox_base.py", line 353, in eval
return evaluator.evaluate(model, is_distributed, half, return_outputs=return_outputs)
│ │ │ │ │ └ True
│ │ │ │ └ False
│ │ │ └ False
│ │ └ YOLOX(
│ │ (backbone): YOLOPAFPN(
│ │ (backbone): CSPDarknet(
│ │ (stem): Focus(
│ │ (conv): BaseConv(
│ │ (conv): ...
│ └ <function VOCEvaluator.evaluate at 0x7c3b5729d7e0>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/evaluators/voc_evaluator.py", line 114, in evaluate
eval_results = self.evaluate_prediction(data_list, statistics)
│ │ │ └ tensor([ 19.0988, 4.1687, 309.0000], device='cuda:0')
│ │ └ {0: (tensor([[ 5.9809e+01, 2.5041e+01, 2.9600e+02, 4.4769e+02],
│ │ [ 1.1087e+02, 3.4427e+01, 4.0809e+02, 4.7695e+0...
│ └ <function VOCEvaluator.evaluate_prediction at 0x7c3b5729d900>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/evaluators/voc_evaluator.py", line 186, in evaluate_prediction
mAP50, mAP70 = self.dataloader.dataset.evaluate_detections(all_boxes, tempdir)
│ │ │ │ │ └ '/tmp/tmphog54lk2'
│ │ │ │ └ [[array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
│ │ │ │ 3.5381533e-02],
│ │ │ │ [-4.9626112e+00, 3...
│ │ │ └ <function VOCDetection.evaluate_detections at 0x7c3b5729e200>
│ │ └ <yolox.data.datasets.voc.VOCDetection object at 0x7c3b502b6980>
│ └ <torch.utils.data.dataloader.DataLoader object at 0x7c3b502b7430>
└ <yolox.evaluators.voc_evaluator.VOCEvaluator object at 0x7c3c09328850>
File "/content/YOLOX/yolox/data/datasets/voc.py", line 230, in evaluate_detections
self._write_voc_results_file(all_boxes)
│ │ └ [[array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
│ │ 3.5381533e-02],
│ │ [-4.9626112e+00, 3...
│ └ <function VOCDetection._write_voc_results_file at 0x7c3b5729e320>
└ <yolox.data.datasets.voc.VOCDetection object at 0x7c3b502b6980>
File "/content/YOLOX/yolox/data/datasets/voc.py", line 264, in _write_voc_results_file
if dets == []:
└ array([[-4.2242885e+00, 3.8780212e+02, 3.7010245e+02, 4.9919244e+02,
3.5381533e-02],
[-4.9626112e+00, 3.1...
ValueError: operands could not be broadcast together with shapes (3,5) (0,)