Instructions to use koyelog/indian-monuments-cnn-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use koyelog/indian-monuments-cnn-model with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://koyelog/indian-monuments-cnn-model") - Notebooks
- Google Colab
- Kaggle
Create README.md
#1
by Arko007 - opened
README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
metrics:
|
| 6 |
+
- accuracy
|
| 7 |
+
- f1
|
| 8 |
+
pipeline_tag: image-classification
|
| 9 |
+
library_name: keras
|
| 10 |
+
tags:
|
| 11 |
+
- keras
|
| 12 |
+
- classification
|
| 13 |
+
- image_classification
|
| 14 |
+
- CNN
|
| 15 |
+
- image_recognition
|
| 16 |
+
base_model:
|
| 17 |
+
- timm/tf_efficientnetv2_m.in21k
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# Indian Monuments CNN Model
|
| 21 |
+
|
| 22 |
+
This model is a fine-tuned image classifier for recognizing major Indian monuments and architectural styles using EfficientNetV2-M as the base. It leverages transfer learning with Keras/TensorFlow, trained on the [danushkumarv/indian-monuments-image-dataset](https://www.kaggle.com/datasets/danushkumarv/indian-monuments-image-dataset) (24 classes).
|
| 23 |
+
|
| 24 |
+
## Model Details
|
| 25 |
+
|
| 26 |
+
- **Model Type:** Transfer Learning (EfficientNetV2-M)
|
| 27 |
+
- **Task:** Image Classification (24 classes)
|
| 28 |
+
- **Base Model:** `timm/tf_efficientnetv2_m.in21k`
|
| 29 |
+
- **Dataset:** [danushkumarv/indian-monuments-image-dataset](https://www.kaggle.com/datasets/danushkumarv/indian-monuments-image-dataset)
|
| 30 |
+
- **Framework:** Keras / TensorFlow
|
| 31 |
+
|
| 32 |
+
## Results
|
| 33 |
+
|
| 34 |
+
| Metric | Value |
|
| 35 |
+
|-----------|--------|
|
| 36 |
+
| Accuracy | 0.921 |
|
| 37 |
+
| F1 Score | 0.918 |
|
| 38 |
+
|
| 39 |
+
## Intended Uses
|
| 40 |
+
|
| 41 |
+
- **Classification:** Predict image class for Indian monuments.
|
| 42 |
+
- **Feature Extraction:** Use EfficientNet backbone for CV tasks.
|
| 43 |
+
- **Education:** Integrate into apps/sites for learning about Indian heritage.
|
| 44 |
+
|
| 45 |
+
## Limitations and Bias
|
| 46 |
+
|
| 47 |
+
- **Out-of-Distribution:** Best for Indian monuments; may misclassify non-monument objects or unusual conditions.
|
| 48 |
+
- **Class Imbalance:** Accuracy may favor classes with more samples.
|
| 49 |
+
- **Fine-Grained Recognition:** Not for identifying sub-parts or rooms within monuments.
|
| 50 |
+
|
| 51 |
+
## How to Use
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
import keras
|
| 55 |
+
from huggingface_hub import from_pretrained_keras
|
| 56 |
+
|
| 57 |
+
repo_id = "koyelog/indian-monuments-cnn-model"
|
| 58 |
+
model = from_pretrained_keras(repo_id)
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
import numpy as np
|
| 63 |
+
from PIL import Image
|
| 64 |
+
|
| 65 |
+
def preprocess_image(image_path, target_size=(224, 224)):
|
| 66 |
+
img = Image.open(image_path).convert('RGB')
|
| 67 |
+
img = img.resize(target_size)
|
| 68 |
+
img_array = np.asarray(img, dtype=np.float32)
|
| 69 |
+
img_array = img_array / 255.0
|
| 70 |
+
return np.expand_dims(img_array, axis=0)
|
| 71 |
+
|
| 72 |
+
x = preprocess_image('path/to/your/monument.jpg')
|
| 73 |
+
predictions = model.predict(x)
|
| 74 |
+
predicted_class_index = np.argmax(predictions[0])
|
| 75 |
+
|
| 76 |
+
# Define your class name mapping
|
| 77 |
+
class_names = [
|
| 78 |
+
"Taj Mahal", "Red Fort", "Charminar", # ...add all class names
|
| 79 |
+
]
|
| 80 |
+
print(f"Predicted Monument: {class_names[predicted_class_index]}")
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## Citation
|
| 84 |
+
|
| 85 |
+
```
|
| 86 |
+
@misc{koyelog_indian_monuments_cnn_model,
|
| 87 |
+
title={Indian Monuments CNN Model},
|
| 88 |
+
author={koyelog},
|
| 89 |
+
year={2025},
|
| 90 |
+
howpublished={\url{https://huggingface.co/koyelog/indian-monuments-cnn-model}}
|
| 91 |
+
}
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
## Model Card Authors
|
| 95 |
+
|
| 96 |
+
Model card generated by [koyelog](https://huggingface.co/koyelog)
|