0

I trained YOLOv3 for 1 class. When I try to predict find my object in the picture it gives me wrong bounding box coordinates and shape.

I've trained yolov3-tiny version with 70 608x608 images. It was working perfect. Even I trained it with CPU and around 100 images it detects my object accurately.

yolov3-tiny cfg settings: batch=64 subdivisions=2 width=416 height=416

yolov3-tiny detection

I found 70 images more. However they are 640x480 images. I resized all images to 640x480 size. Then I trained yolov3-tiny and yolov3 on Google Colab with 170 images. Although the training results show 0.08 accuracy I get terrible detection results.

yolov3.cfg settings:

batch=1 subdivisions=1 width=640 height=480

yolov3 detection

I wonder that why results got worse. How can I have accurate detection?

Botje
  • 26,269
  • 3
  • 31
  • 41
Ugurcan
  • 366
  • 1
  • 4
  • 17

1 Answers1

2

[Updated]

I recall YOLO handles resizing for you keeping aspect ratio. Have you tried running it without changing width and height in cfg?

You should be able to run the training without rescaling your input images. Try running that previous config that worked for you but use new images?

Just noticed you also changed batch size and subdivisions. The values you provided in the second config might be too low for mode to learn anything. Have you tried going back to previous settings? (batch=64, subdivisions=2)

Karol Żak
  • 2,158
  • 20
  • 24
  • Thank you. I tried without changing width and height for tiny version but it failed again. I always standardize my data before training. I will try without resizing but if only training with 640x480 images failed now wouldn't it affect my model if I mix them mainly 640x480 images? – Ugurcan Jun 03 '20 at 08:25
  • Sorry, I don't know what you mean in the second part of your reply. Could you elaborate? – Karol Żak Jun 03 '20 at 08:32
  • 1
    Also, I just noticed you changed batch and subdivisions params in your config. Try going back to batch=64. Possible that your model is having hard times to learn anything with just 1 image per epoch – Karol Żak Jun 03 '20 at 08:34
  • Sorry. Let me make it more clear. Now, I've only trained yolov3-tiny model with 640x480 images and it failed. The bounding box coordinates are completely wrong. I have 111 608x608 images. I will add 70 640x480 images but I suppose 640x480 images disrupt my model. If I add 640x480 images into other images, will it not affect my model badly? In addition, I also tried to make prediction on 640x480 images with the model which I trained with 608x608 images and it failed again. – Ugurcan Jun 03 '20 at 08:48
  • You are right. I tried to train on my computer first that's why I changed batch size and subdivisions. Then I moved to Colab and I forget to change it. – Ugurcan Jun 03 '20 at 09:06
  • I solved the problem. There was a problem with the label files. I rearranged them. – Ugurcan Jun 08 '20 at 09:16