You only look once (YOLO) is a state-of-the-art, real-time object detection system. It is implemented based on the Darknet, an Open Source Neural Networks in C. In this project, I improved the YOLO by adding several convenient functions for detecting objects for research and the development community.
Figure 1. Example of Object Detection using Yolo based on the Darknet.
The added functions are implemented based on AlexeyAB version of Darknet. As it is updated frequently, hereby I publish a stable version of AlexeyAB Darknet Yolo with those convenient functions. This repo will also be updated regularly.
Figure. The process of batch detecting images in a folder using Yolo based on the Darknet.
The detector function in AlexeyAB Darknet only supports a single image at a time. Therefore I added the batch function into this forked repo, which supports detecting images in a folder in one time. In the meantime, it exports information including the name of the image, the detected classes, the confidence and the bounding box coordinates in JSON and TXT files.
Hope you like it.
https://bit.ly/vg_yolo_v4_colab
Please also refer to the post for more information:
https://github.com/pjreddie/darknet/issues/723
The new version based on AlexeyAB Yolo v4.
Compile without change anything on Linux and Windows. Both are tested.
Export the bounding box of detected objects in images to JSON.
Export the bounding box of detected objects in images to TXT.
Added the Google Colab Demo.
./darknet detector batch cfg/coco.data cfg/yolov4.cfg weights/yolov4.weights io_folder sample_imgs/ output/ -out output/result.json -ext_output > output/result.txt
Parameter explain:
The input images are: sample_imgs/
The output images are: output/
The image name, detected classes, the confidence and the bounding box coordinates is saved in: output/result.txt and in output/result.json
Clone this project, or download this project.
Decompress the weight file.
cd ./weights/
7z x yolov4.weights.7z.001
It requires the tool of 7z. You may need to install it if you do not have it.
Build the project.
First of all, go back to the root folder of the project.
cd ..
Now you should be in the project root folder of the project, such as: VG_AlexeyAB_darknet
For linux (e.g. Ubuntu): Make the project with command in the project root folder:
make
For windows. It can be successfully built on Visual Studio using project file in the folder of:
/build/darknet/
Use the commandf to batch process images.
./darknet detector batch cfg/coco.data cfg/yolov4.cfg weights/yolov4.weights io_folder sample_imgs/ output/ -out output/result.json -ext_output > output/result.txt
Any questions please let me know.
If you like it, please also let me know.
vincent.gong7[at]gmail.com