AnimalsDataset / README.md
AIOmarRehan's picture
Update README.md
6808c54 verified
---
license: unknown
---
# **Cats, Dogs, and Snakes Dataset**
## **Dataset Overview**
The dataset contains images of **three animal classes**: Cats, Dogs, and Snakes. It is **balanced and cleaned**, designed for supervised image classification tasks.
| Class | Number of Images | Description |
| ------ | ---------------- | ---------------------------------------------- |
| Cats | 1,000 | Includes multiple breeds and poses |
| Dogs | 1,000 | Covers various breeds and backgrounds |
| Snakes | 1,000 | Includes multiple species and natural settings |
**Total Images:** 3,000
**Image Properties:**
* Resolution: 224×224 pixels (resized for consistency)
* Color Mode: RGB
* Format: JPEG/PNG
* Cleaned: Duplicate, blurry, and irrelevant images removed
---
## **Data Split Recommendation**
| Set | Percentage | Number of Images |
| ---------- | ---------- | ---------------- |
| Training | 70% | 2,100 |
| Validation | 15% | 450 |
| Test | 15% | 450 |
---
## **Preprocessing**
Images in the dataset have been standardized to support machine learning pipelines:
1. **Resizing** to 224×224 pixels.
2. **Normalization** of pixel values to [0,1] or mean subtraction for deep learning frameworks.
3. **Label encoding**: Integer encoding (0 = Cat, 1 = Dog, 2 = Snake) or one-hot encoding for model training.
---
## **Example: Loading and Using the Dataset (Python)**
```python
import os
import tensorflow as tf
from tensorflow.keras.preprocessing.image import ImageDataGenerator
# Path to dataset
dataset_path = "path/to/dataset"
# ImageDataGenerator for preprocessing
datagen = ImageDataGenerator(
rescale=1./255,
validation_split=0.15 # 15% for validation
)
# Load training data
train_generator = datagen.flow_from_directory(
dataset_path,
target_size=(224, 224),
batch_size=32,
class_mode='categorical',
subset='training',
shuffle=True
)
# Load validation data
validation_generator = datagen.flow_from_directory(
dataset_path,
target_size=(224, 224),
batch_size=32,
class_mode='categorical',
subset='validation',
shuffle=False
)
# Example: Iterate over one batch
images, labels = next(train_generator)
print(images.shape, labels.shape) # (32, 224, 224, 3) (32, 3)
```
---
## **Key Features**
* **Balanced:** Equal number of samples per class reduces bias.
* **Cleaned:** High-quality, relevant images improve model performance.
* **Diverse:** Covers multiple breeds, species, and environments to ensure generalization.
* **Ready for ML:** Preprocessed and easily integrated into popular deep learning frameworks.