YOLO, for "You Only Look Once", is an object detection system in real-time, introduced in
this paper, that recognizes various objects in a single enclosure. It identifies objects more rapidly and more precisely than other recognition systems. Three authors Alexey Bochkovskiy, the Russian developer who built the YOLO Windows version, Chien-Yao Wang, and Hong-Yuan Mark Liao, are accounted for in this work and the entire code is available on
Github.
Object-recognition technology has improved drastically in the past few years across the industry, and it is now part of a huge variety of products and services that millions of people worldwide use. However, errors in object-recognition algorithms can stem from the training data used to create the system is geographically constrained and/or that it fails to recognize cultural differences.
The COCO dataset used to train yolov4-tflite has been found to have annotation errors on more than 20% of images. Such errors include captions describing people differently based on skin tone and gender expression. This serves as a reminder to be cognizant that these biases already exist and a warning to be careful about the increasing bias that is likely to come with advancements in image captioning technology.
You can use this model to detect objects in an image of choice. Follow the following scripts to implement on your own!
1# install git lfs
2git lfs install
3
4# if presented with the error "git: 'lfs' is not a git command. See 'git --help'", try running these linux commands:
5curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
6
7# change directory to base
8cd ..
9
10# install git-lfs
11sudo apt-get install git-lfs
12
13# for message "Git LFS initialized"
14git lfs install
15
16# change directory to yolo_v4_tflite
17cd ./yolo_v4_tflite
18
19# clone this repo into your notebook
20git clone https://huggingface.co/SamMorgan/yolo_v4_tflite
21
22# Run demo tensor flow for an example of how this model works
23python detect.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --image ./data/kite.jpg --output ./test.jpg
24
25# Try with your own image
26python detect.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --image <insert path to image of choice> --output <insert path to output location of choice>
27
28
1# run script in /script/get_coco_dataset_2017.sh to download COCO 2017 Dataset
2# preprocess coco dataset
3cd data
4mkdir dataset
5cd ..
6cd scripts
7python coco_convert.py --input ./coco/annotations/instances_val2017.json --output val2017.pkl
8python coco_annotation.py --coco_path ./coco
9cd ..
10
11# evaluate yolov4 model
12python evaluate.py --weights ./data/yolov4.weights
13cd mAP/extra
14python remove_space.py
15cd ..
16python main.py --output results_yolov4_tf
1# Prepare your dataset
2# If you want to train from scratch:
3In config.py set FISRT_STAGE_EPOCHS=0
4# Run script:
5python train.py
6# Transfer learning:
7python train.py --weights ./data/yolov4.weights
The training performance is not fully reproduced yet, so I recommended to use Alex's
Darknet to train your own data, then convert the .weights to tensorflow or tflite.