First I assumed that you have already downloaded YOLO to /home/nvidia/darknet
where nvidia
is the host name.
CC: error: unrecognized command line option ‘-mavx’
CC: error: unrecognized command line option ‘-mavx2’
CC: error: unrecognized command line option ‘-msse3’
CC: error: unrecognized command line option ‘-msse4.1’
CC: error: unrecognized command line option ‘-msse4.2’
CC: error: unrecognized command line option ‘-msse4a’
Go into the cmakelist.txt, just remove the two lines involved with mavx etc., as they're x86 options and not available on tx2. The detection works fine for me.
Just like it said in YOLO website,
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights
will run a real-time YOLO detection. However if we want to make use of the built-in camera on TX2 board, this command doesn't work.
To make use of the built-in camera, a sample OpenCV python program is:
import cv2 as cv
gst_str = 'nvarguscamerasrc ! video/x-raw(memory:NVMM), ' +
'width=(int)1920, height=(int)1080, ' +
'format=(string)NV12, framerate=(fraction)30/1 ! ' +
'nvvidconv flip-method=2 ! ' +
'video/x-raw, format=(string)BGRx ! ' +
'videoconvert ! appsink'
cap = cv.VideoCapture(gst_str, cv.CAP_GSTREAMER)
_, img = cap.read()
cv.imshow('foo', img)
cv.waitKey(0)
Similarly, we can run gst-launch-1.0
to preview the camera:
gst-launch-1.0 nvarguscamerasrc ! "video/x-raw(memory:NVMM)" ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! omxh265enc ! matroskamux ! appsink
To run darknet with built-in camera, the command is:
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink"