detectnet-camera: using custom trained model

Hi,

I want to use my own custom trained model with detectnet-camera.py code. Please provide me complete details on how to do this.

Currently the detecnet-camera.py is by default referring to “SSD-Mobilenet-v2” network.

  1. How and where to change this to another model (for eg:- googlenet). In detectnet-camera.py, if I change the below line to “googlenet” , still it is referring to “SSD-Mobilenet-v2”.
    net = jetson.inference.detectNet(“googlenet”, sys.argv, opt.threshold)

  2. I have created my customized training model of cat_dog and this has generated the “resnet18.onnx” .
    I need to use this as the training model in detectnet-camera instead of “SSD-Mobilenet-v2”. let me know how to do this?

Regards,
Shankar

Hi Shankar, googlenet and resnet18 are image classification networks and not object detection networks, so they should be used with imagenet-console/imagenet-camera.

See these commands for loading custom model with imagenet-console and imagenet-camera:

https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-cat-dog.md#processing-images-with-tensorrt
https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-cat-dog.md#running-the-live-camera-program

Hi Dusty,

Got it. The classification networks cannot be used for detection networks. Thank you.

If I need to use the different network model for object detection, How and where to change?

For custom detection network model: Should I use the below reference for generating custom detection network?
https://medium.com/swlh/nvidia-jetson-nano-custom-object-detection-from-scratch-using-tensorflow-and-opencv-113fe4dba134

Please provide details for generating the custom detection networks and instructions on using it with detectnet-camera.py.

Regards,
Shankar

Hi Shankar, that post is a good starting point, and if you wanted to convert your re-trained SSD model to TensorRT, see some of the other resources listed in this post: https://devtalk.nvidia.com/default/topic/1070225/jetson-nano/digits-or-somthing-else/post/5421938/#5421938