Refactored implementation of CenterNet (Objects as Points - Zhou, Xingyi et. al.) shipping with PyTorch Lightning modules
My attempt at a cleaner implementation of the glorious CenterNet.
Some features of the original repository are not implemented yet but pull requests are welcome!
First, install dependencies
# Install ninja for DCNv2 JIT compilation
sudo apt-get install ninja-build
# clone CenterNet
git clone https://github.com/tteepe/CenterNet-pytorch-lightning
# install CenterNet
cd CenterNet-pytorch-lightning
pip install -e .
pip install -r requirements.txt
Next, navigate to any file and run it.
# module folder
cd CenterNet
# run module
python centernet_detection.py
python centernet_multi_pose.py
This project is setup as a package which means you can now easily import any file into any other file like so:
from pytorch_lightning import Trainer
from torchvision.datasets import CocoDetection
from CenterNet import CenterNetDetection
# model
model = CenterNetDetection("dla_34")
# data
train = CocoDetection("train2017", "instances_train2017.json")
val = CocoDetection("val2017", "instances_val2017.json")
# train
trainer = Trainer()
trainer.fit(model, train, val)
# test using the best backbone!
test = CocoDetection("test2017", "image_info_test2017.json")
trainer.test(test_dataloaders=test)
If you want to cite the implementation feel free to use this or zenodo:
@article{teepe2021centernet,
title={CenterNet PyTorch Lightning},
author={Teepe, Torben and Gilg, Johannes},
journal={GitHub. Note: https://github.com/tteepe/CenterNet-pytorch-lightning},
volume={1},
year={2021}
}