Hi Dusty,
With Imagenet-camera the object classification works. But I wanted the co-ordinates of the object as well. Hence I want to use detecnet-camera with my customized model.
I have added both detectnet and imagenet code into one file (imagenet-console_camera.py) as below…
create the camera and display
font = jetson.utils.cudaFont()
camera = jetson.utils.gstCamera(1280, 720, opt.camera)
display = jetson.utils.glDisplay()
load the recognition network
net = jetson.inference.imageNet(opt.network, sys.argv)
load the object detection network
net_detect = jetson.inference.detectNet(opt.network, sys.argv, opt.threshold)
process frames until user exits
while display.IsOpen():
# load an image (into shared CPU/GPU memory)
#img, width, height = jetson.utils.loadImageRGBA(opt.file_in)
# capture the image
img, width, height = camera.CaptureRGBA()
# detect objects in the image (with overlay)
detections = net_detect.Detect(img, 1280, 720, opt.overlay)
#print("\n Image loaded is:",width,"X",height,"\n")
# classify the image
class_idx, confidence = net.Classify(img, width, height)
# find the object description
class_desc = net.GetClassDesc(class_idx)
# print the detections
print("detected {:d} objects in image".format(len(detections)))
for detection in detections:
print(detection)
# overlay the result on the image
if confidence > 0.4:
font.OverlayText(img, width, height, "{:05.2f}% {:s}".format(confidence * 100, class_desc), 5, 5, font.White, font.Gray40)
# render the image
display.RenderOnce(img, width, height)
# update the title bar
#display.SetTitle("{:s} | Network {:.0f} FPS".format(net.GetNetworkName(), net.GetNetworkFPS()))
# print out the result
#print("image is recognized as '{:s}' (class #{:d}) with {:f}% confidence\n".format(class_desc, class_idx, confidence * 100))
# print out timing info
#net.PrintProfilerTimes()
# overlay the result on the image
The command I am using is,
python3.6 imagenet-console_camera.py --model=/home/jetbot/jetson-inference/python/training/classification/cat_dog/resnet18.onnx --input_blob=input_0 --output_blob=output_0 --labels=/home/jetbot/datasets/cat_dog/labels.txt --camera=0
With this the object classification is working…but I am not getting the oject detection co-ordinates properly…the bounding rectangular boxes is not correct.