TensorFlow 2 YOLOv4

license pypi language

tensorflow-yolov4

python3 -m pip install yolov4

YOLOv4 Implemented in Tensorflow 2.

Download Weights

Dependencies

python3 -m pip install -U pip setuptools wheel
python3 -m pip install numpy
python3 -m pip install opencv-python
python3 -m pip install tensorflow

TFlite

Ref: https://www.tensorflow.org/lite/guide/python

Objective

  • Train and predict using TensorFlow 2 only
  • Run yolov4-tiny-relu on Coral board(TPU).
  • Train tiny-relu with coco 2017 dataset
  • Update Docs
  • Optimize model and operations

Performance

Help

>>> from yolov4.tf import YOLOv4
>>> help(YOLOv4)

Inference

tensorflow

from yolov4.tf import YOLOv4
yolo = YOLOv4()
# yolo = YOLOv4(tiny=True)
yolo.classes = "coco.names"
yolo.input_size = (640, 480)
yolo.make_model()
yolo.load_weights("yolov4.weights", weights_type="yolo")
# yolo.load_weights("yolov4-tiny.weights", weights_type="yolo")
yolo.inference(media_path="kite.jpg")
yolo.inference(media_path="road.mp4", is_image=False)

tensorflow lite

from yolov4.tf import YOLOv4
yolo = YOLOv4()
yolo.classes = "coco.names"
yolo.input_size = (640, 480)
yolo.make_model()
yolo.load_weights("yolov4.weights", weights_type="yolo")
yolo.save_as_tflite("yolov4_640x480.tflite")
from yolov4.tflite import YOLOv4
yolo = YOLOv4()
yolo.classes = "coco.names"
yolo.load_tflite("yolov4_640x480.tflite")
yolo.inference("kite.jpg")
Last updated on