Implementatoin of object detection using Tensorflow 2.1.0 | this can be use in a car for object detection
APACHE-2.0 License
See on YouTube: 4K YoloV3 Object detection using Tensorflow 2.1
This repo provide a clean implementation of YoloV3 in Tensorflow 2.x using all the best practices.
yolov3
with pre-trained Weightsyolov3-tiny
with pre-trained Weightstf.GradientTape
model.fit
tf.keras.layers
tf.data
absl-py
from abseil.io
# without GPU
pip install -r requirements.txt
#with GPU
pip install -r requirements-gpu.txt
# Ubuntu 18.04
sudo apt-add-repository -r ppa:graphics-drivers/ppa
sudo apt install nvidia-driver-440
# Windows/Other
https://www.nvidia.com/Download/index.aspx
# yolov3
wget https://pjreddie.com/media/files/yolov3.weights -O data/yolov3.weights
python convert.py --weights ./data/yolov3.weights --output ./checkpoints/yolov3.tf
# WebCam
python object_detected.py --video 0
# Video file
python object_detected.py --video path_to_file.mp4
# Vidoe file with output
python object_detected.py --video path_to_file.mp4 --output ./output.avi
soon
very hard with pure functional API because the layer ordering is different in tf.keras and darknet. The clean solution here is creating sub-models in keras. Keras is not able to save nested model in h5 format properly, TF Checkpoint is recommended since its offically supported by TensorFlow.
convert.py:
--output: path to output
(default: './checkpoints/yolov3.tf')
--weights: path to weights file
(default: './data/yolov3.weights')
--num_classes: number of classes in the model
(default: '80')
(an integer)
detect_video.py:
--classes: path to classes file
(default: './data/coco.names')
--video: path to input video (use 0 for cam)
(default: './data/video.mp4')
--output: path to output video (remember to set right codec for given format. e.g. XVID for .avi)
(default: None)
--output_format: codec used in VideoWriter when saving video to file
(default: 'XVID')
--weights: path to weights file
(default: './checkpoints/yolov3.tf')
--num_classes: number of classes in the model
(default: '80')
(an integer)
It is pretty much impossible to implement this from the yolov3 paper alone.