Giter Site home page Giter Site logo

lamthanhnguyen / image-classification-using-cnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mahmudulalam/image-classification-using-cnn

0.0 1.0 0.0 12.46 MB

A convolutional neural network approach to classify image using the CIFAR-10 image classification dataset.

License: Apache License 2.0

Python 100.00%

image-classification-using-cnn's Introduction

image1

Image Classification Using CNN

Image Classification Using CNN Canadian Institute for Advanced Research (CIFAR) provides a dataset that consists of 60000 32x32x3 color images of 10 classes, known as CIFAR-10, with 6000 images per class. There are 50000 training images and 10000 test images. To classify those 10 classes of images a convolutional neural network (CNN) is used here. CNN achieved 85.0% accuracy in the test dataset. The block diagram of the CNN is shown below.

Block Diagram

block

CNN Architecture

model = Sequential()

# Block 01
model.add(Conv2D(32, (3, 3), padding='same', input_shape=(32, 32, 3)))
model.add(LeakyReLU(alpha=alpha))
model.add(Conv2D(32, (3, 3)))
model.add(LeakyReLU(alpha=alpha))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))

# Block 02
model.add(Conv2D(64, (3, 3), padding='same'))
model.add(LeakyReLU(alpha=alpha))
model.add(Conv2D(64, (3, 3)))
model.add(LeakyReLU(alpha=alpha))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))

# Block 03
model.add(Conv2D(64, (3, 3), padding='same'))
model.add(LeakyReLU(alpha=alpha))
model.add(Conv2D(64, (3, 3)))
model.add(LeakyReLU(alpha=alpha))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))

# Block 04
model.add(Flatten())
model.add(Dense(512, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(512, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(10, activation='softmax'))
return model

Batch size is chosen 256 and the network is trained for 120 epochs.

Loss curve

loss curve

Accuracy curve

acc curve

Output

This is how the outputs look like. tesla

air

Output for all the images in the 'IMAGES/' folder.

OUTPUT

Summary

  • Load the CIFAR-10 dataset.
  • Normalize training and test data.
  • Change labels from integer to categorical.
  • Build the model.
  • Compile the model.
  • Train the model.
  • Save the model.
  • Classify new test image using the trained model.

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.