{"id":15158272,"url":"https://github.com/adityapathakk/cats-vs-dogs","last_synced_at":"2026-01-21T16:33:38.915Z","repository":{"id":254560510,"uuid":"846909969","full_name":"adityapathakk/Cats-Vs-Dogs","owner":"adityapathakk","description":"Couldn't decide if I saw a cat or a dog, so I made a guide on CNNs \u0026 Transfer Learning with the Dogs Vs Cats dataset on Kaggle (check README.md).","archived":false,"fork":false,"pushed_at":"2024-08-24T18:31:17.000Z","size":2454,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-21T05:42:12.776Z","etag":null,"topics":["cats-vs-dogs","cnn-classification","deep-learning","kaggle","keras","python","tensorflow","transfer-learning"],"latest_commit_sha":null,"homepage":"https://www.kaggle.com/code/adityapathak03/comprehensive-guide-to-cnns-with-cats-vs-dogs","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/adityapathakk.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":"2024-08-24T09:48:49.000Z","updated_at":"2024-08-24T18:31:20.000Z","dependencies_parsed_at":"2024-09-26T20:43:38.066Z","dependency_job_id":"5c146842-5e96-446b-aed2-f0183ae6a6b4","html_url":"https://github.com/adityapathakk/Cats-Vs-Dogs","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"bf6801fdafde9c49673e1c74e7b2af661a6752df"},"previous_names":["adityapathakk/cats-vs-dogs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityapathakk%2FCats-Vs-Dogs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityapathakk%2FCats-Vs-Dogs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityapathakk%2FCats-Vs-Dogs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityapathakk%2FCats-Vs-Dogs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adityapathakk","download_url":"https://codeload.github.com/adityapathakk/Cats-Vs-Dogs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238706255,"owners_count":19516905,"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":["cats-vs-dogs","cnn-classification","deep-learning","kaggle","keras","python","tensorflow","transfer-learning"],"created_at":"2024-09-26T20:42:08.085Z","updated_at":"2026-01-21T16:33:38.885Z","avatar_url":"https://github.com/adityapathakk.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project: Classifier for Cats and Dogs\n### Tech-Stack: Deep Learning in Python\n- \u003cb\u003eLibraries:\u003c/b\u003e Tensorflow, Keras, OpenCV, Matplotlib, Pandas\n- \u003cb\u003eConcepts:\u003c/b\u003e CNNs, Data Augmentation, Transfer Learning, Data Visualisation\n- \u003cb\u003eTools\u003c/b\u003e: Google Colab, Kaggle, VS Code\n\nI developed this \u003cs\u003eFOR FUN\u003c/s\u003e to revise Deep Learning fundamentals using the popular classification problem - \u003ci\u003e\u003cb\u003eCats Vs Dogs\u003c/b\u003e\u003c/i\u003e!\u003cbr\u003e\nIf you'd like to upvote/comment/copy this notebook on Kaggle, here's the link to my \u003ca href = \"https://www.kaggle.com/code/adityapathak03/comprehensive-guide-to-cnns-with-cats-vs-dogs\"\u003eComprehensive Guide to CNNs with Cats Vs Dogs\u003c/a\u003e!\n\n# Project Methodology \u0026 Details\n\n### 1. Importing Libraries and Loading Dataset\nThe dataset used for this project can be found \u003ca href = \"https://www.kaggle.com/datasets/salader/dogs-vs-cats\"\u003ehere\u003c/a\u003e. It is a popular dataset with a file size of 1GB.\u003cbr\u003e\nRefer to the picture below to see some of the libraries that were used.\n\n\u003cimg width=\"1130\" alt=\"Screenshot 2024-08-24 at 3 47 56 PM\" src=\"https://github.com/user-attachments/assets/b17e5429-a8f4-4e35-a3d0-d137a746a597\"\u003e\n\n#### 1.1 Data Normalisation\nA ```process``` function was defined to maintain the pixel values of the images in the dataset between 0 and 1 as opposed to 0 and 255.\n\n\u003cimg width=\"1130\" alt=\"Screenshot 2024-08-24 at 3 51 10 PM\" src=\"https://github.com/user-attachments/assets/0c62e818-3038-42fa-8518-d59683f77b78\"\u003e\n\n### 2. Data Visualisation\nI observed some of the images present in the dataset.\n\u003cp float=\"left\"\u003e\n  \u003cimg width=\"700\" alt=\"Screenshot 2024-08-24 at 4 21 30 PM\" src=\"https://github.com/user-attachments/assets/8ba52f1a-2539-4c7e-aa3d-13cd628880ac\"\u003e\n  \u003cimg width=\"700\" alt=\"Screenshot 2024-08-24 at 3 54 01 PM\" src=\"https://github.com/user-attachments/assets/eb0a9c08-475a-4cbd-9abe-002094a62636\"\u003e\n\u003c/p\u003e\n\n### 3. Developing Simple CNNs\nI developed 5 simple CNNs with increasing complexity -\n\n- Model 1 is a basic CNN for introductory purposes.\n- Model 2 shows how Batch Normalisation and Dropout increase validation accuracy quite a bit. This is a type of regularisation.\n- Model 3 tries L1 regularisation, while Model 4 tries L2 regularisation.\n- Model 5 is a complex CNN that does quite well. It has a lot of convolutional layers that can gather a lot of information from the dataset.\n\nTake a look below for some snapshots of the models and their training process -\n\u003cp float=\"left\"\u003e\n  \u003cimg width=\"1315\" alt=\"CNN Model 1\" src=\"https://github.com/user-attachments/assets/e558b751-c9c0-4df2-b625-e87064af8470\"\u003e\n  \u003cimg width=\"700\" alt=\"CNN Model 2\" src=\"https://github.com/user-attachments/assets/3f63157e-5230-4c78-82a3-212f01cb7357\"\u003e\n  \u003cimg width=\"700\" alt=\"CNN Model 3\" src=\"https://github.com/user-attachments/assets/a6583ef6-010b-4433-8a7d-6e1d1f320481\"\u003e\n  \u003cimg width=\"700\" alt=\"CNN Model 4\" src=\"https://github.com/user-attachments/assets/86aa741a-1b76-4a7e-9199-99b34077527f\"\u003e\n  \u003cimg width=\"700\" alt=\"CNN Model 5\" src=\"https://github.com/user-attachments/assets/4422f8f2-bb83-4c3e-a003-722e4964c774\"\u003e\n\u003c/p\u003e\nOut of all these, Model 5 performed the best, with \u003cb\u003eboth training accuracy and validation accuracy reaching \u003e 91%\u003c/b\u003e!\n\n### 4. CNN with Augmented Data\nUsing some simple data augmentation layers like ```RandomFlip```, ```RandomRotation```, ```RandomZoom```, ```RandomTranslation```, and ```RandomContrast```, implemented a CNN with augmented data.\n\n\u003cimg width=\"700\" alt=\"Screenshot 2024-08-24 at 11 44 42 PM\" src=\"https://github.com/user-attachments/assets/1fec0e30-36ad-4fa9-990b-3faf5dd19b9e\"\u003e\n\n### 5. Transfer Learning - VGG16\nHarnessed the popular pre-trained model VGG16 to achieve extremely accurate results.\n\u003cp float=\"left\"\u003e\n  \u003cimg width=\"700\" alt=\"Screenshot 2024-08-24 at 11 46 40 PM\" src=\"https://github.com/user-attachments/assets/0c2c6fc5-fb18-42b5-9f49-67e71490f24d\"\u003e\n  \u003cimg width=\"700\" alt=\"Screenshot 2024-08-24 at 11 47 46 PM\" src=\"https://github.com/user-attachments/assets/b075ed20-66ae-4f26-ae0f-d83f778d3ee5\"\u003e\n\u003c/p\u003e\n\n### 6. Visualized Accuracy with Graphs\nPlotted graphs for training accuracy vs validation accuracy and training loss vs validation loss for all the models\n\n![image](https://github.com/user-attachments/assets/dff73ade-ff40-487d-8acf-4c1548259bb6)\n\n### 7. Making Predictions\n2 images were selected at random. After resizing, predictions were made using the VGG model. They were correct :D \n\n\u003cimg width=\"750\" alt=\"Screenshot 2024-08-24 at 11 52 19 PM\" src=\"https://github.com/user-attachments/assets/e368a71e-7d82-4fa2-8e7c-50cd25a46e25\"\u003e\n\n### 8. Closing Note\n- If you observe the model fitting process of some models (for example, CNN Model #4), then you'll notice that the model reached a certain peak in accuracy during training, but when the number of epochs ended, it was nowhere near that peak. To fix this, we can use callback functions like 'Early Stopping' and 'Model Checkpoint'.\n- You have to be extremely patient with Deep Learning. You have to keep evaluating model performance, fine-tune/update weights/layers and just find out what works and what doesn't. All this can be time-consuming, but it has to be done! So don't worry about taking your time.\n\n# Thanks!\nFor checking this out. I hope you learnt something new here!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadityapathakk%2Fcats-vs-dogs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadityapathakk%2Fcats-vs-dogs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadityapathakk%2Fcats-vs-dogs/lists"}