BELAJAR ANALISIS DAN BAHASA PEMROGRAMAN

Image Classification using Keras and CNN

In this model we use smallervggnet model and 3 category from images. The Images are Ballpoint, Eraser, and Ruler images. We get the data using crawling image in google image search using python, you can see in my blog how to crawling image. After we have the data, we cleaning the data and choosing image with just object in image.
we have 179 ballpoint images, 132 ruler images, and 142 eraser images with resolution 100x100.

Structure From Folder
So you can set folder like structure in below
o o Clasify images
      o classify.py
      o train.py
      o alattulis3.model
      o lb3.pickle
      o Model
     o smallervggnet.py
      o examples
     images for testing
      o dataset
        ballpoint
     eraser
     ruler

There are 3 directories:
  • dataset : Subdirectory to make parsing class labels easy. So in this directory you can input your class/images and your create folder for class or images. 
  • examples :  Directory for Images we’ll be using to test our CNN.
  • The model module: Contains our SmallerVGGNet model class.
And 5 files in the root:
  • plot.png : Our training/testing accuracy and loss plot which is generated after the training script is ran.
  • lb3.pickle : Our LabelBinarizer serialized object file — this contains a class index to class name lookup mechamisn.
  • alattulis3.model : This is our serialized Keras Convolutional Neural Network model file (i.e., the “weights file”).
  • train.py : We will use this script to train our Keras CNN, plot the accuracy/loss, and then serialize the CNN and label binarizer to disk.
  • classify.py : Our testing script.
Dependencies

You can install this module using pip
• Keras (pip install keras)
• Imutils (pip install imutils)
• cv2 (pip install opencv-python)
• Numpy (pip install numpy)

How to Run

If you want to just classify image you can using this instruction.
  • python classify.py --model alattulis3.model --labelbin lb3.pickle --image examples/ballpoint.jpg
If you want to just classify image you can using this instruction.
  • python train.py --dataset dataset --model alattulis3.model --labelbin lb3.pickle
Image Classification using Keras and CNN Image Classification using Keras and CNN Reviewed by Jimmy Pujoseno on May 08, 2018 Rating: 5

No comments:

Recent Post

Powered by Blogger.