/ Machine Learning

A pure TensorFlow implementation of CenterNet

A pure TensorFlow implementation of CenterNet

TF_CenterNet

This my implementation of CenterNet(Objects as Points) in pure TensorFlow.You can refer to the official code.Because I use light backbone without DCN, this implementation doesn't work as well as official version. The main special features of this repo inlcude:

  • tf.data pipeline
  • light backbone:resnet18, mobilenetV2
  • all codes were writen by pure TensorFlow ops (no keras or slim)
  • support training on your own dataset.

Requirements

  • python3
  • tensorflow>=1.12
  • opencv-python
  • tqdm

Train on voc dataset

1. Make dataset file

Download Pascal VOC Dataset and reorganize the directory as follows:

VOC
├── test
|    └──VOCdevkit
|        └──VOC2007
└── train
     └──VOCdevkit
         └──VOC2007
         └──VOC2012

Generate ./data/dataset/voc_train.txt and ./data/dataset/voc_test.txt, some codes of this part are from yolov3:

$ cd ./data/dataset
$ python voc_annotation.py --data_path D:/dataset/VOC

2. Download pre-train weights

You can get pre-train weights of resnet or mobilenet from my other repo. Put npy file in pretrained_weights folder.

3. Modify cfg.py and run train.py

$ python train.py

4. Inference

Update ckpt_path in inference.py,and run demo:

$ python inference.py

The result for the example images should look like:
1--1-

2--1-

3--1-

5.Visualization

$ tensorboard --logdir=./log

4--1-

Reference

[1] official code and paper
[2] YunYang1994's YOLOv3 repo

GitHub