Skip to main content

No project description provided

Project description

license pypi language

tensorflow-yolov4

python3 -m pip install yolov4

YOLOv4 Implemented in Tensorflow 2.

Download yolov4.weights file: https://drive.google.com/open?id=1cewMfusmPjYWbrnuJRuKhPMwRe_b9PaT

Dependencies

python3 -m pip install -U pip setuptools wheel
python3 -m pip install numpy

Install OpenCV (cv2)

Tensorflow 2

python3 -m pip install tensorflow

TFlite

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

Objective

  • Train and predict using TensorFlow 2 only
  • Run yolov4 on Coral board(TPU).

Performance

Help

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

Inference

tensorflow

from yolov4.tf import YOLOv4

yolo = YOLOv4()

yolo.classes = "coco.names"

yolo.make_model()
yolo.load_weights("yolov4.weights", weights_type="yolo")

yolo.inference(media_path="kite.jpg")

yolo.inference(media_path="road.mp4", is_image=False)

Object detection test jupyter notebook

tensorflow lite

tf.keras.layers.UpSampling2D() seems to be in TensorFlow >= 2.3.0

Training

import tensorflow.keras import optimizers
from yolov4.tf import YOLOv4

yolo = YOLOv4()

yolo.classes = "coco.names"
yolo.input_size = 608
yolo.batch_size = 32
yolo.subdivision = 16

yolo.make_model()
yolo.load_weights("yolov4.conv.137", weights_type="yolo")

data_set = yolo.load_dataset("val2017.txt")
# data_set = yolo.load_dataset(
#     "/home/hhk7734/darknet/data/train.txt",
#     dataset_type="yolo",
# )

optimizer = optimizers.Adam(learning_rate=1e-4)
yolo.compile(optimizer=optimizer, loss_iou_type="ciou")

yolo.fit(data_set, epochs=1500)
yolo.model.save_weights("checkpoints")

tensorflow-yolov4 (0.13.0) unstable; urgency=medium

  • tf: remove tensorboard callback
  • tf: modify compile() and fit() to be similar to model
  • yolov4: rename 'data' to 'test'
  • utility: media: update docs and variable name
  • utility: predict: remove batch_size
  • utility: media: rename funcs
  • tf: add utility funcs to YOLOv4 member funcs
  • test: add test script

-- Hyeonki Hong hhk7734@gmail.com Mon, 13 Jul 2020 13:36:32 +0900

tensorflow-yolov4 (0.12.0) unstable; urgency=medium

  • utility: train: refactor bbox_*iou and remove duplicate funcs
  • yolov4: rename parameters
  • yolov4: remove utils
  • tf: add FileNotFoundError in YOLOv4.inference()
  • utility: predict: add dimension for batch size
  • pylint: update .pylintrc
  • tf: add YOLOv4.save_as_tflite()
  • model: clean up
  • utility: weights: move to tf.weights
  • utility: train: move to tf.train
  • model: neck: implement PANet
  • mdel: head: implement YOLOv3Head
  • model: yolov4: Apply neck and head class
  • yolov4: reflect model changes
  • tf: dataset: add batch_size
  • tf: train: implement YOLOv4Loss
  • utility: media: modify rectangle thickness
  • model: common: use softplus instead of ln(1+exp(x))
  • tf: train: use epsilon instead of tf.math.divide_no_nan
  • tf: refactor YOLOv4.fit() and .compile()

-- Hyeonki Hong hhk7734@gmail.com Sun, 12 Jul 2020 03:50:50 +0900

tensorflow-yolov4 (0.11.0) unstable; urgency=medium

  • tf: remove utils.draw_bbox in predict()
  • yolov4: rename files and functions and change order
  • utility: utils: remove get_anchors()
  • utility: media: impelment resize(), draw_bbox()
  • utility: utils: implement DIoU_NMS
  • utility: utils: fix dimensional calculation problems
  • utility: refactor dataset
  • tf: remove train
  • utility: train: implement make_compiled_loss()
  • utility: media: fix bug that could not resize some images
  • utility: train: remove problem of division by zero

