Exercise:learning color features with Sparse autoencoders Contents [hide] 1Learning color features with Sparse Autoencoder s 1.1Dependencies 1.2Learning from color image patches 1.3Step 0:initialization 1.4Step 1:modify your sparse Autoencoder To use a linear decoder 1.5Step 2:learn features on small patches Learning color features with Sparse autoencoders
In this exercise, your'll implement a linear decoder (a sparse autoencoder whose output layer uses a linear activation fu nction). You'll then apply it to learn features in color images from the STL-10 dataset. These features is used in a laterexercise on convolution and pooling for classifying STL-10.
In the file Linear_decoder_exercise.zip we have provided some starter code. You are should write your code at the places indicated "your code here" in the files.
For this exercise, you'll need to copy and modify SPARSEAUTOENCODERCOST.M from Thesparse Autoencoder. Dependencies
You'll need:sparseautoencodercost.m (and related functions) from Exercise:sparse Autoencoder
The following additional file is also required for this exercise:sampled 8x8 patches the STL-10 dataset (Stl10_patch Es_100k.zip)
If you are have not completed the exercise listed above, we strongly suggest you complete it. Learning from color image patches
In all the exercises so far, you have been working only with grayscale images. In this exercise, you'll get to work with the RGB color images for the "".
Conveniently, the fact that is image has three color channels (RGB), rather than a single gray channel, presents Little Di Fficulty for the sparse autoencoder. Can just combine the intensities from all the color channels for the pixels to one long vector, as if you were Worki Ng with a grayscale image with 3x the number of pixels as the original image. Step 0:initialization
In this step, we initialize some parameters used in the exercise (and the Code for details). Step 1:modify your sparse autoencoder to use a linear decoder
Copy sparseautoencodercost.m to the directory of this exercise and rename it tosparseautoencoderlinearcost.m. Rename the function sparseautoencodercost in the file tosparseautoencoderlinearcost, and modify it to use a linear decoder . In particular, your should the cost and gradients returned to reflect the "change" from a sigmoid to a linear decoder. After the making this change, check your gradients to ensure that they are. Step 2:learn features on small patches
You'll now use your sparse autoencoder to learn features on a set of 100,000 small 8x8 patches sampled from the larger 9 6x96 STL-10 Images (TheSTL-10 DataSet comprises 5000 training and 8000 test examples, with each example being a 96x96 Labe lled color image belonging to one of the ten Classes:airplane, Bird, car, cat, deer, dog, horse, monkey, ship, truck.)
The code provided in the "step" trains your sparse Autoencoder for iterations with the default parameters I N Step 0. This should take around minutes. Your sparse Autoencoder should learn features when which, look like visualized and "edges opponent," as in the colors Re below.
If your parameters are improperly tuned (the default parameters should work), or if your implementation of the Autoencoder Is buggy, your might instead get images which look like one of the following:
The learned features is saved to Stl10features.mat, which'll be used in the laterexercise on convolution and Poolin G.
From:http://ufldl.stanford.edu/wiki/index.php/exercise:learning_color_features_with_sparse_autoencoders