|
|
---
|
|
|
language: en
|
|
|
library_name: keras
|
|
|
tags:
|
|
|
- image-classification
|
|
|
- transfer-learning
|
|
|
- computer-vision
|
|
|
- keras
|
|
|
- tensorflow
|
|
|
- multiclass-classification
|
|
|
license: mit
|
|
|
datasets:
|
|
|
- custom
|
|
|
model-type: multi-model-repository
|
|
|
author: Thyagharajan K K
|
|
|
pipeline_tag: image-classification
|
|
|
inference: true
|
|
|
app_file: app.py
|
|
|
---
|
|
|
|
|
|
# π§ KKT-HF-TransferLearning-Models
|
|
|
|
|
|
## **Ready-to-Use Transfer Learning Models for Image Classification**
|
|
|
|
|
|
**Created by [Thyagharajan K K](https://huggingface.co/kkthyagharajan)**
|
|
|
|
|
|
[](https://huggingface.co/kkthyagharajan/KKT-HF-TransferLearning-Models)
|
|
|
[](https://opensource.org/licenses/MIT)
|
|
|
[](https://keras.io/)
|
|
|
[](https://www.tensorflow.org/)
|
|
|
[](https://github.com/kkthyagharajan/KKT_DL_Package)
|
|
|
|
|
|
---
|
|
|
|
|
|
## π Overview
|
|
|
This repository hosts a **collection of pretrained image-classification models** created using **Transfer Learning** in Keras/TensorFlow.
|
|
|
Each subdirectory contains:
|
|
|
- A trained `.keras` model file
|
|
|
- A `class_names.txt` file
|
|
|
- A `Test` folder with example test images
|
|
|
|
|
|
You can use these models **programmatically** or through an **interactive demo app** powered by Gradio or Streamlit.
|
|
|
|
|
|
---
|
|
|
|
|
|
## π§© Programmatic Usage
|
|
|
|
|
|
```python
|
|
|
from KKT_DL_Package.utils.KKT_predictions import (
|
|
|
multiclass_prediction_return,
|
|
|
display_images_gui,
|
|
|
get_hf_model_img_labels_local_path,
|
|
|
)
|
|
|
|
|
|
IMG_SIZE = (300, 300)
|
|
|
|
|
|
model_full_path, test_folder_path, class_names = (
|
|
|
get_hf_model_img_labels_local_path(
|
|
|
"kkthyagharajan/KKT-HF-TransferLearning-Models",
|
|
|
IMG_SIZE,
|
|
|
force_refresh=False, # Wonβt redownload if cached
|
|
|
)
|
|
|
)
|
|
|
|
|
|
# Run predictions and display results
|
|
|
all_image_paths, all_predicted_labels, all_confidences = (
|
|
|
multiclass_prediction_return(
|
|
|
model_full_path,
|
|
|
test_folder_path,
|
|
|
class_names,
|
|
|
IMG_SIZE,
|
|
|
)
|
|
|
)
|
|
|
|
|
|
display_images_gui(
|
|
|
all_image_paths,
|
|
|
all_predicted_labels,
|
|
|
IMG_SIZE,
|
|
|
)
|
|
|
```
|
|
|
---
|
|
|
|
|
|
## π Interactive Demo App
|
|
|
|
|
|
### π§© Option 1: Run directly on Hugging Face
|
|
|
This Space includes a web app defined by `app.py`.
|
|
|
### π» Option 2: Run locally using Gradio or Streamlit
|
|
|
|
|
|
```bash
|
|
|
pip install -r requirements.txt
|
|
|
python app.py # or
|
|
|
streamlit run app.py
|
|
|
```
|
|
|
|
|
|
---
|
|
|
|
|
|
## π Repository Structure
|
|
|
|
|
|
```
|
|
|
|
|
|
KKT-HF-TransferLearning-Models/ β Root directory (your HF repo root)
|
|
|
β
|
|
|
βββ Insect_Inception_V3/ β Model 1 directory
|
|
|
β βββ insect_inception_v3_model.keras β Saved model file
|
|
|
β βββ class_names.txt β Corresponding class labels
|
|
|
β βββ InsectTest/ β Test image folder
|
|
|
β βββ image_001.jpg
|
|
|
β βββ image_002.jpg
|
|
|
β βββ ...
|
|
|
β
|
|
|
βββ Insect_MobileNetV2/ β Model 2 directory (example)
|
|
|
β βββ insect_mobilenet_v2_model.keras
|
|
|
β βββ class_names.txt
|
|
|
β βββ InsectTest/
|
|
|
β βββ test1.jpg
|
|
|
β βββ test2.jpg
|
|
|
β βββ ...
|
|
|
β
|
|
|
βββ Insect_ResNet50/
|
|
|
β βββ insect_resnet50_model.keras
|
|
|
β βββ class_names.txt
|
|
|
β βββ InsectTest/
|
|
|
β βββ imgA.jpg
|
|
|
β βββ imgB.jpg
|
|
|
β βββ ...
|
|
|
β
|
|
|
βββ README.md
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|