Image Classification: Step-by-step Classifying Images with Python and Techniques of Computer Vision and Machine Learning
By Mark Magic
()
About this ebook
* Research Fields: Computer Vision and Machine Learning.
* Book Topic: Image classification from an image database.
* Classification Algorithms: (1) Tiny Images Representation + Classifiers; (2) HOG (Histogram of Oriented Gradients) Features Representation + Classifiers; (3) Bag of SIFT (Scale Invariant Feature Transform) Features Representation + Classifiers; (4) Training a CNN (Convolutional Neural Network) from scratch; (5) Fine Tuning a Pre-Trained Deep Network (AlexNet); (6) Pre-Trained Deep Network (AlexNet) Features Representation + Classifiers.
* Classifiers: k-Nearest Neighbors (KNN) and Support Vector Machines (SVM).
* Programming Language: Step-by-step implementation with Python in Jupyter Notebook.
* Processing Units to Execute the Codes: CPU and GPU (on Google Colaboratory).
* Major Steps: For algorithms with classifiers, first processing the images to get the images representations, then training the classifiers with training data, and last testing the classifiers with testing data to get the prediction accuracies; for algorithms with networks, first building a network, then training the network with training data, and last testing the network with testing data to get the prediction accuracies.
* Main Results: For the testing data, the prediction accuracies vary between about 30% and 90%, while the time consumptions varied from several seconds to more than one hour. Considering both of the criteria, the Pre-Trained AlexNet Features Representation plus a Classifier was concluded as the best algorithm.
* Detailed Description:
This book implemented six different algorithms to classify images with the prediction accuracy of the testing data as the primary criterion (the higher the better) and the time consumption as the secondary one (the shorter the better). The accuracies varied between about 30% and 90%, while the time consumptions varied from several seconds to more than one hour. Considering both of the criteria, the Pre-Trained AlexNet Features Representation plus a Classifier, such as the k-Nearest Neighbors (KNN) and the Support Vector Machines (SVM), was concluded as the best algorithm.
The six algorithms are: Tiny Images Representation + Classifiers; HOG (Histogram of Oriented Gradients) Features Representation + Classifiers; Bag of SIFT (Scale Invariant Feature Transform) Features Representation + Classifiers; Training a CNN (Convolutional Neural Network) from scratch; Fine Tuning a Pre-Trained Deep Network (AlexNet); and Pre-Trained Deep Network (AlexNet) Features Representation + Classifiers.
The codes were written with Python in Jupyter Notebook, and they could be executed on both CPUs and GPUs.
Mark Magic
Dr. Magic is a Senior Software Engineer living in Long Island, New York. He loves reading and writing. He is very interested in Computer Vision and Machine Learning. He has concentrated on image processing for more than five years.
Related to Image Classification
Related ebooks
Reinforcement Learning Algorithms with Python: Learn, understand, and develop smart algorithms for addressing AI challenges Rating: 0 out of 5 stars0 ratingsMastering TensorFlow 2.x: Implement Powerful Neural Nets across Structured, Unstructured datasets and Time Series Data Rating: 0 out of 5 stars0 ratingsHands-on Supervised Learning with Python Rating: 0 out of 5 stars0 ratingsMachine Learning Interview Questions Rating: 5 out of 5 stars5/5Advanced Machine Learning with Python Rating: 0 out of 5 stars0 ratingsDesigning Machine Learning Systems with Python Rating: 0 out of 5 stars0 ratingsConvolutional Neural Networks in Python: Beginner's Guide to Convolutional Neural Networks in Python Rating: 0 out of 5 stars0 ratingsAdvanced Deep Learning with Python: Design and implement advanced next-generation AI solutions using TensorFlow and PyTorch Rating: 0 out of 5 stars0 ratingsKeras to Kubernetes: The Journey of a Machine Learning Model to Production Rating: 0 out of 5 stars0 ratingsDeep Learning with TensorFlow Rating: 5 out of 5 stars5/5A Practical Approach for Machine Learning and Deep Learning Algorithms: Tools and Techniques Using MATLAB and Python Rating: 0 out of 5 stars0 ratingsNeural Networks with Python Rating: 0 out of 5 stars0 ratingsMachine Learning with Spark - Second Edition Rating: 0 out of 5 stars0 ratingsDeep Learning with Keras Rating: 4 out of 5 stars4/5Building Machine Learning Systems with Python Rating: 4 out of 5 stars4/5Hands-On Machine Learning with Microsoft Excel 2019: Build complete data analysis flows, from data collection to visualization Rating: 0 out of 5 stars0 ratingsMastering Machine Learning on AWS: Advanced machine learning in Python using SageMaker, Apache Spark, and TensorFlow Rating: 0 out of 5 stars0 ratingsCompetitive Learning: Fundamentals and Applications for Reinforcement Learning through Competition Rating: 0 out of 5 stars0 ratingsDeep learning: deep learning explained to your granny – a guide for beginners Rating: 3 out of 5 stars3/5Reinforcement Learning Explained - A Step-by-Step Guide to Reward-Driven AI Rating: 0 out of 5 stars0 ratingsDeep Learning Fundamentals in Python Rating: 4 out of 5 stars4/5Machine Learning in Production: Master the art of delivering robust Machine Learning solutions with MLOps (English Edition) Rating: 0 out of 5 stars0 ratings
Intelligence (AI) & Semantics For You
Artificial Intelligence: A Guide for Thinking Humans Rating: 4 out of 5 stars4/5Midjourney Mastery - The Ultimate Handbook of Prompts Rating: 5 out of 5 stars5/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Writing AI Prompts For Dummies Rating: 0 out of 5 stars0 ratingsChatGPT Millionaire: Work From Home and Make Money Online, Tons of Business Models to Choose from Rating: 5 out of 5 stars5/5The Secrets of ChatGPT Prompt Engineering for Non-Developers Rating: 5 out of 5 stars5/5The ChatGPT Revolution: How to Simplify Your Work and Life Admin with AI Rating: 0 out of 5 stars0 ratingsAI for Educators: AI for Educators Rating: 3 out of 5 stars3/5Generative AI For Dummies Rating: 2 out of 5 stars2/580 Ways to Use ChatGPT in the Classroom Rating: 5 out of 5 stars5/5Chat-GPT Income Ideas: Pioneering Monetization Concepts Utilizing Conversational AI for Profitable Ventures Rating: 4 out of 5 stars4/5The Roadmap to AI Mastery: A Guide to Building and Scaling Projects Rating: 3 out of 5 stars3/5AI Money Machine: Unlock the Secrets to Making Money Online with AI Rating: 5 out of 5 stars5/5The AI-Driven Leader: Harnessing AI to Make Faster, Smarter Decisions Rating: 4 out of 5 stars4/5THE CHATGPT MILLIONAIRE'S HANDBOOK: UNLOCKING WEALTH THROUGH AI AUTOMATION Rating: 5 out of 5 stars5/5A Quickstart Guide To Becoming A ChatGPT Millionaire: The ChatGPT Book For Beginners (Lazy Money Series®) Rating: 4 out of 5 stars4/5Demystifying Prompt Engineering: AI Prompts at Your Fingertips (A Step-By-Step Guide) Rating: 4 out of 5 stars4/5Make Money with ChatGPT: Your Guide to Making Passive Income Online with Ease using AI: AI Wealth Mastery Rating: 2 out of 5 stars2/5Thinking in Algorithms: Strategic Thinking Skills, #2 Rating: 4 out of 5 stars4/5100M Offers Made Easy: Create Your Own Irresistible Offers by Turning ChatGPT into Alex Hormozi Rating: 0 out of 5 stars0 ratings3550+ Most Effective ChatGPT Prompts Rating: 0 out of 5 stars0 ratings2062: The World that AI Made Rating: 5 out of 5 stars5/5
Reviews for Image Classification
0 ratings0 reviews
Book preview
Image Classification - Mark Magic
Image Classification
Step-by-step Classifying Images with Python and Techniques of Computer Vision and Machine Learning
By Dr. Mark Magic
Long Island, NY, United States
The author and the editor have taken care in the preparation of this book and taken great efforts to ensure that the information and instructions contained in this book are accurate, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions.
No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. Use of the contents contained in this book is at your own risk.
If any code samples or techniques contained or described in this book is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
Image Classification: Step-by-step Classifying Images with Python and Techniques of Computer Vision and Machine Learning
Copyright 2019 Dr. Mark Magic All rights reserved.
Published by M.J. Magic Publishing. This publication is protected by copyright, and permission must be obtained from the author prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Dr. Mark Magic: [email protected].
This ebook is licensed for your personal enjoyment only. This ebook may not be re-sold or given away to other people. If you would like to share this book with another person, please purchase an additional copy for each recipient. If you’re reading this book and did not purchase it, or it was not purchased for your use only, then please return to your favorite ebook retailer and purchase your own copy. Thank you for respecting the hard work of this author.
Please remember to leave a review for this book at your favorite retailer.
This book is available in print at most online retailers.
First edition: June 2019
Table of Contents
Chapter 1: Introduction
Chapter 2: Tiny Images Representation and Classifiers
Chapter 3: HOG Features Representation and Classifiers
Chapter 4: Bag of SIFT Features Representation and Classifiers
Chapter 5: Training a Convolutional Neural Network from Scratch
Chapter 6: Fine Tuning a Pre-Trained Deep Network (AlexNet)
Chapter 7: Pre-Trained Deep Network (AlexNet) Features Representation and Classifiers
Chapter 8: GPU Compatible and Google Colaboratory
Chapter 9: Conclusions
References
Postscript
About Dr. Mark Magic
Connect with Dr. Mark Magic
Other books by Dr. Mark Magic
Chapter 1: Introduction
Image classification is a hot topic and one of the core problems in the fields of Computer Vision and Machine Learning. It refers to the task of assigning a label from a fixed set of categories to an input image. Many other seemingly distinct tasks in the fields, such as object detection and segmentation, can be reduced to image classification.
Depending on the interaction between the analyst and the computer during classification, there are two types of image classification: supervised and unsupervised.
For supervised classification, example images with their correct labels are provided as the training dataset. A learning algorithm analyzes the training dataset and then produces an inferred function, which can be used for classifying new images.
For unsupervised classification, the training data are not labeled, that is to say, without the analyst’s intervention. An algorithm learns from the data, identifies commonalities in the data, and reacts based on the presence or absence of such commonalities in each new piece of data.
In this book, all the algorithms are supervised.
Python will be used in this book to realize the classification algorithms. Python [¹] is an interpreted, high-level, general-purpose programming language. Python was created by Guido van Rossum and first released in 1991. It has a design philosophy of emphasizing code readability, notably using significant whitespace. It features a dynamic type system and automatic memory management. It supports multiple programming paradigms, including object-oriented, imperative, functional and procedural. It has a large and comprehensive standard library.
The Anaconda Distributions of Python can be downloaded from https://www.anaconda.com/download. Both the 2.7 and 3.7 versions need to be used in this book.
For Windows 64-bit Operating Systems, after downloading Anaconda2-2018.12-Windows-x86_64.exe and Anaconda3-2018.12-Windows-x86_64.exe, first install them with default settings; then open Anaconda Prompt
to install several libraries that will be used later. For Python 2.7 version, we need to install opencv-contrib-python using pip install opencv-contrib-python==3.3.0.9
. For Python 3.7 version, we need to install opencv-python using pip install opencv-python==3.4.3.18
, install PyTorch using "pip install https://download.pytorch.org/whl/cpu/torch-1.0.0-cp37-cp37m-win_amd64.whl", and install torchvision using