# Python Network for Simple Image Classification

I'm wondering if there exists a network for simple image classification. What I mean by this is if I have two image datasets, one of horses and one of zebras, I want to train off the horses and classify an image as either a horse or not a horse, so if I test it on an image of a horse, it says it is a horse, but if I use a zebra, it says it is not a horse. Does any library/project for this exist?

Using neural networks

If it is as simple as that, probably a neural network consisting of just a simple convolutional network with a few filters, a fully connected layer with 2 neurons, and a softmax layer, might do it.

To develop that, you can use Keras wrapper over tensorflow or theano, but I think scikit-learn also provides some basic neural network functionalities.

Depending on the simplicity of the images on your dataset, you might do it even with no convolutional layer if there are not many non-linearities, or you might need more complexity (eg. adding convolutional and max pooling layers).

I made personally for teaching a workshop a very simple example of image classification, with 3 groups (trees, people, vehicles), after building a dataset collecting and selectioning images from the CIFAR-100 dataset. You can see this ultra simple example here. However, it is in spanish. Let me translate the most important piece of code from it:

model = Sequential()

# CONVOLUTION. Final size: 29x29x32
(4, 4),
input_shape=data_x_train.shape[1:]
))

# CONVOLUTION. Final size: 26x26x32
(4, 4),
input_shape=data_x_train.shape[1:]
))

# MAX POOLING. Final size: 13x13x32

# Dropout to prevent overfitting

# CONVOLUTION. Final size: 10x10x64
(4, 4),
input_shape=data_x_train.shape[1:]
))

# MAX POOLING. Final size: 5x5x64

# Dropout to prevent overfitting

# Fully connected layer. Neuron number: 1600