# yolo-v3
**Repository Path**: chenfang007/yolo-v3
## Basic Information
- **Project Name**: yolo-v3
- **Description**: Yolo v3 object detection implemented with Tensorflow 2.0.
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-11-19
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Yolo v3 Object Detection with Tensorflow 2.0
Yolo v3 is an algorithm that uses deep convolutional neural networks to detect objects.
## Getting started
### Prerequisites
This project is written in Python 3.7 using Tensorflow 2.0 (deep learning), NumPy (numerical computing), Pillow (image processing), OpenCV (computer vision) and seaborn (visualization) packages.
```
pip install -r requirements.txt
```
### Downloading official pretrained weights
For Linux: Let's download official weights pretrained on COCO dataset.
```
wget -P weights https://pjreddie.com/media/files/yolov3.weights
```
For Windows:
You can download the yolov3 weights by clicking [here](https://pjreddie.com/media/files/yolov3.weights) and adding them to the weights folder.
### Using Custom trained weights
Learn How To Train Custom YOLOV3 Weights Here: https://www.youtube.com/watch?v=zJDUhGL26iU
Add your custom weights file to weights folder and your custom .names file into data/labels folder.
Change 'n_classes=80' on line 97 of load_weights.py to 'n_classes='.
Change './weights/yolov3.weights' on line 107 of load_weights.py to './weights/'.
Change './data/labels/coco.names' on line 25 of detection.py to './data/labels/'.
### Save the weights in Tensorflow format
Load the weights using `load_weights.py` script. This will convert the yolov3 weights into TensorFlow .ckpt model files!
```
python load_weights.py
```
## Running the model
You can run the model using `detect.py` script. The script works on images, video or your webcam. Don't forget to set the IoU (Intersection over Union) and confidence thresholds.
### Usage
```
python detect.py
```
### Images example
Let's run an example using sample images.
```
python detect.py images 0.5 0.5 data/images/dog.jpg data/images/office.jpg
```
Then you can find the detections in the `detections` folder.
You should see something like this.
```
detection_1.jpg
```

```
detection_2.jpg
```

### Video example
You can also run the script with video files.
```
python detect.py video 0.5 0.5 data/video/shinjuku.mp4
```
The detections will be saved as `detections.mp4` file.

### Webcam example
The script can also be ran using your laptops webcam as the input. Example command shown below.
```
python detect.py webcam 0.5 0.5
```
The detections will be saved as 'detections.mp4' in the data/detections folder.
## To-Do List
* Finish migration to full TF 2.0 (remove tf.compat.v1)
* Model training
* Tiny Yolo Configuration
## Acknowledgments
* [Yolo v3 official paper](https://arxiv.org/abs/1804.02767)
* [A Tensorflow Slim implementation](https://github.com/mystic123/tensorflow-yolo-v3)
* [ResNet official implementation](https://github.com/tensorflow/models/tree/master/official/resnet)
* [DeviceHive video analysis repo](https://github.com/devicehive/devicehive-video-analysis)
* [A Street Walk in Shinjuku, Tokyo, Japan](https://www.youtube.com/watch?v=kZ7caIK4RXI)