Skip to content

Panneerselvam-N/tensorflow-pp_yolo

Repository files navigation

PP_YOLO TensorFlow

Tensorflow implementation of PP-YOLOv1

Requiremets Installation

# Tensorflow CPU
conda env create -f conda-cpu.yml
conda activate yolov4-cpu

# Tensorflow GPU
conda env create -f conda-gpu.yml
conda activate yolov4-gpu

Pip

# TensorFlow CPU
pip install -r requirements.txt

# TensorFlow GPU
pip install -r requirements-gpu.txt

Custom Data Training

Step - 1 : (Setup "core/config.py file")

  • Modify path of .names file (line 14)
  • Modify number of classes (line 15)
  • Modify path of train.txt file (line 30)
  • Modify other parametrs like batch size, learning rate,etc according to your requirements (Optional)

Use following code to create train.txt file. First need to copy all annotations file and image to 'data/dataset' and then run following code.

# create train.txt file
import glob

files = glob.glob('data/dataset/*.jpg')
with open('train.txt','w') as f:
  f.write('\n'.join(files))

Step - 2 : (Model training)

Run following command for training

 python train.py

Note : If training interrupts due to any network or other issues , run following command for resuming. Use less learning rate to fix Nan error.

python train.py --const_lr True --resume 'checkpoints/pp_yolo'

Step - 3: (Model covertion)

Run following command for model convertion , basically it's take saved weights and convert it to saved model format.

python convert.py --weights './checkpoints/pp_yolo' --save './saved_model' --size 416

Step - 4: (Detection)

Run following command for images:

python detect_img.py --model ./checkpoints/saved_model --image './source/test.jpeg'

Run following command for Video :

python detect_vid.py --model ./checkpoints/saved_model --video ./source/vid.mp4 --output './output/result.avi'

Note : Outputs are stored in detection folder defaultly, use --output to change path.

To Do List :

  • Core Architecture
  • CoordConv
  • SPP(Spatial Pyramid Pooling)
  • Deformable Conv
  • Drop Block
  • Detection(Infer)
  • Model Evaluation

Note : This project is not optimized version, use official Paddle Paddle framework for better result.

References

My project is inspired by this privious YOLOv4 implemetation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages