TX2利用yolov4实时目标检测

工业级别的目标检测关注的不仅仅是精度,还有速度,能达到实时是最理想状态,一般来讲,目标检测实时大于12.5fps被认为是实时,针对TX2利用yolov4检测博主做了一个详细的调研和测试。

1.下载darknet,网址如下:

git clone https://github.com/AlexeyAB/darknet.git

2.配置makefile文件

由于TX2已经刷机Jetpack4.4,TX2里面有gpu,cuda和cudnn等,修改makefile文件如下:

GPU=1
CUDNN=1
OPENCV=1

TX2利用yolov4实时目标检测_第1张图片

3.在darknet路径下编译如下

make

4.下载权重,放到darknet目录下

# yolov4-tiny.weights
wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights
# yolov4.weights
wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4.weights


5.测试(yolov4 and yolov4-tiny)

(1).测试图片

./darknet detector test cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights data/dog.jpg 
./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights data/dog.jpg 

(2).测试视频

./darknet detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights data/sample.mp4
./darknet detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights data/sample.mp4

TX2利用yolov4实时目标检测_第2张图片 

(3).实时测试板载摄像头 (CSI摄像头实时检测)


./darknet detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=1280, height=720, format=NV12, framerate=30/1 ! nvvidconv flip-method=0 ! video/x-raw, width=1280, height=720, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink"


./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=1280, height=720, format=NV12, framerate=30/1 ! nvvidconv flip-method=0 ! video/x-raw, width=1280, height=720, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink"

(4).实时检测usb摄像头

 

./darknet detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights  -c 1
./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights  -c 1

TX2利用yolov4实时目标检测_第3张图片

(5).rstp实时检测

./darknet detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights rstp://admin:[email protected]/0
./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights rstp://admin:[email protected]/0

 6 总结

评论区留言哦 

下集预告:如何按照自己的需求训练模型以及二次开发

 

 

 

你可能感兴趣的:(基于深度学习的嵌入式,神经网络,深度学习)