Notifications
Clear all

Question Use custom trained model with PeekingDuck

10 Posts
4 Users
0 Likes
848 Views
(@markv)
Active Member Member
Joined: 1 year ago
Posts: 7
Topic starter  

Hello to everybody

I wanted to ask how can I use a custom trained model through PeekingDuck. I've managed to train a custom model based on the yolo v4 tiny with Roboflow and got the new weights. How should I replace the default ones of the tiny yolo v4 with my new ones?

Thanks in advance


   
Quote
Gao Hongnan
(@gao-hongnan)
Eminent Member Moderator
Joined: 1 year ago
Posts: 28
 

Hi there, thanks for the question! Noted that you are using Roboflow to train the custom model.   

Let me have a short discussion with my team and get back to you! Cheers!


   
ReplyQuote
Gao Hongnan
(@gao-hongnan)
Eminent Member Moderator
Joined: 1 year ago
Posts: 28
 

Hi, may I check if you are using RoboFlow's tutorial here?


   
ReplyQuote
(@markv)
Active Member Member
Joined: 1 year ago
Posts: 7
Topic starter  

Yep this is it. I was actually trying to add a couple of classes to my yolo v4 tiny model so i've trained it with a few custom images in order to have better detection regarding these classes. But i'm not sure how to proceed with importing the trained model and use it through peeking duck instead of the default one.


   
ReplyQuote
Gao Hongnan
(@gao-hongnan)
Eminent Member Moderator
Joined: 1 year ago
Posts: 28
 

Hi, in that case, you may have to create a custom node to inference your custom-trained model.

 

Here's a tutorial to get you started, however, if you have troubles, feel free to reach to me via messages, and we can connect further.


   
ReplyQuote
(@markv)
Active Member Member
Joined: 1 year ago
Posts: 7
Topic starter  

Thank you very much! I will try it out and if I fail I will get in touch. 🙂 


   
ReplyQuote
Gao Hongnan
(@gao-hongnan)
Eminent Member Moderator
Joined: 1 year ago
Posts: 28
 

@markv Okay, you are most welcome!


   
ReplyQuote
dotw
 dotw
(@dotw)
New Member AISG Staff
Joined: 1 year ago
Posts: 1
 

@markv Just to explain a bit on why a custom node is required: PeekingDuck default model weights cannot be replaced, as there is a built-in check for file integrity, which will fail if the weights do not match. Hence, you need to save your custom weights in a sub-directory and write a custom node to load those weights, init the model and use that to do your custom inference. 


   
ReplyQuote
(@jonasss)
Active Member Member
Joined: 10 months ago
Posts: 4
 

@dotw Hi, my friends and I are actually attempting a project which is similar to the original poster's post. We would like to ask exactly how to write the custom nodes to load the custom weights we have saved after we have trained the model using Yolo v4 using the Darknet Framework, following @gao-hongnan's post roboflow tutorial link earlier in this discussion?


   
ReplyQuote
Gao Hongnan
(@gao-hongnan)
Eminent Member Moderator
Joined: 1 year ago
Posts: 28
 

Hi @jonasss, please refer to the link in the tutorial for an illustrated example of how to use a custom model within PeekingDuck.

More concretely, for the custom model node you have to need to do two things:

1. Load the trained model weights into memory;

2. Perform inference by calling the model on the inputs.

 


   
ReplyQuote
Share: