Skip to content

yolov4-tiny-3l issue resolved#325

Open
aditya-5842 wants to merge 2 commits into
hunglc007:masterfrom
aditya-5842:yolov4-tiny-3l-fix
Open

yolov4-tiny-3l issue resolved#325
aditya-5842 wants to merge 2 commits into
hunglc007:masterfrom
aditya-5842:yolov4-tiny-3l-fix

Conversation

@aditya-5842

@aditya-5842 aditya-5842 commented Mar 26, 2021

Copy link
Copy Markdown

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

@aditya-5842 aditya-5842 mentioned this pull request Jun 16, 2021
@ciklista

ciklista commented Jul 1, 2021

Copy link
Copy Markdown

@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

Copy link
Copy Markdown
Author

@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

ciklista commented Jul 1, 2021

Copy link
Copy Markdown

@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

Copy link
Copy Markdown
Author

@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.

  • Like I mentioned above that use YOLOV4-Tiny pretrained to initialize the model. Then train the model on your data. You can use this notebook to train your own model.
  • Once training is over, you can use your saved weights to do the conversion. Please note that ./data/yolov4-tiny-conv.29 is not the full Tiny-3l model. It contains only starting layers of the YOLOV4 (tiny) model.

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

@ciklista

ciklista commented Jul 2, 2021

Copy link
Copy Markdown

thanks for the clarification! Very helpful.

@ciklista

ciklista commented Jul 2, 2021

Copy link
Copy Markdown

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

@aditya-5842

aditya-5842 commented Jul 3, 2021

Copy link
Copy Markdown
Author

@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.

# __C.YOLO.ANCHORS_TINY = [23,27, 37,58, 81,82, 81,82, 135,169, 344,319]
__C.YOLO.ANCHORS_TINY = [10,14, 23,27, 37,58, 81,82, 135,169, 344,319]

@aditya-5842 aditya-5842 closed this Jul 3, 2021
@aditya-5842 aditya-5842 reopened this Jul 3, 2021
@ciklista

ciklista commented Jul 16, 2021

Copy link
Copy Markdown

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

image

@AntoAndGar AntoAndGar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good job!

@rafcy

rafcy commented Nov 22, 2021

Copy link
Copy Markdown

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

@KuoEuran

Copy link
Copy Markdown

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants