ROCK-PAPER-SCISSORS IMAGE CLASSIFICATION USING CNN

Zahra Salsabila Jaelani

Sosial Media


1 orang menyukai ini
Suka

Summary

Rock-paper-scissors is a simple game worldwide. Here I try to design a model algorithm that can classify rock-paper-scissors types using CNN. Of course, the division of classes will be divided into three classes, namely "paper," "rock," and "scissors."

Why use the CNN algorithm? The CNN algorithm is an algorithm that is very suitable for classifying image data because it has many features that support this process.

Description

Dataset :   https://www.kaggle.com/datasets/drgfreeman/rockpaperscissors

The following are the stages of the classification process of rock scissors paper images using the CNN algorithm: 

Import Library 

The most critical process before the classification is to import the library, which helps call the functions needed during the classification process.  Sebuah gambar berisi teks, Software multimedia, software, Perangkat lunak grafia

Deskripsi dibuat secara otomatis

Sebuah gambar berisi teks, Font, software, Software multimedia

Deskripsi dibuat secara otomatis

Import Dataset 

The dataset used comes from Kaggle. The dataset has been separated between data training and data validation and the separation of each class. This process is done manually and entered into Google Drive.

Sebuah gambar berisi teks, cuplikan layar, Font

Deskripsi dibuat secara otomatis

Check Image Data

This process is not mandatory, but it is better to do so we can ensure that the imported data follows the class. In this process, the data taken is training data from each class and is taken randomly.

Sebuah gambar berisi teks, elektronik, cuplikan layar, software

Deskripsi dibuat secara otomatis

Sebuah gambar berisi cuplikan layar, Software multimedia

Deskripsi dibuat secara otomatis

Sebuah gambar berisi makanan

Deskripsi dibuat secara otomatis

Check and Confirm The Data

The data to be trained is 1200, and the data validation is 240, each divided into three classes, namely paper rock scissors.

Sebuah gambar berisi teks, software, Software multimedia, cuplikan layar

Deskripsi dibuat secara otomatis

Sebuah gambar berisi teks, software, Software multimedia, cuplikan layar

Deskripsi dibuat secara otomatis

CNN Model Training Process

This process aims to build a neural network model architecture using hardware with TensorFlow. model=Sequential() will create a sequential model object containing neural network layers that will be connected sequentially. This process can create a CNN model with an architecture consisting of several convolution layers, max pooling, dropout, and dense layers to classify image data.

Sebuah gambar berisi teks, cuplikan layar, software, Software multimedia

Deskripsi dibuat secara otomatis

Model Compilation Process

Compiles the model with epochs 50 times, and the batch size of each epoch is 16.

Sebuah gambar berisi teks, cuplikan layar, software, Software multimedia

Deskripsi dibuat secara otomatis

Model Evaluation

This is an evaluation of the model that has been trained.

Sebuah gambar berisi teks, cuplikan layar, software, Software multimedia

Deskripsi dibuat secara otomatis

 

Train Data and Validation Data Curves

Sebuah gambar berisi teks, cuplikan layar, Plot, garis

Deskripsi dibuat secara otomatis

Confusion Matrix

A confusion matrix is a process carried out to evaluate and is used to measure the performance of the classification model. The confusion matrix can help to understand how well the model has been made. There are truly negative, false negative, true positive, and false positive values that will help get accuracy, precision, recall, and specificity values in a model.

Sebuah gambar berisi teks, cuplikan layar, software, Software multimedia

Deskripsi dibuat secara otomatis

Classification Report 

This is the result of the calculation of the confusion matrix that was obtained in the previous process and obtained the following values:

Sebuah gambar berisi teks, cuplikan layar

Deskripsi dibuat secara otomatis

Result Conclusion

Sebuah gambar berisi teks, cuplikan layar, Font, Software multimedia

Deskripsi dibuat secara otomatis

Data Model Predictions with Image UploadsSebuah gambar berisi teks, cuplikan layar, software, Software multimedia

Deskripsi dibuat secara otomatis

Analysis and conclusion

Several experiments have been carried out on epoch values and batch sizes in training and compiling the model, and this can affect the value of accuracy and loss in evaluating the model. When the batch value is too large, it will cause a significant loss. Therefore, using a smaller batch, the model will access smaller subclasses of the train data at each iteration. 

After training many times, the results shown are the final and best results. Evaluation of the model for data train obtains a loss value of 0.019 and an accuracy of 0.995. Then, for data validation, it obtains a loss value of 0.012 and an accuracy of 0.991. So the CNN model can work well using 1200 data train, 240 data validation, 50 epochs, and 16 batch sizes which finally get a loss value of 0.012 and an accuracy of 0.991. the model has also been tried to make predictions by uploading images, and the results are appropriate.

 

 

Informasi Course Terkait
  Kategori: Artificial Intelligence
  Course: Teknologi Kecerdasan Artifisial