-- Hyeonki Hong hhk7734@gmail.com Mon, 29 Jun 2020 21:05:39 +0900

tensorflow-yolov4 (0.10.0) unstable; urgency=medium

  • core: yolov4: refactor decode()
  • core: utils: remove sigmoid in postprocess_bbboxe()
  • tf: apply YOLOv4 changes to make_model()
  • core: yolov4: move decode_train() to tf.YOLOv4.train()

-- Hyeonki Hong hhk7734@gmail.com Thu, 25 Jun 2020 00:48:44 +0900

tensorflow-yolov4 (0.9.0) unstable; urgency=medium

  • tf: modify hyperparameters as properties
  • tf: add weights_type argument to load_weights()
  • core: utils: implement _np_fromfile()
  • core: utils: implement a way to partially load weights
  • tf: train: move learning_rate_* to argument
  • core: move YOLOConv2D to common
  • core: common: remove bn argument of YOLOConv2D
  • core: utils: refactor yolo_conv2d_set_weights
  • core: yolov4: refactor YOLOv4
  • core: utils: refactor load_weights
  • tf: refactor make_model
  • yolov4: change YoloV4 to YOLOv4

-- Hyeonki Hong hhk7734@gmail.com Wed, 24 Jun 2020 02:58:27 +0900

tensorflow-yolov4 (0.8.0) unstable; urgency=medium

  • core: use tf.keras.layers.UpSampling2D
  • core: refactor Mish
  • core: common: remove residual_block
  • core: remove sequential in _ResBlock
  • core: backbone: Set LeakyReLU's alpha to 0.1

-- Hyeonki Hong hhk7734@gmail.com Tue, 23 Jun 2020 02:21:01 +0900

tensorflow-yolov4 (0.7.0) unstable; urgency=medium

  • tf: fix to proceed to the next step even if an error occurs
  • tf: modify video_interval_ms to cv_waitKey_delay
  • core: backbone: refactor CSPDarknet53
  • core: utils: implement csp_darknet53_set_weights()

-- Hyeonki Hong hhk7734@gmail.com Mon, 22 Jun 2020 23:01:32 +0900

tensorflow-yolov4 (0.6.0) unstable; urgency=medium

  • tf: set first_step_epochs according to the weight usage
  • tf: fix syntax error

-- Hyeonki Hong hhk7734@gmail.com Fri, 19 Jun 2020 17:09:57 +0900

tensorflow-yolov4 (0.5.0) unstable; urgency=medium

  • core: dataset: add yolo type
  • tf: add dataset_type parameter to YoloV4.train
  • tf: add epochs parameter to train
  • tf: add save_interval parameter to train

-- Hyeonki Hong hhk7734@gmail.com Fri, 19 Jun 2020 14:30:50 +0900

tensorflow-yolov4 (0.4.0) unstable; urgency=medium

  • core: dataset: remove cfg module
  • tf: implement YoloV4.train

-- Hyeonki Hong hhk7734@gmail.com Thu, 11 Jun 2020 17:45:44 +0900

tensorflow-yolov4 (0.3.0) unstable; urgency=medium

  • core: utils: use numpy instead of tensorflow
  • pypi: remove install_requires and change to manual installation
  • yolov4: add video_interval_ms

-- Hyeonki Hong hhk7734@gmail.com Mon, 08 Jun 2020 23:59:41 +0900

tensorflow-yolov4 (0.2.0) unstable; urgency=medium

  • pylint: create .pylintrc and run black
  • core: remove config.py
  • yolov4: change tfyolov4 to yolov4
  • yolov4: remove detect**.py and implement YoloV4.inference

-- Hyeonki Hong hhk7734@gmail.com Mon, 08 Jun 2020 02:20:49 +0900

tensorflow-yolov4 (0.1.0) unstable; urgency=medium

  • yolov4: fork from 'hunglc007/tensorflow-yolov4-tflite'

-- Hyeonki Hong hhk7734@gmail.com Fri, 05 Jun 2020 20:17:45 +0900

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yolov4-0.13.0.tar.gz (19.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page