Steps to use Yolo with Darknet Framework¶
Environment Setup Requirements :¶
Host operating system : Linux, macOS, Windows
Os in virtual machine : Ubuntu 18.04 (64-bit)
CMake >= 3.18
CUDA >= 10.2
OpenCV >= 2.4
cuDNN >= 8.0.2
Installation:¶
Update with the command as sudo apt-get update
Export CUDA Path using following command as: export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Download the darknet from GitHub git clone https://github.com/AlexeyAB/darknet
Go to the darknet folder through terminal using command as: cd darknet
Download Yolo weight files and place it inside darknet folder. Weights corresponsing to Yolo models can be downloded from the available websites using wget commands as:
wget https://github.com/AlexeyAB/darknet/releases/download/darknet _yolo_v4_pre/yolov4-csp.weights
Download Yolo configuration file corresponding to yolo model using same command and place it inside cfg folder of darknet folder
Edit Makefile enabling GPU, CUDNN, OpenCV,ZED_CAMERA and the ARCH field of makefile based on the GPU Architecture. For Agx Xavier it is arch_72
Build:¶
Build can be done in two ways:
Using cmake
1cd darknet
2mkdir build_release && cd build_release
3cmake ..
After this we should be able to see the selected GPU architecture. then use cmake –build . –target install –parallel 8.
- Using Make
Just use command make in the darkent folder as :
1 make
Run the Yolo model¶
1. To test the model on the downloded video. Download the video and put it in the darknet folder and then using the command as : ./darknet detector deom cfg/coco.data cfg/yolov4-csp.cfg yolov4-csp.weights -ext_output downloadedvideo.mp4.
2. To run the model on th webcam use the command as : ./darknet detector deom cfg/coco.data cfg/yolov4-csp.cfg yolov4-csp.weights -c 0
3. To run the model through zedcamera use the command as : ./uselib cfg/coco.data cfg/yolov4-csp.cfg yolov4-csp.weights zed_camera