GithubHelp home page GithubHelp logo

witaek / yolov4-tiny-tflite-for-person-detection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doranlyong/yolov4-tiny-tflite-for-person-detection

1.0 0.0 0.0 164.9 MB

Person Detection using Yolov4-tiny-tflite

Python 100.00%

yolov4-tiny-tflite-for-person-detection's Introduction

Yolov4-tiny-tflite for Person Detection

This repository is about a person detection using yolov4-tiny-tflite.
It doesn't include how to train your custom dataset, but only the pretrained weights for detecting person class only.


Requirements

Check the requirements.txt to install requested packages, or run like below:

~$ pip install -r requirements.txt

Inference with a image

  • run the code like below
  • the input arguments can be changed by yourself
~$ python run_person_detector.py --image ./data/persons.jpg --score 0.75

Inference with your webcam device

  • run the code like below
  • the input arguments can be changed by yourself
~$ python run_webcam_person_detector.py --score 0.75
  • with DeepSORT tracker
~$ python run_webcam_yolov4_DeepSORT.py --score 0.75

How did I do?

Even though there is not a code to train yolov4-tiny, let me describe how I got the trained weights with my custom dataset:

  1. Achieve custom dataset from YouTube videos (using AVA dataset)
  2. Train yolov4-tiny to detect only person class using the Darknet with the custom dataset
  3. Convert the trained Darknet model to tensorflow lite model
  4. Make the inference codes like this repository for my own application

1. Achieve custom dataset from YouTube videos (using AVA dataset)

Go to [ref5], then you can get to know how to prepare a custom dataset, which consists of only persons. AVA dataset has been used for multiple application tasks, but I only used this for getting person images with bounding box labels.

2. Train yolov4-tiny to detect only person class using the Darknet with the custom dataset

I got the idea that training person detector and uploading on my edge device from roboflow blog, here. They supply various and useful tools for data preprocessing, however, it's not free for massive datasets. Furthermore, I couldn't know how to set up my dataset for training yolov4-tiny just reading the blog.

So, I found out another awesome post in medium (hear). I followed the whole instruction of the post in order to train my model. Consequently, I trained my model using google colab.

3. Convert the trained Darknet model to tensorflow lite model

After training own darknet yolov4-tiny model, we finally need to convert the darknet model to Tensorflow one. This is pretty much easy if you following this github well.

  • [Darknet.weights] → [.tflite]

If you succeed to take the weight file in .tflite format, we're ready to build an inference code for person detection using Tensorflow lite.

4. Make the inference codes like this repository for my own application

I built two inference codes; one for image input and another for webcam video input. These codes are referred to the original inference codes here; detect.py and detectvideo.py.

(New)The above training processes is uploaded in this repository


Reference

[1] TRAIN A CUSTOM YOLOv4-tiny OBJECT DETECTOR USING GOOGLE COLAB / yolov4-tiny 학습 방법은 여기를 참고.
[2] How to Train a Custom Mobile Object Detection Model (with YOLOv4 Tiny and TensorFlow Lite) / YOLOv4-Tiny 로 학습한 모델을 TensorFlow Lite 로 바꿔보기 (블로그).
[3] tensorflow-yolov4-tflite, github / 이걸 참고해서 Darknet 모델을 tensorflow lite 모델로 바꿈.
[4] Yolo v4, v3 and v2 for Windows and Linux, github / yolov4-tiny 학습 코드는 여기걸 참고
[5] AVA Dataset Processing for Person Detection, github / Person detection용 학습데이터 얻는 방법 (이걸로 DB를 구축함).

Further helpable readings

[a] theAIGuysCode, tensorflow-yolov4-tflite, github / (ref3)을 참고한 레포지토리
[b] Object Detection and Tracking in 2020, netcetera blog / Detection 모듈과 Tracking 모듈을 조합할 때 참고하자
[c] Real-time Human Detection in Computer Vision - Part2, medium / 사람 감지 모듈을 만들 때 생각해볼 수 있는 파이프라인 소개
[d] Object detection and tracking in PyTorch, towarddatascience / 심플한 튜토리얼 코드 제공
[e] Object Detection and Tracking, MediaPipe / Google MediaPipe의 경우에도 Object detection을 위한 ML inference 모듈과 Box Tracking 모듈을 조합해서 프로세싱에 효율성을 더함. 이렇게 구성하면 매 프레임마다 detection inference를 할 필요가 없어진다.
[f] Object-Detection-and-Tracking, github / YOLOv4 + Deep_SORT 의 조합 예시코드 참고 (강력 추천)

yolov4-tiny-tflite-for-person-detection's People

Contributors

doranlyong avatar witaek avatar zamanmub avatar

Stargazers

 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.