Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yolov4-tiny-3l issue resolved #325

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aditya-5842
Copy link

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

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
Copy link

ciklista commented Jul 1, 2021

@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
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
Copy link

ciklista commented Jul 1, 2021

@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
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
Copy link

ciklista commented Jul 2, 2021

thanks for the clarification! Very helpful.

@ciklista
Copy link

ciklista commented Jul 2, 2021

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

@aditya-5842
Copy link
Author

aditya-5842 commented Jul 3, 2021

@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
Copy link

ciklista commented Jul 16, 2021

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

image

Copy link

@AntoAndGar AntoAndGar left a comment

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
Copy link

rafcy commented Nov 22, 2021

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

@KuoEuran
Copy link

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

None yet

5 participants