This project implements a deep learning-based image classifier to distinguish between alpaca and non-alpaca images. The classifier uses transfer learning with MobileNetV2, a pre-trained Convolutional Neural Network (CNN) trained on the ImageNet dataset. The goal is to create an efficient and accurate model for alpaca recognition.
- Project Objectives
- Key Features
- Dataset
- Model Architecture
- Training
- Fine-tuning
- Results
- Dependencies
- Contributing
- Establish a dataset from a directory containing alpaca and non-alpaca images.
- Implement data splitting into training and validation sets.
- Apply data augmentation techniques using the Sequential API to enhance diversity in the training set.
- Utilize prefetching to prevent memory bottlenecks during data preprocessing.
- Explore the architecture of MobileNetV2, focusing on depthwise separable convolutions and bottleneck layers.
- Delete the top layer of MobileNetV2, which contained ImageNet classification labels.
- Integrate a new classifier layer for binary classification (alpaca or not alpaca).
- Develop a custom model using the Functional API and MobileNetV2 base.
- Fine-tune the model's final layers to improve accuracy.
- Compile and train the model using Binary Crossentropy loss and Adam optimizer.
- Unfreeze selected layers of MobileNetV2 for fine-tuning.
- Re-run the optimizer with a smaller learning rate to adapt the model to new data.
- Explore the impact of fine-tuning on model accuracy.
- Efficient alpaca recognition using MobileNetV2.
- Transfer learning for leveraging pretrained model knowledge.
- Data augmentation for enhancing training set diversity.
- Fine-tuning for adapting the model to specific data.
The dataset consists of alpaca and non-alpaca images stored in the dataset/ directory. It is split into training and validation sets using the image_dataset_from_directory function.
The model architecture is based on MobileNetV2 with a customized classifier for binary classification. It utilizes depthwise separable convolutions and bottleneck layers to achieve efficient feature extraction.
The model is trained using the train_dataset with data augmentation and preprocessing. The training process involves fine-tuning the final layers for improved accuracy.
Fine-tuning involves unfreezing selected layers of MobileNetV2 and re-running the optimizer with a smaller learning rate. This step adapts the model to new data and captures high-level details.
The trained model achieves accurate alpaca recognition with improved performance through fine-tuning.
- TensorFlow
- Matplotlib
- NumPy
Feel free to contribute to this project by opening issues or submitting pull requests. Your feedback and contributions are highly appreciated.