NVIDIA Jetson Nano & Yolo3(Darknet) – PART1

Estimated read time 3 min read

1. Fan control

#For Preventing OverHeat (오버히트 방지를 위해 팬 장착)

git clone https://github.com/Pyrestone/jetson-fan-ctl
cd jetson-fan-ctl/
sudo gedit /etc/automagic-fan/config.json

2. Camera Test

method1 : gst-launch-1.0 nvarguscamerasrc ! ‘video/x-raw(memory:NVMM),width=3820, height=2464, framerate=21/1, format=NV12’ ! nvvidconv flip-method=0 ! ‘video/x-raw,width=960, height=616’ ! nvvidconv ! nvegltransform ! nveglglessink -e

method2: ls -als /dev/video*
결과: 장착된 video0, 1이 확인됨
(라즈베리파이용 카메라가 0, USB카메라가 1로 확인)

3. OpenCV 4

##ref : https://www.jetsonhacks.com/2019/11/22/opencv-4-cuda-on-jetson-nano/
##OpenCV는 컴파일 하여야 함. (make전에 pkgconfig = YES로 수정할 것)

git clone https://github.com/JetsonHacksNano/buildOpenCV
cd buildOpenCV/

** need to modify “buildOpenCV.sh”

** -D OPENCV_GENERATE_PKGCONFIG=YES \


./buildOpenCV.sh |& tee openCV_build.log

4. YOLO3 – Darknet

sudo apt-get update
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

git clone https://github.com/AlexeyAB/darknet
cd darknet
wget https://pjreddie.com/media/files/yolov3.weights
wget https://pjreddie.com/media/files/yolov3-tiny.weights

*Makefile 수정

sudo vi Makefile
GPU=1
CUDNN=1
OPENCV=1

ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]

##https://github.com/AlexeyAB/darknet 는 기본적으로 opencv2로 설정되어있음. opencv4로 설정 변경할것

#LDFLAGS+= pkg-config --libs opencv

#COMMON+= pkg-config --cflags opencv

LDFLAGS+= pkg-config --libs opencv 2> /dev/null || pkg-config --libs opencv4 -lstdc++
COMMON+= pkg-config --cflags opencv 2> /dev/null || pkg-config --cflags opencv4

make

이미지테스트

./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg

yoloy3 : 1034ms
yolov3-tiny : 217ms

Video Mp4 test

./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights -ext_output data/street.mp4

./darknet detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights -ext_output data/street.mp4

WebCam input Test

./darknet detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights -ext_output -c 1
(메모리 leak 발생)


https://devtalk.nvidia.com/default/topic/1064350/jetson-nano/memory-leak-running-darknet-yolo-with-opencv-on-a-gstreamer-input/

[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

CAMREA 직접 이용시 메모리 Leak 발생함!

(OPTION) 최대 성능 모드

https://wendys.tistory.com/167 (Default : max mode)

sudo nvpmodel -q
sudo nvpmodel -m0

#(darknet-original)

git clone https://github.com/pjreddie/darknet.git
##Nothing Changed

##RESULT
./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
Loading weights from yolov3.weights…Done!
data/dog.jpg: Predicted in 96.861418 seconds.
dog: 100%
truck: 92%
bicycle: 99%

./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg
##RESULT
Loading weights from yolov3-tiny.weights…Done!
data/dog.jpg: Predicted in 4.219405 seconds.
dog: 57%
car: 52%
truck: 56%
car: 62%
bicycle: 59%

[TODO]

M2Det

Codebase for AAAI2019 “M2Det: A Single-Shot Object Detector based on Multi-Level Feature Pyramid Network” [Paper link]

Author: Qijie Zhao. Date: 19/01/2019


https://github.com/qijiezhao/M2Det

You May Also Like

More From Author

+ There are no comments

Add yours