Upload model_card.md
Browse files- model_card.md +47 -0
model_card.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# Animal Recognition Model
|
| 3 |
+
|
| 4 |
+
## Model Overview
|
| 5 |
+
This model is designed to classify images of animals into predefined categories. It uses a ResNet50V2 base model and has been trained on a custom dataset.
|
| 6 |
+
|
| 7 |
+
## Classes
|
| 8 |
+
The model was trained on the following classes:
|
| 9 |
+
- cat
|
| 10 |
+
- dog
|
| 11 |
+
- horse
|
| 12 |
+
- lion
|
| 13 |
+
- tiger
|
| 14 |
+
- elephant
|
| 15 |
+
|
| 16 |
+
## Usage
|
| 17 |
+
1. Load the model using TensorFlow/Keras.
|
| 18 |
+
2. Preprocess the input image to a size of 256x256 and normalize it.
|
| 19 |
+
3. Pass the preprocessed image to the model for prediction.
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
from keras.models import load_model
|
| 23 |
+
import numpy as np
|
| 24 |
+
from tensorflow.keras.utils import load_img, img_to_array
|
| 25 |
+
|
| 26 |
+
def predict_image(image_path, model):
|
| 27 |
+
img = load_img(image_path, target_size=(256, 256))
|
| 28 |
+
img_array = img_to_array(img) / 255.0
|
| 29 |
+
img_array = np.expand_dims(img_array, axis=0)
|
| 30 |
+
prediction = model.predict(img_array)
|
| 31 |
+
return np.argmax(prediction, axis=1)
|
| 32 |
+
|
| 33 |
+
model = load_model('best_model.weights.h5')
|
| 34 |
+
predicted_class = predict_image('/path/to/image.jpg', model)
|
| 35 |
+
print(f"Predicted class: {predicted_class}")
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
## Training Details
|
| 39 |
+
- **Base Model:** ResNet50V2 (pretrained on ImageNet)
|
| 40 |
+
- **Dataset:** Custom animal dataset
|
| 41 |
+
- **Optimizer:** Adam
|
| 42 |
+
- **Loss Function:** Sparse Categorical Crossentropy
|
| 43 |
+
- **Metrics:** Accuracy
|
| 44 |
+
- **Augmentation:** Applied during training
|
| 45 |
+
|
| 46 |
+
## Model Performance
|
| 47 |
+
Training metrics and evaluation logs are available in the accompanying notebook.
|