Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Getting started with OpenCentroidNet

CentroidNet is a hybrid convolutional neural network

  1. run to generate a synthetic dataset of your liking.
  2. run to train ad model using this generated dataset.
  3. run to predict a single image in production.
  4. adjust to change hyper parameters.

Generated data files and folders

The input images and annotation data

./data/dataset/ contains the image generated by 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:

  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},

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


For a numpy viewer go to:


No releases published


No packages published