{"id":15664311,"url":"https://github.com/deep-diver/cifar10-img-classification-tensorflow","last_synced_at":"2025-05-06T21:28:44.962Z","repository":{"id":40625785,"uuid":"128016660","full_name":"deep-diver/CIFAR10-img-classification-tensorflow","owner":"deep-diver","description":"image classification with CIFAR10 dataset w/ Tensorflow","archived":false,"fork":false,"pushed_at":"2022-11-19T13:16:55.000Z","size":982,"stargazers_count":138,"open_issues_count":7,"forks_count":115,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T03:08:56.514Z","etag":null,"topics":["cifar-10","convolutional-neural-networks","deep-learning","tensorflow"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deep-diver.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-04T06:20:44.000Z","updated_at":"2025-02-10T14:19:46.000Z","dependencies_parsed_at":"2022-09-20T12:42:16.035Z","dependency_job_id":null,"html_url":"https://github.com/deep-diver/CIFAR10-img-classification-tensorflow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deep-diver%2FCIFAR10-img-classification-tensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deep-diver%2FCIFAR10-img-classification-tensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deep-diver%2FCIFAR10-img-classification-tensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deep-diver%2FCIFAR10-img-classification-tensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deep-diver","download_url":"https://codeload.github.com/deep-diver/CIFAR10-img-classification-tensorflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252771465,"owners_count":21801712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cifar-10","convolutional-neural-networks","deep-learning","tensorflow"],"created_at":"2024-10-03T13:42:02.060Z","updated_at":"2025-05-06T21:28:44.891Z","avatar_url":"https://github.com/deep-diver.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Classification with CIFAR-10 dataset\nIn this notebook, I am going to classify images from the [CIFAR-10 dataset](https://www.cs.toronto.edu/~kriz/cifar.html).  The dataset consists of airplanes, dogs, cats, and other objects. You'll preprocess the images, then train a convolutional neural network on all the samples. The images need to be normalized and the labels need to be one-hot encoded. Some more interesting datasets can be found [here](http://rodrigob.github.io/are_we_there_yet/build/#datasets)\n\nSome of the code and description of this notebook is borrowed by [this repo](https://github.com/udacity/deep-learning/tree/master/image-classification) provided by Udacity's Deep Learning Nanodegree program. This notebook has been reproduced decorated with richer descriptions after completing the Udacity's project.\n\n# Contents\n##### 1. Get the Data\n##### 2. Understanding the dataset\n##### 3. Hands-on experience implementing normalize and one-hot encoding function\n##### 4. Tensorflow Basics\n##### 5. Model Architecture and construction (Using different types of APIs (tf.nn, tf.layers, tf.contrib))\n##### 6. Training the model (how to feed and evaluate Tensorflow graph?)\n##### 7. Prediction\n### please open up the jupyter notebook to see the full descriptions\n\n# 2. Understanding the dataset\nThe original a batch data is (10000 x 3072) dimensional tensor expressed in numpy array, where the number of columns, (10000), indicates the number of sample data. As stated in the [CIFAR-10/CIFAR-100 dataset](https://www.cs.toronto.edu/~kriz/cifar.html), the row vector, (3072) represents an color image of 32x32 pixels.\n\nSince this project is going to use CNN for the classification tasks, the row vector, (3072), is not an appropriate form of image data to feed. In order to feed an image data into a CNN model, the dimension of the tensor representing an image data should be either (width x height x num_channel) or (num_channel x width x height).\n\nIt depends on your choice (check out the [tensorflow conv2d](https://www.tensorflow.org/api_docs/python/tf/nn/conv2d)). In this particular project, I am going to use the dimension of the first choice because the default choice in tensorflow's CNN operation is so.\n\nThe row vector (3072) has the exact same number of elements if you calculate 32\\*32\\*3==3072. In order to reshape the row vector, (3072), there are two steps required. The **first** step is involved with using **reshape** function in numpy, and the **second** step is involved with using **transpose** function in numpy as well.\n\n\u003cimg src=\"./reshape-transpose.png\" alt=\"Drawing\"/\u003e\n\n# 5. Model Architecture\n\u003cimg src=\"./conv_model.png\" alt=\"Drawing\"/\u003e\n\nThe entire model consists of 14 layers in total. In addition to layers below lists what techniques are applied to build the model.\n\n1. Convolution with 64 different filters in size of (3x3)\n2. Max Pooling by 2\n  - ReLU activation function\n  - Batch Normalization\n3. Convolution with 128 different filters in size of (3x3)\n4. Max Pooling by 2\n  - ReLU activation function\n  - Batch Normalization\n5. Convolution with 256 different filters in size of (3x3)\n6. Max Pooling by 2\n  - ReLU activation function\n  - Batch Normalization\n7. Convolution with 512 different filters in size of (3x3)\n8. Max Pooling by 2\n  - ReLU activation function\n  - Batch Normalization\n9. Flattening the 3-D output of the last convolutional operations.\n10. Fully Connected Layer with 128 units\n  - Dropout\n  - Batch Normalization\n11. Fully Connected Layer with 256 units\n  - Dropout\n  - Batch Normalization\n12. Fully Connected Layer with 512 units\n  - Dropout\n  - Batch Normalization\n13. Fully Connected Layer with 1024 units\n  - Dropout\n  - Batch Normalization\n14. Fully Connected Layer with 10 units (number of image classes)\n\nthe image below decribes how the conceptual convolving operation differs from the tensorflow implementation when you use [Channel x Width x Height] tensor format.\n\n\u003cimg src=\"./convolving.png\" alt=\"Drawing\"/\u003e\n\n# 6. Training the model\nachieving over 75% accuracy in 10 epochs through 5 batches.\n\n\u003cimg src=\"./training.PNG\" alt=\"Drawing\"/\u003e\n\n# 7. Prediction\n\u003cimg src=\"./prediction.PNG\" alt=\"Drawing\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeep-diver%2Fcifar10-img-classification-tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeep-diver%2Fcifar10-img-classification-tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeep-diver%2Fcifar10-img-classification-tensorflow/lists"}