Giter Club home page Giter Club logo

image_classification_with_convolutional_autoencoder's Introduction

Image Classification with Convolutional Autoencoder

UOA

University of Athens

Department of Informatics and Telecomunications

Dionysis Taxiarchis Balaskas - 1115201700094

Andreas Giannoutsos - 1115201700021



Introduction to our project (info, goals, complexity, speed, results, simplicity, abstractiveness)

Written digits images classification with Convolutional Autoencoders in Keras

How we run the executables

To run it with google Colab:

Click here to open in Colab

How we tested that it works

We tested our (.py) scripts with every possible combination, based on the project requests. For better performance we used google colab which provides powerfull hardware with memory and GPU. Google Colab minimized the time that each experiment took. We tested many hyperparameters' combinations and found some very good models with good performance and small loss. These two were the creterions which we used to consider which experiment was the best.

Project Directories and Files organization


Main Directory: configuration/
# Directory with hyperparameters configurations, saved on JSON form.

data/
# Directory with data files.

models/
# Directory where models are saved.

autoencoder.py
# Autoencoder script.

classification.py
# Classifier script.

model.py
# Contains functions that are used for the Neural Network creation, train and test.

test.py
# Creates the configuration files.

visualization.py
# Contains functions that are used on the visualization of the Neural Network results and predictions.

experiments.ipynb
# The python notebook that we run on colab.

Experiments Details

The experiments have all been tested on the notebook as they have their relevant report and their results there with the graphs. For the experiments we have followed the following series:

First we try different models for the autoencoder 3 different architectures are tested,

Small 32, 64

Medium 32, 64, 128

Large 32, 64, 128, 256

These architectures differ in the size of the filters but also in the number of their layers.

For each architecture we try different hyperparameters to reduce overfitting and increase accuracy. Then for each architecture all the different models are printed with the different hyperparameters and the best is stored in the list of the best autoencoders. Finally, we print compared to the letters of loss for all the best models.

Then we do research for the best classifier model. The classifier consists of an encoder and a dense neural network. To search for the best classifier we use the best pretrained encoders from the previous research for autoencoders and on them we make different combinations of dense model architectures.

The models tested are:

Small encoder + Extra Small dense 16, 16

Small encoder + Small dense 64, 32

Small encoder + Large dense 512, 128

Large encoder + Small dense 64, 32

Large encoder + Medium dense 128

And in these the methodology we follow is similar to that in autoencoders.

Initially for each architecture we try different hyperparameters in order to reduce the overfitting and increase the accuracy and in the end we print comparatively all the graphs in order to choose the best model for each architecture.

Finally, for the best models, we print graphs again to compare them and for the best models, we print the classification report as well as random images and the category assigned to them by the best classifier.

Modules Details

For the models we have models.py

Here are the functions

get_Autoencoder (), get_Classifier (), train_Autoencoder (), train_Classifier ()

In the get methods we create a dictionary with the values of the hyperparameters of the format:

for autoencoder

small_model_info = {"encoder_layers": [["conv", 32, (3,3)],
                                        ["pool", (2,2)],
                                        ["conv", 64, (3,3)],
                                        ["pool", (2,2)]]
                    ,
                    "decoder_layers": [["upSample", (2,2)],
                                        ["conv", 64, (3,3)],
                                        ["upSample", (2,2)],
                                        ["conv", 32, (3,3)]]
                    ,
                    "optimizer": ["adam", 0.001]
                    ,
                    "batch_size": 32
                    ,
                    "epochs": 30
                    }

and for the classifier

small_model_classifier_info = {"dense_layers": [["dense", 64],
                                                ["dense", 32]
                                ,
                                "encoder_layers": "models / small_model.h5"
                                ,
                                "optimizer": ["adam", 0.001]
                                ,
                                "dense_only_train_epochs": 30
                                ,
                                "full_train_epochs": 10
                                ,
                                "batch_size": 32
                                }

Then this model is trained by the train methods respectively.

In the module autencoder.py classifier.py from the input of data from the user this dictionary is created.

For visualizations.py In this module we have 3 types of functions for visualization:

autoencoder_visualization() Here are the graphs for the autoencoders with the loss for each experiment but also images along with their prediction through the autoencoder.

classifier_loss_visualization() Here the loss, the accuracy, recall, precision, f1, classification_report are printed for each experiment and for each model that has been given in the list. Finally, all errors are printed comparatively

classifier_prediction_visualization() Finally, the classification report for the model we have chosen is printed here, as well as the confusion matrix, as well as images together with their provided label from the model.

image_classification_with_convolutional_autoencoder's People

Contributors

agiannoutsos avatar dbalaskas avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.