Converting .pt to .nb

Hello!
I am working on an object detection project using the AMB82 Mini and a custom trained yolov7 model.

I tried to use the online resources on Realtek’s website to convert my best.pt file to a .nb file that can be compatible with the camera, however the file size is too big.
My best.pt file is about 280 MB whereas the maximum file size limit is 35 MB so it won’t let me upload it.

Is there another way I can convert the .pt file to a .nb?
Can I do it manually somehow? If so, are there resources showing how to do this?
I have been trying to find some sort of guide or code but have not found anything yet.
Please let me know what is the best way I can go about handling this situation.

Thank you in advance! :slight_smile:

Hi @Steph_B,

I’m afraid that this might not be possible. Please note that for object detection to be able to run on AMB82-Mini, the model should be yolov7-tiny, and not an actual yolov7 model.

Thank you.

Thank you for confirming this!

I’m still experiencing some issues uploading the yolov7_tiny.nb file. Would you be able to check over my process to see if I’m missing anything?:

Training
I made sure to train the model using only yolov7-tiny with a smaller dataset and fewer epochs to try to minimize the file size.
Doing this allowed me to get a best.pt file that is only about 11MB.

SDK
I downloaded the SDK version 4.0.8 to use on my Arduino IDE 2.3.4.
(I made sure to get the reparametrizing files reparam_yolov7-tiny.py and yolov7-tiny-deploy.yaml from here as well)

Reparameterizing
I reparameterized the best.pt file using the following method as mentioned in the Neural Network - Object Detection guide:
python reparam_yolov7-tiny.py –weights weights/best.pt –custom_yaml custom/yolov7-tiny-deploy.yaml –output best_reparam.pt

Converting .pt to .nb
Then, I used the online converter to get the .nb file which I renamed “yolov7_tiny.nb”

Copy/Replace .nb
As per the Customized AI model Installation Guide, I added the yolov7_tiny.nb file to my sketch folder like so:
C:\Users\USERNAME\AppData\Local\Arduino15\packages\realtek\hardware\AmebaPro2\4.0.8\libraries\NeuralNetwork\examples\ObjectDetectionLoop\yolov7_tiny.nb

So now I have the following 3 files in the ObjectDetectionLoop folder:
ObjectClassList.h
ObjectDetectionLoop
yolov7_tiny.nb

Customizations
For the ObjectDetectionLoop file, I added my wifi info and updated this line:
ObjDet.modelSelect(OBJECT_DETECTION, CUSTOMIZED_YOLOV7TINY, NA_MODEL, NA_MODEL);

For the ObjectClassList.h file, I changed the number of classes and the names of the classes to match the class information I had in my .yaml files from training.

Conclusion
Despite all of this, I still can’t get the .nb file to properly upload to the AMB82 mini.
I’ve tried uploading via flash and an SD card where I stored yolov7_tiny.nb in a folder called NN_MDL.
When I try to use flash, I get the following error:
“Model (.nb file) missing or customized model name mismatch. Please include your customized model in sketch folder or rename your model if it is already in sketch folder.”

When I try to use the SD card method, I can’t tell if the model even uploaded since no bounding boxes show up.
I know the model should work since I tested it with example images on my Colab notebook.

I’m not sure what I’m doing wrong to cause the .nb file not to upload. Would you be able to give me any other troubleshooting advice?
Please let me know if you need any additional info or would like to check any files.

Hi @Steph_B,

I believe the steps you performed are correct, we realized that there is a small bug in our tools. We are currently rectifying it. Once it is rectified, we will notify you to try again.

Alternatively, can you try out with the objectdetectioncallback example first while we work on the bug?

Thank you.

Ok, thank you for checking!

I did try the ObjectDetectionCallback example instead and it worked fine!

1 Like