Skip to content

Commit

Permalink
Added 10 classes for NN, but it predicts badly
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeysp11 committed Nov 15, 2020
1 parent a7088b7 commit d87629b
Show file tree
Hide file tree
Showing 82 changed files with 31 additions and 11 deletions.
Binary file added computer_vision/mnist/2_8x8/2.01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/2_8x8/2.10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/3_8x8/3.10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/4_8x8/4.01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/4_8x8/4.02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/4_8x8/4.03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/4_8x8/4.04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/4_8x8/4.05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added computer_vision/mnist/4_8x8/4.06.png
Binary file added computer_vision/mnist/4_8x8/4.07.png
Binary file added computer_vision/mnist/4_8x8/4.08.png
Binary file added computer_vision/mnist/4_8x8/4.09.png
Binary file added computer_vision/mnist/4_8x8/4.10.png
Binary file added computer_vision/mnist/5_8x8/5.01.png
Binary file added computer_vision/mnist/5_8x8/5.02.png
Binary file added computer_vision/mnist/5_8x8/5.03.png
Binary file added computer_vision/mnist/5_8x8/5.04.png
Binary file added computer_vision/mnist/5_8x8/5.05.png
Binary file added computer_vision/mnist/5_8x8/5.06.png
Binary file added computer_vision/mnist/5_8x8/5.07.png
Binary file added computer_vision/mnist/5_8x8/5.08.png
Binary file added computer_vision/mnist/5_8x8/5.09.png
Binary file added computer_vision/mnist/5_8x8/5.10.png
Binary file added computer_vision/mnist/6_8x8/6.01.png
Binary file added computer_vision/mnist/6_8x8/6.02.png
Binary file added computer_vision/mnist/6_8x8/6.03.png
Binary file added computer_vision/mnist/6_8x8/6.04.png
Binary file added computer_vision/mnist/6_8x8/6.05.png
Binary file added computer_vision/mnist/6_8x8/6.06.png
Binary file added computer_vision/mnist/6_8x8/6.07.png
Binary file added computer_vision/mnist/6_8x8/6.08.png
Binary file added computer_vision/mnist/6_8x8/6.09.png
Binary file added computer_vision/mnist/6_8x8/6.10.png
Binary file added computer_vision/mnist/7_8x8/7.01.png
Binary file added computer_vision/mnist/7_8x8/7.02.png
Binary file added computer_vision/mnist/7_8x8/7.03.png
Binary file added computer_vision/mnist/7_8x8/7.04.png
Binary file added computer_vision/mnist/7_8x8/7.05.png
Binary file added computer_vision/mnist/7_8x8/7.06.png
Binary file added computer_vision/mnist/7_8x8/7.07.png
Binary file added computer_vision/mnist/7_8x8/7.08.png
Binary file added computer_vision/mnist/7_8x8/7.09.png
Binary file added computer_vision/mnist/7_8x8/7.10.png
Binary file added computer_vision/mnist/8_8x8/8.01.png
Binary file added computer_vision/mnist/8_8x8/8.02.png
Binary file added computer_vision/mnist/8_8x8/8.03.png
Binary file added computer_vision/mnist/8_8x8/8.04.png
Binary file added computer_vision/mnist/8_8x8/8.05.png
Binary file added computer_vision/mnist/8_8x8/8.06.png
Binary file added computer_vision/mnist/8_8x8/8.07.png
Binary file added computer_vision/mnist/8_8x8/8.08.png
Binary file added computer_vision/mnist/8_8x8/8.09.png
Binary file added computer_vision/mnist/8_8x8/8.10.png
Binary file added computer_vision/mnist/9_8x8/9.01.png
Binary file added computer_vision/mnist/9_8x8/9.02.png
Binary file added computer_vision/mnist/9_8x8/9.03.png
Binary file added computer_vision/mnist/9_8x8/9.04.png
Binary file added computer_vision/mnist/9_8x8/9.05.png
Binary file added computer_vision/mnist/9_8x8/9.06.png
Binary file added computer_vision/mnist/9_8x8/9.07.png
Binary file added computer_vision/mnist/9_8x8/9.08.png
Binary file added computer_vision/mnist/9_8x8/9.09.png
Binary file added computer_vision/mnist/9_8x8/9.10.png
Binary file modified computer_vision/mnist/__pycache__/mnist_custom.cpython-38.pyc
Binary file not shown.
42 changes: 31 additions & 11 deletions computer_vision/mnist/mnist_custom.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import numpy as np

# Import datasets, classifiers and performance metrics
from sklearn import datasets, svm, metrics
from sklearn.model_selection import train_test_split


class MnistCustomDigits:
def run(self):
import matplotlib.pyplot as plt

# Import datasets, classifiers and performance metrics
from sklearn import datasets, svm, metrics
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier

# Create a classifier: a support vector classifier
classifier = svm.SVC(gamma=0.001)

# Create a classifier: multi-layer perceptron (MLP) algorithm
"""
clf = MLPClassifier(solver='lbfgs', alpha=1e-5,
hidden_layer_sizes=(5, 2), random_state=1)
"""

# Initialize test subsets of images
pixels_train0, labels_train0, train_imgs0 = self.load_digits(path='0_8x8', label='0')
pixels_train1, labels_train1, train_imgs1 = self.load_digits(path='1_8x8', label='1')
"""
pixels_train2, labels_train2, train_imgs2 = self.load_digits(path='2_8x8', label='2')
pixels_train3, labels_train3, train_imgs3 = self.load_digits(path='3_8x8', label='3')
pixels_train4, labels_train4, train_imgs4 = self.load_digits(path='4_8x8', label='4')
Expand All @@ -24,16 +29,31 @@ def run(self):
pixels_train7, labels_train7, train_imgs7 = self.load_digits(path='7_8x8', label='7')
pixels_train8, labels_train8, train_imgs8 = self.load_digits(path='8_8x8', label='8')
pixels_train9, labels_train9, train_imgs9 = self.load_digits(path='9_8x8', label='9')
"""


# Concatenate pixels, labels and imgs
pixels_train = np.concatenate((pixels_train0,
pixels_train1),
pixels_train1,
pixels_train2,
pixels_train3,
pixels_train4,
pixels_train5,
pixels_train6,
pixels_train7,
pixels_train8,
pixels_train9),
axis=0)
labels_train = np.concatenate((labels_train0,
labels_train1),
labels_train1,
labels_train2,
labels_train3,
labels_train4,
labels_train5,
labels_train6,
labels_train7,
labels_train8,
labels_train9),
axis=0)
train_imgs = train_imgs0 + train_imgs1
train_imgs = train_imgs0 + train_imgs1 + train_imgs2 + train_imgs3 + train_imgs4 + train_imgs5 + train_imgs6 + train_imgs7 + train_imgs8 +train_imgs9

# initialize test subsets with images of digits from digits_test folder
pixels_test, labels_test, test_imgs = self.load_digits(path='digits_8x8')
Expand Down

0 comments on commit d87629b

Please sign in to comment.