kkthyagharajan commited on
Commit
0a7599e
Β·
verified Β·
1 Parent(s): 83ab1d3

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +106 -105
README.md CHANGED
@@ -1,105 +1,106 @@
1
- # 🧠 KKT-HF-TransferLearning-Models
2
- ### Transfer Learning Models Collection for Image Classification
3
- Created by **Thyagharajan K K**
4
-
5
- ---
6
-
7
- ## πŸ“ Repository Structure
8
- ```
9
-
10
- KKT-HF-TransferLearning-Models/ ← Root directory (your HF repo root)
11
- β”‚
12
- β”œβ”€β”€ Insect_Inception_V3/ ← Model 1 directory
13
- β”‚ β”œβ”€β”€ insect_inception_v3_model.keras ← Saved model file
14
- β”‚ β”œβ”€β”€ class_names.txt ← Corresponding class labels
15
- β”‚ └── InsectTest/ ← Test image folder
16
- β”‚ β”œβ”€β”€ image_001.jpg
17
- β”‚ β”œβ”€β”€ image_002.jpg
18
- β”‚ └── ...
19
- β”‚
20
- β”œβ”€β”€ Insect_EfficientNetB0/ ← Model 2 directory (example)
21
- β”‚ β”œβ”€β”€ insect_efficientnetb0_model.keras
22
- β”‚ β”œβ”€β”€ class_names.txt
23
- β”‚ └── InsectTest/
24
- β”‚ β”œβ”€β”€ test1.jpg
25
- β”‚ β”œβ”€β”€ test2.jpg
26
- β”‚ └── ...
27
- β”‚
28
- β”œβ”€β”€ Insect_ResNet50/
29
- β”‚ β”œβ”€β”€ insect_resnet50_model.keras
30
- β”‚ β”œβ”€β”€ class_names.txt
31
- β”‚ └── InsectTest/
32
- β”‚ β”œβ”€β”€ imgA.jpg
33
- β”‚ β”œβ”€β”€ imgB.jpg
34
- β”‚ └── ...
35
- β”‚
36
- └── README.md ← (optional, highly recommended)
37
-
38
- ```
39
- Each subfolder contains:
40
- - A `.keras` TensorFlow model
41
- - A `class_names.txt` file listing class labels
42
- - An `Test/` folder with example test images
43
-
44
- ---
45
-
46
- ## βš™οΈ Programmatic Usage
47
-
48
- You can load any model from this repository directly in Python using the helper functions in **`KKT_DL_Package`**.
49
-
50
- ### 🧩 Example Code
51
-
52
- ```python
53
- # -*- coding: utf-8 -*-
54
- """
55
- Created on Sat Nov 8 14:07:38 2025
56
- @author: Thyagharajan
57
-
58
- Example: Using a Hugging Face model programmatically
59
- """
60
-
61
- from KKT_DL_Package.utils.KKT_predictions import (
62
- multiclass_prediction_return,
63
- display_images_gui,
64
- get_hf_model_img_labels_local_path
65
- )
66
-
67
- # Define image input size (must match the model's input)
68
- IMG_SIZE = (300, 300)
69
-
70
- # Load model, class labels, and test images from Hugging Face
71
- model_full_path, test_folder_path, class_names = get_hf_model_img_labels_local_path(
72
- "kkthyagharajan/KKT-HF-TransferLearning-Models",
73
- IMG_SIZE,
74
- force_refresh=False # Set True to force re-download
75
- )
76
-
77
- # Run predictions
78
- all_image_paths, all_predicted_labels, all_confidences = multiclass_prediction_return(
79
- model_full_path, test_folder_path, class_names, IMG_SIZE
80
- )
81
-
82
- # Display results in a simple GUI window
83
- display_images_gui(all_image_paths, all_predicted_labels, IMG_SIZE)
84
-
85
- 🧠 About the Helper Function
86
- get_hf_model_img_labels_local_path(repoid, img_size, force_refresh=False)
87
-
88
- This function:
89
-
90
- Downloads (or reuses cached) model and class label files from Hugging Face
91
- Loads test images from the repo
92
-
93
- Returns:
94
- The full local path to the model file
95
- The local test folder path
96
- The list of class names
97
-
98
- Parameters
99
- Argument Description
100
- repoid Hugging Face repo ID (e.g. "kkthyagharajan/KKT-HF-TransferLearning-Models")
101
- img_size Tuple, e.g. (300, 300) matching model input
102
- force_refresh If True, forces re-download even if cached locally
103
-
104
- Returns:
105
- `model_full_path, test_folder_path, class_names`
 
 
1
+ # 🧠 KKT-HF-TransferLearning-Models
2
+ ### Transfer Learning Models Collection for Image Classification
3
+ Created by **Thyagharajan K K**
4
+
5
+ ---
6
+
7
+ ## πŸ“ Repository Structure
8
+ ```
9
+
10
+ KKT-HF-TransferLearning-Models/ ← Root directory (your HF repo root)
11
+ β”‚
12
+ β”œβ”€β”€ Insect_Inception_V3/ ← Model 1 directory
13
+ β”‚ β”œβ”€β”€ insect_inception_v3_model.keras ← Saved model file
14
+ β”‚ β”œβ”€β”€ class_names.txt ← Corresponding class labels
15
+ β”‚ └── InsectTest/ ← Test image folder
16
+ β”‚ β”œβ”€β”€ image_001.jpg
17
+ β”‚ β”œβ”€β”€ image_002.jpg
18
+ β”‚ └── ...
19
+ β”‚
20
+ β”œβ”€β”€ Insect_MobileNetV2/ ← Model 2 directory (example)
21
+ β”‚ β”œβ”€β”€ insect_mobilenet_v2_model.keras
22
+ β”‚ β”œβ”€β”€ class_names.txt
23
+ β”‚ └── InsectTest/
24
+ β”‚ β”œβ”€β”€ test1.jpg
25
+ β”‚ β”œβ”€β”€ test2.jpg
26
+ β”‚ └── ...
27
+ β”‚
28
+ β”œβ”€β”€ Insect_ResNet50/
29
+ β”‚ β”œβ”€β”€ insect_resnet50_model.keras
30
+ β”‚ β”œβ”€β”€ class_names.txt
31
+ β”‚ └── InsectTest/
32
+ β”‚ β”œβ”€β”€ imgA.jpg
33
+ β”‚ β”œβ”€β”€ imgB.jpg
34
+ β”‚ └── ...
35
+ β”‚
36
+ └── README.md ← (optional, highly recommended)
37
+
38
+ ```
39
+
40
+ Each subfolder contains:
41
+ - A `.keras` TensorFlow model
42
+ - A `class_names.txt` file listing class labels
43
+ - An `Test/` folder with example test images
44
+
45
+ ---
46
+
47
+ ## βš™οΈ Programmatic Usage
48
+
49
+ You can load any model from this repository directly in Python using the helper functions in **`KKT_DL_Package`**.
50
+
51
+ ### 🧩 Example Code
52
+
53
+ ```python
54
+ # -*- coding: utf-8 -*-
55
+ """
56
+ Created on Sat Nov 8 14:07:38 2025
57
+ @author: Thyagharajan
58
+
59
+ Example: Using a Hugging Face model programmatically
60
+ """
61
+
62
+ from KKT_DL_Package.utils.KKT_predictions import (
63
+ multiclass_prediction_return,
64
+ display_images_gui,
65
+ get_hf_model_img_labels_local_path
66
+ )
67
+
68
+ # Define image input size (must match the model's input)
69
+ IMG_SIZE = (300, 300)
70
+
71
+ # Load model, class labels, and test images from Hugging Face
72
+ model_full_path, test_folder_path, class_names = get_hf_model_img_labels_local_path(
73
+ "kkthyagharajan/KKT-HF-TransferLearning-Models",
74
+ IMG_SIZE,
75
+ force_refresh=False # Set True to force re-download
76
+ )
77
+
78
+ # Run predictions
79
+ all_image_paths, all_predicted_labels, all_confidences = multiclass_prediction_return(
80
+ model_full_path, test_folder_path, class_names, IMG_SIZE
81
+ )
82
+
83
+ # Display results in a simple GUI window
84
+ display_images_gui(all_image_paths, all_predicted_labels, IMG_SIZE)
85
+
86
+ 🧠 About the Helper Function
87
+ get_hf_model_img_labels_local_path(repoid, img_size, force_refresh=False)
88
+
89
+ This function:
90
+
91
+ Downloads (or reuses cached) model and class label files from Hugging Face
92
+ Loads test images from the repo
93
+
94
+ Returns:
95
+ The full local path to the model file
96
+ The local test folder path
97
+ The list of class names
98
+
99
+ Parameters
100
+ Argument Description
101
+ repoid Hugging Face repo ID (e.g. "kkthyagharajan/KKT-HF-TransferLearning-Models")
102
+ img_size Tuple, e.g. (300, 300) matching model input
103
+ force_refresh If True, forces re-download even if cached locally
104
+
105
+ Returns:
106
+ `model_full_path, test_folder_path, class_names`