hunglc007 / tensorflow-yolov4-tflite

YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
https://github.com/hunglc007/tensorflow-yolov4-tflite
MIT License
2.24k stars 1.24k forks source link

yolov4-tiny-3l issue resolved #325

Open aditya-5842 opened 3 years ago

aditya-5842 commented 3 years ago

Made the required changes to make the repo work for yolov4-tiny-3l.

ciklista commented 3 years ago

@aditya-5842 could you explain how you generate the weights file for your tiny3L? Can I use any of the pre trained darknet ones (https://github.com/AlexeyAB/darknet/releases) ?

aditya-5842 commented 3 years ago

@aditya-5842 could you explain how you generate the weights file for your tiny3L? Can I use any of the pre trained darknet ones (https://github.com/AlexeyAB/darknet/releases) ?

Yes, you can use the pre-trained YOLO-Tiny model (https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.conv.29) to initialize the weights.

ciklista commented 3 years ago

@aditya-5842 could you explain how you generate the weights file for your tiny3L? Can I use any of the pre trained darknet ones (https://github.com/AlexeyAB/darknet/releases) ?

Yes, you can use the pre-trained YOLO-Tiny model (https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.conv.29) to initialize the weights. getting the following error with the above weights file. Command was

python save_model.py --weights ./data/yolov4-tiny-conv.29  --output ./checkpoints/yolov4-tiny-3l --input_size 416 --model yolov4-tiny-3l --tiny

(sorry for the screenshot) image

aditya-5842 commented 3 years ago

@aditya-5842 could you explain how you generate the weights file for your tiny3L? Can I use any of the pre trained darknet ones (https://github.com/AlexeyAB/darknet/releases) ?

Yes, you can use the pre-trained YOLO-Tiny model (https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.conv.29) to initialize the weights. getting the following error with the above weights file. Command was

python save_model.py --weights ./data/yolov4-tiny-conv.29  --output ./checkpoints/yolov4-tiny-3l --input_size 416 --model yolov4-tiny-3l --tiny

(sorry for the screenshot) image

Sorry, I could not give a detailed answer.

You can one of my trained model. This is for detecting the license-plate/s in image.

ciklista commented 3 years ago

thanks for the clarification! Very helpful.

ciklista commented 3 years ago

@aditya-5842 any reason why you changed the __C.YOLO.ANCHORS_TINY in the config?

aditya-5842 commented 3 years ago

@ciklista Look at line 17. It is anchor-boxes. YOLOV4-Tiny (i.e. by default Tiny-2l) has only 2 Yolo layers at the end and each layer YOLO layer needs 3 different anchor boxes. So total we need 6 boxes (3 *2=6). These anchors are going to be reshaped into 2 x 3 x 2 array. Each continuous pair will make a different anchor box and all anchor boxes should be different. If you notice anchor 81,82 is repeating in line 17, so it should be corrected.

Now I'm not sure I got the first two values of line 18. May be I did some google search and found these values. But it worked for me.

NOTE: Initially, with line 17 as anchors, my YOLOV4-Tiny was not working. https://github.com/hunglc007/tensorflow-yolov4-tflite/blob/13e6adc274c408a6f1fed83b836b7e6452024d93/core/config.py#L17-L18

ciklista commented 3 years ago

you are right. The original anchors where drawing bounding boxes a little too large. Looking better with yours, thanks for the fix :) image

image

rafcy commented 2 years ago

Thank you for the contribution, just tested and it's working!

KuoEuran commented 2 years ago

@aditya-5842 Thank you for your great work, I have a question about the depthwise separable convolution convert from weights to tflite, do you have any idea about this?