WongKinYiu / yolov9

Implementation of paper - YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information
GNU General Public License v3.0
9.04k stars 1.44k forks source link

A question about utils\general.py: prediction[0] or prediction[0][0]? #457

Open adam-lyy opened 6 months ago

adam-lyy commented 6 months ago

After running train.py, when I run val.py, it reports an error:

File "C:\Users\14547\PycharmProjects\yolov9-main\utils\general.py", line 905, in non_max_suppression device = prediction.device ^^^^^^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'device'

After I change line 903 in general.py from prediction = prediction[0] to prediction = prediction[0][0], val.py gets right.

But when I run train.py again, it reports an error:

File "C:\Users\14547\PycharmProjects\yolov9-main\val.py", line 213, in run path, shape = Path(paths[si]), shapes[si][0]


IndexError: list index out of range

After I reset line 903 in general.py, train.py gets right.

So need I set line 903 in general.py as `prediction = prediction[0]` when training and set it as `prediction = prediction[0][0]` when testing? Or are there any better solutions?
WongKinYiu commented 6 months ago

Please use val_dual.py to inference yolov9 models. val.py is for gelan models.