https://github.com/mingtaoguo/retinanet_tensorflow
Implementation of RetinaNet (focal loss) by TensorFlow (object detection)
https://github.com/mingtaoguo/retinanet_tensorflow
focal-loss object-detection retinanet tensorflow
Last synced: 12 months ago
JSON representation
Implementation of RetinaNet (focal loss) by TensorFlow (object detection)
- Host: GitHub
- URL: https://github.com/mingtaoguo/retinanet_tensorflow
- Owner: MingtaoGuo
- License: mit
- Created: 2019-11-29T02:08:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-29T03:22:24.000Z (over 6 years ago)
- Last Synced: 2025-04-05T13:11:21.118Z (about 1 year ago)
- Topics: focal-loss, object-detection, retinanet, tensorflow
- Language: Python
- Homepage:
- Size: 664 KB
- Stars: 16
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RetinaNet_TensorFlow
Implementation of RetinaNet by TensorFlow (object detection)
# Introduction

### Focal Loss

``` python
def focal_loss(logits, labels, alpha=0.25, gamma=2):
pos_pt = tf.clip_by_value(tf.nn.sigmoid(logits), 1e-10, 0.999)
fl = labels * tf.log(pos_pt) * tf.pow(1 - pos_pt, gamma) * alpha + (1 - labels) * tf.log(1 - pos_pt) * tf.pow(pos_pt, gamma) * (1 - alpha)
fl = -tf.reduce_sum(fl, axis=2)
return fl
```
# How to use
### Dataset
Pascal Voc: http://pjreddie.com/media/files/VOCtrainval_06-Nov-2007.tar
### Training phase
1. Downloading the pre-trained model of ResNet50, and put it into the folder **resnet_ckpt**
Address: http://download.tensorflow.org/models/resnet_v2_50_2017_04_14.tar.gz
2. According to your own dataset, modify the **config.py** by yourself
3. Executing **train.py**
### Testing phase
1. Changing the IMG_PATH or VIDEO_PATH in **test.py** for testing
2. Executing **test.py**
Model we trained: https://drive.google.com/open?id=1_j-bjQ_SWT3txqCabM8_Ny0IMUqTb8Lk
# Requirement
1. python
2. tensorflow
3. pillow
4. numpy
5. cv2
# Results
|Total Loss|Class Loss|Box Loss|
|-|-|-|
||||
||||
|-|-|-|
||||
||||
||||
||||
# Reference
[1] Lin, Tsung-Yi, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017.
# Author
Mingtao Guo