Hi guys, ok the Python bindings for detectNet are ready to try, along with camera streaming and OpenGL display.
Re-clone the python branch of jetson-inference repo, and after building/installing it, try running these:
$ cd jetson-inference-python/build/aarch64/bin
$ ./camera-viewer.py # test camera streaming
$ ./detectnet-console.py --network=coco-dog dog_1.jpg test_dog_1.jpg
$ ./detectnet-console.py --network=pednet peds-004.jpg test_peds_4.jpg
$ ./detectnet-camera.py --network=facenet
And here is the Python code for realtime object detection with camera streaming, pretty simple!
import jetson.inference
import jetson.utils
import argparse
# parse the command line
parser = argparse.ArgumentParser()
parser.add_argument("--network", type=str, default="pednet", help="model to use, can be: pednet, multiped, facenet, coco-dog, coco-bottle, coco-chair, coco-airplane")
parser.add_argument("--threshold", type=float, default=0.5, help="minimum detection threshold to use")
parser.add_argument("--width", type=int, default=1280, help="desired width of camera stream (default is 1280 pixels)")
parser.add_argument("--height", type=int, default=720, help="desired height of camera stream (default is 720 pixels)")
parser.add_argument("--v4l2_device", type=int, default=-1, help="if using VL42 camera, index of the desired /dev/video node")
opt, argv = parser.parse_known_args()
# load the object detection network
net = jetson.inference.detectNet(opt.network, argv, opt.threshold)
# create the camera and display
camera = jetson.utils.gstCamera(opt.width, opt.height, opt.v4l2_device)
display = jetson.utils.glDisplay()
# process frames until user exits
while display.IsOpen():
# capture the image
img, width, height = camera.CaptureRGBA()
# detect objects in the image (with overlay)
detections = net.Detect(img, width, height)
# print the detections
print("detected {:d} objects in image".format(len(detections)))
for detection in detections:
print(detection)
# render the image
display.RenderOnce(img, width, height)
# update the title bar
display.SetTitle("{:s} | {:.0f} FPS".format(opt.network, display.GetFPS()))
Next I am going to add support for importing arrays into memory from numpy.