Bug when training using Roboflow-Custom-Scaled-YOLOv4 colab

Screen shots of error:

  1. Copy/Paste of your code
    I used the git copy at:
    !git clone GitHub - roboflow/ScaledYOLOv4

Failure is on training statement:
!python train.py --img 768 --batch 16 --epochs 60 --data {dataset.location}/data.yaml --cfg ./models/yolov4-csp.yaml --weights ‘’ --name yolov4-csp-results --cache

  1. What you’ve tried so far to debug
    I’ve run this Colab as recently as July, and was able to get it to work with a few mods to the utils/general.py code. Just trying to run same colab with different image training dataset.

This is the error message:
File “/content/ScaledYOLOv4/utils/general.py”, line 556, in build_targets
indices.append((b, a, gj.clamp_(0, gain[3]), gi.clamp_(0, gain[2]))) # image, anchor, grid indices
RuntimeError: result type Float can’t be cast to the desired output type long int

I haven’t tried to change the general.py code this time. It is different from the version that I was successfully using back in July.

@robomims Here is how to solve the issue, fully diagnosed:

@Mohamed , the fix works ! Thanks so much

1 Like