tensorflow-yolov4-tflite: OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function 'rectangle'

After saving the model, running detection with ‘python detect.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --images ./data/images/kite.jpg’ give me an error of: cv2.error: OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function 'rectangle' > Overload resolution failed: > - Can't parse 'pt1'. Sequence item with index 0 has a wrong type > - Can't parse 'pt1'. Sequence item with index 0 has a wrong type > - Can't parse 'rec'. Expected sequence length 4, got 2 > - Can't parse 'rec'. Expected sequence length 4, got 2

About this issue

Commits related to this issue

Most upvoted comments

Try to change following lines in core/utils.py as defined below:

Line 152 -> c1, c2 = (int(coor[1]), int(coor[0])), (int(coor[3]), int(coor[2])) Line 159 -> cv2.rectangle(image, c1, (int(np.float32(c3[0])), int(np.float32(c3[1]))), bbox_color, -1) Line 161 -> cv2.putText(image, bbox_mess, (c1[0], int(np.float32(c1[1] - 2))), cv2.FONT_HERSHEY_SIMPLEX, fontScale, (0, 0, 0), bbox_thick // 2, lineType=cv2.LINE_AA)

That’s a really cool solution thanks 😃

@lazarjovanovicnissatech Thank you! I have been struggling with this as well.

@lazarjovanovicnissatech Thank you, it worked! 😄

@lazarjovanovicnissatech same problem occured in windows 10. You are great, i think repo should be updated