[PYTHON] I tried to classify Oba Hana and Emiri Otani by deep learning (Part 2)

Continuation of the last time

I solved the classification problem by image recognition in the training of the company, so I tried to do the same with my favorite idol. Below, the previous article

I tried to classify Oba Hana and Emiri Otani by deep learning

This time, based on the previous results, I would like to see what kind of image was mistaken for accuracy improvement.

Before that, we will introduce the two people to be classified.

Oba Hana

I'm a ghostly heart. I am a member of the idol group "= LOVE". ** Dogawae yeah yeah yeah yeah yeah hey hey hey hey hey! !! !! !! !! -! !! !! ** **

EMUEVIBUcAAgFdI.jfif

Below is a Twitter account. Please follow us. Oba Hana (https://twitter.com/hana_oba)

Emiri Otani

He is also a member of the idol group "= LOVE". cute.

ELKvYJ_UYAEkYf3.jfif

Emiri Otani (https://twitter.com/otani_emiri)

The accuracy of the last time was about 90% correct answer rate.

Try to improve accuracy ① ~ Increase the number of trials ~

The last time was about 200 epochs.

ダウンロード (1).png

Looking at this, it seems that it will still rise (if the number of trials is too large, the graph will fall constantly rather than temporarily)

So I will increase the number of times. From 200 to 1000 times

The accuracy has improved safely. It has been low for a long time around 800 times, is this overfitting? I thought, but it picked up at the end.

ダウンロード (2).png

The correct answer rate for the 1000th epoch was 98.33%. Well, in reality, I did some trial and error to improve the accuracy at the time of training, so I was able to get quite accurate just by increasing the number of times. As an article, I should struggle to improve the accuracy, but I want to make it better. For the time being, today we will improve the accuracy so far and see what this model made a mistake. (I want to make inferences quickly)

See what you made a mistake

I will answer below and see which one I made a mistake.

idol.ipynb


ans = []
for i in range(0,x_test.shape[0]):
  x = np.array([x_test[i]])
  y = model.predict(x)
  ans.append(np.argmax(y))
  if(ans[i] != t_test[i]):
    print(i)

Below are the results

75
82
148

Of the 140 verification data, 3 incorrect answers = the correct answer rate is about 98%, isn't it? Use this to restore the data once dropped to a numerical value as shown below.

idol.ipynb


plt.imshow(x_test[75])
plt.imshow(x_test[82])
plt.imshow(x_test[148])
EB7uqiOUIAEgxwa.jfif

Since it was an image of Mr. Kameko, I will not post it. This is the first tweet below. (Like! Please press) https://twitter.com/hana_oba/status/1119100534286217221?s=20

EJu0k1TU8AEaSsc.jfif

Hmmm, it's usually Hanana-chan. The first piece has a rate of 89% The second piece has a 58% rate The third piece has a rate of 64% It seems that he finally made the decision to see it.

Well, it's hard to explain why deep learning made such a decision at a level that humans can understand, so there is nothing more to guess.

Next time, I will try to improve the accuracy in a different way.

Recommended Posts

I tried to classify Oba Hana and Emiri Otani by deep learning (Part 2)
I tried to classify Oba Hana and Emiri Otani by deep learning
I tried to implement Perceptron Part 1 [Deep Learning from scratch]
[Deep Learning from scratch] I tried to implement sigmoid layer and Relu layer.
I tried to make Kana's handwriting recognition Part 2/3 Data creation and learning
I tried to classify mnist numbers by unsupervised learning [PCA, t-SNE, k-means]
I tried to classify dragon ball by adaline
I tried deep learning
[Deep Learning from scratch] I tried to explain Dropout
I tried to predict horse racing by doing everything from data collection to deep learning
I tried to implement anomaly detection by sparse structure learning
I tried to classify MNIST by GNN (with PyTorch geometric)
I tried to divide with a deep learning language model
I tried to verify the yin and yang classification of Hololive members by machine learning
I tried to make Othello AI that I learned 7.2 million hands by deep learning with Chainer
I tried to classify Shogi players Takami 7th Dan and Masuda 6th Dan by CNN [For CNN beginners]
I tried to implement Deep VQE
I tried to make deep learning scalable with Spark × Keras × Docker
[Introduction to simulation] I tried playing by simulating corona infection ♬ Part 2
I tried to implement deep learning that is not deep with only NumPy
I tried moving the image to the specified folder by right-clicking and left-clicking
I tried using PyEZ and JSNAPy. Part 2: I tried using PyEZ
I tried to classify text using TensorFlow
I tried to classify guitar chords in real time using machine learning
I tried to verify and analyze the acceleration of Python by Cython
I tried the common story of using Deep Learning to predict the Nikkei 225
Introduction to AI creation with Python! Part 3 I tried to classify and predict images with a convolutional neural network (CNN)
[Python] I tried to analyze the characteristics of thumbnails that are easy to play on YouTube by deep learning
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part7 / 22]
[Python] Deep Learning: I tried to implement deep learning (DBN, SDA) without using a library.
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 4/22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part3 / 22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 1/22]
I tried to predict the presence or absence of snow by machine learning.
I tried to predict the change in snowfall for 2 years by machine learning
I tried to process and transform the image and expand the data for machine learning
I tried to implement Cifar10 with SONY Deep Learning library NNabla [Nippon Hurray]
I tried to pass the G test and E qualification by training from 50
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 6/22]
I tried to make deep learning scalable with Spark × Keras × Docker 2 Multi-host edition
I tried using PyEZ and JSNAPy. Part 1: Overview
I tried to program bubble sort by language
Chainer and deep learning learned by function approximation
I implemented DCGAN and tried to generate apples
I tried to get an image by scraping
Video frame interpolation by deep learning Part1 [Python]
Parallel learning of deep learning by Keras and Kubernetes
Introduction to Deep Learning ~ Localization and Loss Function ~
[Introduction to PID] I tried to control and play ♬
I tried to classify Mr. Habu and Mr. Habu with natural language processing × naive Bayes classifier
"Deep Learning from scratch" Self-study memo (No. 16) I tried to build SimpleConvNet with Keras
I tried to read and save automatically with VOICEROID2 2
I installed and used the Deep Learning library Chainer
I tried to implement and learn DCGAN with PyTorch
I tried to automatically read and save with VOICEROID2
I tried adding system calls and scheduler to Linux
Classify anime faces by sequel / deep learning with Keras
I tried to erase the negative part of Meros
Artificial intelligence, machine learning, deep learning to implement and understand
I tried to implement Grad-CAM with keras and tensorflow
I tried to install scrapy on Anaconda and couldn't