# Count number of objects in image using CNN

I'm looking for neural network architecture that excel in counting objects. For example, CNN that can output the number of balls (or any other object) in a given image. I already found articles about crowd counting, I'm looking for articles about different types of objects.

Thank

If you want to count the number of objects using a neural network, you can use pretrained YOLO with the bottom prediction layer removed, and feed the features to a classification feed forward layer of let's say 1000 class representing 0-999 objects in the image. You can then train it and propagate the gradients through it. For example, in the pytorch code for YOLO,(source:https://github.com/eriklindernoren/PyTorch-YOLOv3) You can add a nn.Linear and use cross entropy loss to classify the number of images. You can also change the architecture completely. Maybe you can try adding layers to reset or other classifying network to count the number of objects. Hope this can help you and have a nice day!