tfyolo icon indicating copy to clipboard operation
tfyolo copied to clipboard

detect wrong

Open Superman0307 opened this issue 3 years ago • 3 comments

After finishing train 100 epoch with voc dataset,I detect the train sample.but It's find nothing . the Loss about 500.

Superman0307 avatar Jun 07 '21 02:06 Superman0307

I have the same issue. I train without any problem with loss around 200 but when I run detect.py it shows the message no box detected which means there is not bbox detected. Were you able to figure this out @LongxingTan ?

kalikhademi avatar Jun 18 '21 16:06 kalikhademi

I had the same issue, using the pre-trained model (converted from pytorch). In the detect.py, there might be something wrong with pred_bbox. I am debugging now.

AI-Passionner avatar Oct 19 '21 18:10 AI-Passionner

Figured it out. It seems that the detect.py has some bugs there. The model was yolo5s, converted from the Ultralytics yolo5. What I did are following:

  1. comment out the next two lines. If you check the function batch_non_max_suppression(). Those variable definitions are not consistent.

pred_bbix = [tf.reshape(x , ...]

pred_bbox = tf.concat(pred_bbox, ...)

  1. The predictions of bbox are [0, 1]. We need to re-scale back to the image input size, for example, 640x640 (depending on your training model). I added two lines before calling the resize_back(). bboxes[:, [0,2]] = bboxes[:, [0,2]] *640 bboxes[:, [1,3]] = bboxes[:, [1,3]] *640

Then it fixed the problem of no box detected. Hopefully, this is helpful.

AI-Passionner avatar Oct 20 '21 03:10 AI-Passionner