{"id":15132071,"url":"https://github.com/vartikaraj2512/animalclassification","last_synced_at":"2026-01-20T10:32:58.871Z","repository":{"id":257458394,"uuid":"858332653","full_name":"VartikaRaj2512/AnimalClassification","owner":"VartikaRaj2512","description":"🐾 Animal Classification: Classify 28K animal images into 10 categories using CNNs with Transfer Learning. 📥 Load \u0026 extract data, 🔄 preprocess images, 🧠 train models (VGG-16 \u0026 ResNet50), and 📈 plot performance. Libraries: OpenCV (BGR), TQDM (progress bars), Categorical (one-hot encoding). 🛠️ Install: pip install tensorflow numpy opencv-python ","archived":false,"fork":false,"pushed_at":"2024-09-16T18:21:05.000Z","size":5397,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T21:16:39.081Z","etag":null,"topics":["classification","cnn","kaggle","machine-learning","numpy","opencv","pandas","tensorflow"],"latest_commit_sha":null,"homepage":"","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/VartikaRaj2512.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-09-16T18:00:38.000Z","updated_at":"2024-09-17T04:27:46.000Z","dependencies_parsed_at":"2024-09-16T22:20:02.709Z","dependency_job_id":"53d3328a-5183-429e-95ba-b0b6e99b3eb4","html_url":"https://github.com/VartikaRaj2512/AnimalClassification","commit_stats":null,"previous_names":["vartikaraj2512/animalclassification"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VartikaRaj2512%2FAnimalClassification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VartikaRaj2512%2FAnimalClassification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VartikaRaj2512%2FAnimalClassification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VartikaRaj2512%2FAnimalClassification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VartikaRaj2512","download_url":"https://codeload.github.com/VartikaRaj2512/AnimalClassification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399884,"owners_count":20932880,"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":["classification","cnn","kaggle","machine-learning","numpy","opencv","pandas","tensorflow"],"created_at":"2024-09-26T04:03:06.545Z","updated_at":"2026-01-20T10:32:58.860Z","avatar_url":"https://github.com/VartikaRaj2512.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 🐾 Animal Classification Project\n\n## 📜 Project Overview\n\nThis project involves classifying images of animals into 10 distinct categories using a Convolutional Neural Network (CNN) with Transfer Learning. The dataset, **Animal10**, contains approximately 28,000 medium-quality images sourced from Google Images and manually verified for accuracy. It includes some erroneous data to simulate real-world conditions.\n\n## 📂 Dataset\n\nThe dataset can be accessed [here](https://www.kaggle.com/datasets/alessiocorrado99/animals10). It comprises 10 categories of animals, with each image checked for quality and correctness. The categories include a diverse range of animals to ensure robust model training.\n\n## 🚀 Getting Started\n\n### 1. Loading and Exploring Data\n\n1. **Loading Libraries**\n   - Import necessary libraries such as TensorFlow, Keras, OpenCV, and more.\n\n2. **Extracting Train Data**\n   - Download and extract the dataset for use in training and validation.\n\n3. **Shuffling Data**\n   - Shuffle the input and target data to ensure optimal training performance.\n\n### 2. Image Preprocessing\n\n1. **Function for Resizing and Reshaping**\n   - Define a function to resize images to a uniform dimension and reshape them for model compatibility.\n\n2. **Image Resizing and Conversion**\n   - Resize images and convert them into arrays suitable for model input.\n\n3. **Viewing Preprocessed Images**\n   - Visualize a few images after preprocessing to verify transformations.\n\n4. **Re-Shuffling and Array Conversion**\n   - Shuffle processed data again and convert it into arrays for training.\n\n5. **Train-Test Split \u0026 One-Hot Encoding**\n   - Split data into training and testing sets, one-hot encode categories, and normalize input images.\n\n6. **Renaming Animals**\n   - Ensure consistent naming of animal categories for easier reference.\n\n7. **Data Augmentation**\n   - Apply data augmentation techniques to enhance the diversity of training data.\n\n8. **Preprocessing Test Data**\n   - Apply the same preprocessing steps to test data.\n\n### 3. Creating CNN Models with Transfer Learning\n\n1. **CNN using VGG-16**\n   - Implement a CNN model utilizing the VGG-16 architecture for feature extraction.\n\n2. **CNN using ResNet50**\n   - Build a CNN model using the ResNet50 architecture to leverage residual learning.\n\n3. **Training Models**\n   - Train both models using the preprocessed training data.\n\n4. **Plotting Loss and Accuracy Curves**\n   - Plot loss and accuracy curves to evaluate model performance and training progress.\n\n### 4. Predicting Categories for Test Data\n\n1. **Viewing Predictions**\n   - Make predictions on test data and review the results to assess model accuracy.\n\n## 📚 Explanation of Libraries\n\n- **OpenCV (cv2)**: Used for reading images; note that OpenCV reads colors in BGR format, whereas PIL assumes RGB format.\n- **TQDM**: Provides a progress bar for loops, enhancing user experience by showing real-time progress.\n- **Utils Module**: Includes parameters such as `class_weight` for handling imbalanced data and `Shuffle` for consistent array shuffling.\n- **Categorical**: Converts labeled data into one-hot vectors, facilitating multi-class classification.\n- **Applications**: Provides pre-trained models for prediction and feature extraction.\n- **Dropout**: A regularization technique to prevent overfitting by randomly dropping units during training.\n- **Flatten**: Converts multi-dimensional data into a 1D array, preserving weight ordering for dense layers.\n- **Dense Layer**: A fundamental layer in neural networks, providing fully connected layers for learning complex patterns.\n\n## 📊 Results\n\nCheck the model performance and predictions in the provided results section.\n\n## 🛠️ Installation and Dependencies\n\n```bash\npip install tensorflow numpy opencv-python tqdm\n```\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvartikaraj2512%2Fanimalclassification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvartikaraj2512%2Fanimalclassification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvartikaraj2512%2Fanimalclassification/lists"}