先前使用的這兩個detectnet.cpp / detectnet.py 範例程式支援即時視訊鏡頭的串流。所支援的鏡頭規格,官方列出三種:
MIPI CSI cameras (csi://0)
V4L2 cameras (/dev/video0) #我用羅技的鏡頭硬體抓到的設備就是video0
RTP/RTSP streams (rtsp://username:password@ip:port)
依據您裝的鏡頭選用C++或者python的程式,可以立即開啟鏡頭作辨識
記得要先執行Docker container喔
C++
$ ./detectnet csi://0 # MIPI CSI camera
$ ./detectnet /dev/video0 # V4L2 camera
$ ./detectnet /dev/video0 output.mp4 # save to video file
Python
$ ./detectnet.py csi://0 # MIPI CSI camera
$ ./detectnet.py /dev/video0 # V4L2 camera
$ ./detectnet.py /dev/video0 output.mp4 # save to video file
這裡有顯示
V4L2_DEVICES: --dev/video0
影片裡有找到人、手機跟手機反射的滑鼠,真的蠻有趣的
note: for example cameras to use, see these sections of the Jetson Wiki:
- Nano: https://eLinux.org/Jetson_Nano#Cameras
- Xavier: https://eLinux.org/Jetson_AGX_Xavier#Ecosystem_Products_.26_Cameras
- TX1/TX2: developer kits include an onboard MIPI CSI sensor module (0V5693)
您可以選用其他的模型來做辨識,官網當中有使用coco-dog 模型作動物跟杯子的辨識,如果在辨識的時候找不到或辨識校效果不佳,可以嘗試去調整 --threshold 這個參數,看是增加或減少,她的預設值是0.5