-# 🐾 Animal Vision System: Classification & Identification
Dog Facial Similarity Identification
An advanced computer vision project focused on animal identification and breed classification. This repository features two primary systems: a Dairy Cattle Breed Classifier and a Dog Facial Similarity Identification engine.
- Transfer Learning: Utilizes pre-trained MobileNetV2 for high-accuracy feature extraction with minimal computational overhead.
- Breed Detection: Specifically optimized for identifying dairy cattle breeds like Gir and Sahiwal.
- Automated Pipeline: Includes end-to-end workflows from image scraping to model deployment.
- Face Similarity Matching: Calculates similarity scores between dog faces to determine if they belong to the same individual.
- Stanford Dogs Integration: Uses the comprehensive Stanford Dogs dataset for robust model training and testing.
- Interactive UI: Features an IPyWidgets-based interface within Jupyter Notebooks for real-time comparison and visualization.
- Multi-Source Scraping: Integrated
icrawlerworkflows to download images from Bing, Google, and Baidu. - Intelligent Splitting: Automated scripts to organize raw data into structured Train, Validation, and Test directories.
- Augmentation: Implements real-time data augmentation (flips, rotations, zooms) to enhance model generalization.
Animal-Vision-System/
├── cattle_model.ipynb # Cattle classification training & evaluation
├── dog_face_detection_V1.ipynb # Dog facial identification & interactive matching
├── datasets/ # (Generated) Local storage for training data
└── README.md # Project documentation- Python 3.8 or higher
- GPU recommended for training (e.g., NVIDIA T4 in Google Colab)
-
Clone the repository:
git clone https://github.com/Rak2k6/Animal-Vision-System---Classification-Identification.git cd Animal-Vision-System---Classification-Identification -
Install required dependencies:
pip install tensorflow icrawler scikit-learn matplotlib pillow ipywidgets
The system leverages the icrawler library to build custom datasets. For example, the cattle model uses search keywords like "Murrah" and "Gir Cattle" to pull diverse samples across global search engines.
- Base: MobileNetV2 (Frozen weights from ImageNet).
- Top: Global Average Pooling -> Dropout (0.3) -> Dense (Sigmoid/Softmax).
- Optimizer: Adam.
- Loss: Binary/Categorical Crossentropy.
Models are trained with Early Stopping to prevent overfitting, monitoring validation loss to restore the best performing weights.
Open cattle_model.ipynb and run the cells sequentially to:
- Scrape images for desired breeds.
- Split data into directories.
- Train the MobileNetV2 model.
- Save the model as
.h5for deployment.
Open dog_face_detection_V1.ipynb to:
- Download and extract the Stanford Dogs dataset.
- Run the interactive comparison widget.
- Upload two dog images to see their similarity score and identification decision.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Developed by Rak2k6