# Install & run YOLOv4 on Jetson Xavier NX ###### tags: `Jetson Xavier NX` `Object Detection` `yolo` [TOC] ## Tutorial video {%youtube QJ5jOlbieuY %} ## Step > Follow the steps[color=#375799] * Update the libraries ```command sudo apt-get upgrade ``` * Download darknet ```command git clone https://github.com/AlexeyAB/darknet.git ``` * Export CUDA path (Running GPU) ```command edit ~/.bashrc ``` * Copy-paste at the end of the file the following commands: ``` export DARKNET_HOME=/home/dask/darknet/ export CUDA_HOME=/usr/local/ export PATH=${DARKNET_HOME}:${CUDA_HOME}bin:${PATH} export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.2/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} ``` * Update bashrc ```command source ~/.bashrc ``` * Download the entire version YoloV4 and the smallest version YoloV4-tiny weights. Download the weights in the darknet file. ```command cd darknet ``` 1. Yolo v4 ```command wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights ``` 2. Yolo v4-tiny ```command wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights ``` * Modify Makefile content ``` GPU=1 CUDNN=1 CUDNN_HALF=1 OPENCV =1 AVX=0 OPENMP=0 LIBSO=1 ``` * Compiling the library ```command make ``` ## Command to run yolo On Linux use `./darknet` instead of `darknet.exe`. ### Video * COCO dataset @ ==yolo v4== pretrained model. ```command ./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights -ext_output $test_video ``` * COCO dataset @ ==yolo v4-tiny== pretrained model. ```command ./darknet detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights -ext_output $test_video ``` ### Webcam * Yolo v4 ```command ./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights -c 0 ``` * Yolo v4-tiny ``` ./darknet detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights -c 0 ``` ### Dataset images * COCO @ yolo v4 ```command ./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights -thresh 0.25 ``` ### Image ```command ./darknet detector test cfg/coco.data yolov4.cfg yolov4.weights -ext_output $test_image ``` ### Save result videofile ```command darknet.exe detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights $test_video -out_filename $output_video_name.avi ``` ## Reference * [Yolo](https://github.com/AlexeyAB/darknet#how-to-use-on-the-command-line) <i class="fa fa-github" aria-hidden="true"></i> * [Tutorial File](https://github.com/DaskalakisGeorgios/Deep-Learning-Algorithms/blob/main/Yolo%20(Real%20Time%20Object%20Detection).pdf) <i class="fa fa-github" aria-hidden="true"></i>
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up