Dataset:
http://www.cs.toronto.edu/~kriz/cifar.html
The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images. for 10 category
Using the python version of the data set:
http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz
Image Data is unstructured data
Transform the Image data into matrix or tensor.
A simple way to display image
import matplotlib.pyplot as plt
# read Image Data, and save to img
img = plt.imread('Tulips.jpg')
print (img.shape) # print the size of the image
plt.imshow(img)
plt.axis('off') # don't show the axis
plt.show()
Challenge for Image Recognition:
View of angle(rotation), different size of the object, brightness, shadow/mask, different shape of the same type object, etc.
Feature Engineering for Image preprocessing:
rotation-invariant
Color Histogram(顏色直方圖) stastics for RGB pixels in a window such as[10, 20]
SIFT(Scale-invariant feature transform)
HOG(Histogram of Oriented Gradient)
(Invariant for geometric and optics)
Feature dimension reduction:
PCA(principle component analysis) choose the max K engienvalues respect to the eigenvectors of the data covariance matrix which will span the principle subspaces.
Task List for Image Recognition Project:
1. Image reading and sample
2. KNN k-fold-cross-validation and choose the best K value of the original Images by GridSearchCV of sklearn
3. Choose the features and the KNN k-fold-cross-validation.
4. PCA dimension reduction, KNN cross-validation and data visualization.
5. Neural network base.
Full Image Recognition code
Reference:
https://github.com/sesiria/ML/blob/master/Chapter3/Project/projects-ch3-cv/starter_code.ipynb