{"id":14958765,"url":"https://github.com/tatevkaren/convolutional-neural-network-image_recognition_case_study","last_synced_at":"2025-10-24T16:30:23.441Z","repository":{"id":113747741,"uuid":"348680272","full_name":"TatevKaren/convolutional-neural-network-image_recognition_case_study","owner":"TatevKaren","description":"Computer Vision Case Study in image recognition to classify an image to a binary class, based on Convolutional Neural Networks (CNN), with TensorFlow and Keras in Python, to identify from an image whether it is an image of a dog or cat. (Includes: Data, Case Study Paper, Code)","archived":false,"fork":false,"pushed_at":"2022-04-18T17:12:08.000Z","size":6765,"stargazers_count":21,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T02:37:48.621Z","etag":null,"topics":["case-study","cnn","cnn-for-visual-recognition","cnn-model","computer-vision","convolutional-neural-networks","deep-learning","image-recognition","keras","machine-learning","prediction","python","tensorflow","tensorflow-tutorials"],"latest_commit_sha":null,"homepage":"","language":"Python","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/TatevKaren.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-17T11:13:09.000Z","updated_at":"2025-01-02T10:58:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"74f3ef40-28fc-4467-8bc1-8f2b5648776a","html_url":"https://github.com/TatevKaren/convolutional-neural-network-image_recognition_case_study","commit_stats":{"total_commits":44,"total_committers":1,"mean_commits":44.0,"dds":0.0,"last_synced_commit":"1814f99fa998239fcd518a3adf57d3ae87b1a49b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TatevKaren%2Fconvolutional-neural-network-image_recognition_case_study","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TatevKaren%2Fconvolutional-neural-network-image_recognition_case_study/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TatevKaren%2Fconvolutional-neural-network-image_recognition_case_study/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TatevKaren%2Fconvolutional-neural-network-image_recognition_case_study/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TatevKaren","download_url":"https://codeload.github.com/TatevKaren/convolutional-neural-network-image_recognition_case_study/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237999434,"owners_count":19399880,"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":["case-study","cnn","cnn-for-visual-recognition","cnn-model","computer-vision","convolutional-neural-networks","deep-learning","image-recognition","keras","machine-learning","prediction","python","tensorflow","tensorflow-tutorials"],"created_at":"2024-09-24T13:18:13.981Z","updated_at":"2025-10-24T16:30:22.860Z","avatar_url":"https://github.com/TatevKaren.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://img.shields.io/badge/Deep__Learning-CNN-red)]()\n[![](https://img.shields.io/badge/Python-Run_Code-blue?logo=Python)]()\n[![](https://img.shields.io/badge/Tensorflow-3d3b3b?logo=Tensorflow)]()\n[![](https://img.shields.io/badge/Keras-3d3b3b?logo=Keras)]()\n[![](https://img.shields.io/badge/Image__Recognition-Cat_Dog_Images-yellow)]()\n\n# Image Recognition with Convolutional Neural Networks\n\n**Why:** To identify the class which an image belongs a dog image class or a cat image class.\n\n**How:** Using 8K images of dogs and cats to train Convolutional Neural Network(CNN) to predict whether the input image is a dog image or a cat image.\n\n\u003cbr\u003e\n\u003cp href = \"https://github.com/TatevKaren/convolutional-neural-network-image_recognition_case_study/blob/main/Convolutional_Neural_Networks_Case_Study.pdf\"\u003e\n    \u003cimg src=\"https://miro.medium.com/max/962/1*MBSM_G12XN105sEHsJ6C3A.png?raw=true\"\n  width=800\" height=\"500\"\u003e\n\u003c/p\u003e \n    \nNote that this caase sstuddy is inspired fromthe following Udemy Deep Learning Course:\n\n## Case Study \nThis is a Computer Vision Case Study with an Image recognition model that classifies an image to a binary class. Image recognition model based on Convolutional Neural Network (CNN) to identify from an image whether it is dog or a cat image. In this case study we use 8000 images of dogs and cats to train and test a Convolutional Neural Network (CNN) model that takes an image as an input and give as an output a class of 0 (cat) or 1 (dog) suggesting whether it is a dog or a cat picture. This image recognition model is based on CNN. \n\nThe \u003ca href =\"https://github.com/TatevKaren/convolutional-neural-network-image_recognition_case_study/blob/main/Convolutional_Neural_Networks_Case_Study.pdf\"\u003e Case Study Paper \u003c/a\u003e and \u003ca href =\"https://github.com/TatevKaren/convolutional-neural-network-image_recognition_case_study/blob/main/Convolutional_Neural_Network_Case_Study.py\" \u003e Python Code\u003c/a\u003e contain the followin information\u003cbr\u003e\n\n - Problem statement\n - Data overview\n - Data Preprocessing\n - Model building\n - CNN Initialization\n - Model compiling\n - Model fitting\n - Example prediction\n\n\u003cbr\u003e\n\n## Training Data\n\nWe use training data consisting of 8000 images of dogs and cats to train the CNN model. Here are few examples of such images:\u003cbr\u003e\u003cbr\u003e\n\u003cp\u003e\n    \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/data/dog.31.jpg?raw=true\"\n  width=\"180\" height=\"180\"\u003e\n  \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/data/dog.24.jpg?raw=true\"\n  width=\"180\" height=\"180\"\u003e   \n  \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/data/cat.12.jpg?raw=true\"\n  width=\"180\" height=\"180\"\u003e    \n  \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/data/cat.1.jpg?raw=true\"\n  width=\"180\" height=\"180\"\u003e\n  \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/data/dog.4.jpg?raw=true\"\n  width=\"180\" height=\"180\"\u003e     \n\u003c/p\u003e\n\u003cbr\u003e\u003cbr\u003e\n\n## Model Application and Evaluation\nTo test the accuracy of the trained model we picked a pair of images and used the trained model to predict the class of each of these pair of two images, one of whiich is a dog image and the other one is a cate image. We would like to know the probability of each of this images belonging to a Cat class and Dog class. This will help us to evaluate the trained and tested CNN model to observe to which class does the model classify the following pictures:\n\u003cbr\u003e\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/data/cat_or_dog_1.jpg?raw=true\"\n  width=\"300\" height=\"200\"\u003e\n\u003c/p\u003e\n\u003cp\u003e\n    \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/data/cat_or_dog_2.jpg?raw=true\"\n  width=\"300\" height=\"200\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\u003cbr\u003e\n\nAfter compiling the model the CNN model accurately classified the first picture to a dog class and the second picture to a cat class. Following is a snapshot of a Python output. In the lower part you can see the predicted class of the first image and the second image, respectively.\n\u003cbr\u003e\u003cbr\u003e\n\u003cp\u003e\n    \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/sources/Prediction_Snapshot.png?raw=true\"\n  width=\"1100\" height=\"550\"\u003e\n\u003c/p\u003e\n\n\n\n\n# Methodology\n\n## Convolutional Neural Networks (CNN)\nThis case study is based on CNN model and the \u003ca href=\"https://github.com/TatevKaren/convolutional-neural-network-image_recognition_case_study/blob/main/Convolutional_Neural_Network_Case_Study-2.pdf\"\u003eCase Study Paper\u003c/a\u003e includes detailed description of all the steps and processes that CNN's include such as:\n- Convolutional Operation\n- Pooling\n- Flattening\n\u003cp\u003e\n    \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/sources/cnn_summary.png?raw=true\"\n  width=\"500\" height=\"200\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n## Model Evaluation\nImportant evaluation steps, described in detail in \u003ca href=\"https://github.com/TatevKaren/computer-vision-case-study/blob/main/Convolutional_Neural_Networks_Case_Study.pdf\"\u003e Case Study Paper \u003c/a\u003e , that help the CNN model to train and make accurate predictions such as:\n- Loss Functions for CNN (SoftMax and Cross-Entropy)\n- Loss Function Optimizers (SGD and Adam Optimizer)\n- Activation Functions (Rectifier and Sigmoid)\n\u003cbr\u003e\n\n## Where to find details about DL libraries: Tensorflow \u0026 Keras \n\u003cp\u003e\n    \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/sources/Keras ImageDataGenerator Library.png?raw=true\"\n  width=\"500\" height=\"300\"\u003e\n\u003c/p\u003e\n\u003cp\u003e\n    \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/sources/Keras ImageDataGenerator Library2.png?raw=true\"\n  width=\"500\" height=\"270\"\u003e\n\u003c/p\u003e\n\u003cp\u003e\n   \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/sources/Keras load_img function.png?raw=true\"\n  width=\"450\" height=\"80\"\u003e\n   \u003cimg src=\"https://github.com/TatevKaren/dog_cat_image_recognition_cnn/blob/main/sources/Keras load_to_array function.png?raw=true\"\n  width=\"450\" height=\"80\"\u003e\n\u003c/p\u003e\nCheck out more information \u003ca href = \"https://keras.io/api/preprocessing/image/#imagedatagenerator-class\"\u003e here\u003c/a\u003e \n\n\u003cbr\u003e\u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftatevkaren%2Fconvolutional-neural-network-image_recognition_case_study","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftatevkaren%2Fconvolutional-neural-network-image_recognition_case_study","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftatevkaren%2Fconvolutional-neural-network-image_recognition_case_study/lists"}