Getting started with OpenCentroidNet
CentroidNet is a hybrid convolutional neural network
- run create_dataset.py to generate a synthetic dataset of your liking.
- run train.py to train ad model using this generated dataset.
- run predict.py to predict a single image in production.
- adjust config.py to change hyper parameters.
Generated data files and folders
The input images and annotation data
./data/dataset/ contains the image generated by create_dataset.py and the annotations in train.csv and validation.csv.
Replace this data with your own set.
The model
The weights of the CentroidNet model are stored in ./data/CentroidNet.pth
The input tensors to the model
./data/validation_result/_inputs.npy contains the normalized input tensor.
./data/validation_result/_targets.npy contains the normalized target tensor.
The output tensors of the model
./data/validation_result/_vectors.npy contains the normalized 2-d voting vectors (use this to see the quality of the training).
./data/validation_result/_votes.npy contains the voting space (use this to tune Config.centroid_threshold and Config.nm-size).
./data/validation_result/_centroids.npy contains a value of one for each centroid (final result).
./data/validation_result/_class_ids.npy contains the class ids for every pixel.
./data/validation_result/_class_probs.npy contains the class probability for every pixel.
./data/valitation_result/validation.txt contains the final centroid coordinates and class info.
Citing OpenCentroidNet
If this code benefits your research please cite:
@inproceedings{dijkstra2018centroidnet,
title={CentroidNet: A deep neural network for joint object localization and counting},
author={Dijkstra, Klaas and van de Loosdrecht, Jaap and Schomaker, L.R.B. and Wiering, Marco A.},
booktitle={Joint European Conference on Machine Learning and Knowledge Discovery in Databases},
pages={585--601},
year={2018},
organization={Springer}
}
Copyright notice
Copyright (C) 2019 Klaas Dijkstra
OpenCentroidNet is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
p.s.
For a numpy viewer go to: https://github.com/ArendJanKramer/Numpyviewer.