Skip to content

MuhammedBuyukkinaci/TensorFlow-Multiclass-Image-Classification-using-CNN-s

Repository files navigation

TensorFlow-Multiclass-Image-Classification-using-CNN-s

This is a multiclass image classification project using Convolutional Neural Networks and TensorFlow API (no Keras) on Python.

Read all story in Turkish.

Dependencies

pip install -r requirements.txt

or

pip3 install -r requirements.txt

Training

Training on GPU:

python3 multiclass_classification_gpu.py

Training on CPU:

python3 multiclass_classification_cpu.py

Notebook

Download .ipynb file from here and run

jupyter lab or jupyter notebook

Data

No MNIST or CIFAR-10.

This is a repository containing datasets of 5200 training images of 4 classes and 1267 testing images.No problematic image.

Just extract files from multiclass_datasets.rar.

train_data_bi.npy is containing 5200 training photos with labels.

test_data_bi.npy is containing 1267 testing photos with labels.

Classes are chair & kitchen & knife & saucepan. Classes are equal(1300 glass - 1300 kitchen - 1300 knife- 1300 saucepan) on training data.

Download pure data from here. Warning 962 MB.

CPU or GPU

I trained on GTX 1050. 1 epoch lasted 35 seconds approximately.

If you are using CPU, which I do not recommend, change the lines below:

config = tf.ConfigProto(allow_soft_placement=True) config.gpu_options.allow_growth = True config.gpu_options.allocator_type = 'BFC' with tf.Session(config=config) as sess: 

to

with tf.Session() as sess: 

Architecture

AlexNet is used as architecture. 5 convolution layers and 3 Fully Connected Layers with 0.5 Dropout Ratio. 60 million Parameters. alt text

Results

Accuracy score reached 89% on CV after 30 epochs. Test accuracy is around 88%. alt text

Predictions

Predictions for first 64 testing images are below. Titles are the predictions of our Model.

alt text