Coder Social home page Coder Social logo

guoqiang0148666 / tensorflow-yolov4-tflite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hunglc007/tensorflow-yolov4-tflite

0.0 0.0 0.0 47.8 MB

YoloV4 Implemented in Tensorflow 2.0. Convert .weights to .pb and .tflite format for tensorflow and tensorflow lite.

Home Page: https://github.com/hunglc007/tensorflow-yolov4-tflite

License: MIT License

Python 100.00%

tensorflow-yolov4-tflite's Introduction

tensorflow-yolov4-tflite

license

Yolo V4 Implemented in Tensorflow 2.0. Convert .weights to .tflite format for tensorflow lite.

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

Prerequisites

  • Tensorflow 2.1.0
  • tensorflow_addons 0.9.1 (required for mish activation)

Performance

Demo

# yolov4
python detect.py --weights ./data/yolov4.weights --framework tf --size 608 --image ./data/kite.jpg

# yolov4 tflite
python detect.py --weights ./data/yolov4-int8.tflite --framework tflite --size 416 --image ./data/kite.jpg

Output

Yolov4 original weight

Yolov4 tflite int8

Convert to tflite

# yolov4
python convert_tflite.py --weights ./data/yolov4.weights --output ./data/yolov4.tflite

# yolov4 quantize int8
python convert_tflite.py --weights ./data/yolov4.tf --output ./data/yolov4-int8.tflite --quantize_mode int8

# yolov4 quantize float16
python convert_tflite.py --weights ./data/yolov4.tf --output ./data/yolov4-fp16.tflite --quantize_mode float16

Evaluate on COCO 2017 Dataset

# preprocess coco dataset
cd data
mkdir dataset
cd ..
cd scripts
python coco_convert.py --input COCO_ANOTATION_DATA_PATH --output val2017.pkl
python coco_annotation.py --coco_path COCO_DATA_PATH 
cd ..

# evaluate yolov4 model
python evaluate.py --weights ./data/yolov4.weights
cd mAP/extra
python remove_space.py
cd ..
python main.py --output results_yolov4_tf

Traning your own model

# Prepare your dataset
# If you want to train from scratch:
In config.py set FISRT_STAGE_EPOCHS=0 
# Run script:
python train.py

# Transfer learning: 
python train.py --weights ./data/yolov4.weights

TODO

  • Training code
  • Update scale xy
  • ciou
  • Mosaic data augmentation
  • Mish activation
  • yolov4 tflite version
  • yolov4 in8 tflite version for mobile

References

  • YOLOv4: Optimal Speed and Accuracy of Object Detection YOLOv4.
  • darknet

My project is inspired by these previous fantastic YOLOv3 implementations:

tensorflow-yolov4-tflite's People

Contributors

hunglc007 avatar jzoker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.