YOLOX Evaluation problem when training, operands could not be broadcast together with shapes (0,5) and (0,)

I’m new to yolox and am using the voc2007 dataset.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<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>
<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:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<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>
<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,) 

New contributor

why1729 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật