A TensorFlow 2.0 implementation of YOLOv4: Optimal Speed and Accuracy of Object Detection
This implementation runs (for now) inference with the original Darknet weights from AlexeyAB. See the roadmap section to see what's next.
To install this package, you can run:
pip install https://github.com/sicara/tf2-yolov4/archive/master.zip
pip install tensorflow
# Check that tf2_yolov4 is installed properly
python -c "from tf2_yolov4.model import YOLOv4; print(YOLOv4)"
Check the detect script to run a prediction.
Requirements:
- MacOs >= 10.15 since tensorflow-addons is not available for older release of MacOs
- Python >= 3.6
- Compatible versions between TensorFlow and TensorFlow Addons: check the compatibility matrix
To load the Darknet weights trained on COCO, you have to:
- get the weights (yolov4.weights) from AlexeyAB/darknet
- run
python tools/weights_convert.py
TF weights should be saved as yolov4.h5
.
- Inference
- CSPDarknet53 backbone with Mish activations
- SPP Neck
- YOLOv3 Head
- Load Darknet Weights
- Image loading and preprocessing
- YOLOv3 box postprocessing
- Handling non-square images
- Training
- Training loop with YOLOv3 loss
- CIoU loss
- Cross mini-Batch Normalization
- Self-adversarial Training
- Mosaic Data Augmentation
- DropBlock
- Enhancements
- Automatic download of pretrained weights (like Keras applications)