Views
No views yet
.keras model fileclass_names.txt fileTest folder with example test images1from KKT_DL_Package.utils.KKT_predictions import (
2 multiclass_prediction_return,
3 display_images_gui,
4 get_hf_model_img_labels_local_path,
5)
6
7IMG_SIZE = (300, 300)
8
9model_full_path, test_folder_path, class_names = (
10 get_hf_model_img_labels_local_path(
11 "kkthyagharajan/KKT-HF-TransferLearning-Models",
12 IMG_SIZE,
13 force_refresh=False, # Won’t redownload if cached
14 )
15)
16
17# Run predictions and display results
18all_image_paths, all_predicted_labels, all_confidences = (
19 multiclass_prediction_return(
20 model_full_path,
21 test_folder_path,
22 class_names,
23 IMG_SIZE,
24 )
25)
26
27display_images_gui(
28 all_image_paths,
29 all_predicted_labels,
30 IMG_SIZE,
31)app.py.1pip install -r requirements.txt
2python app.py # or
3streamlit run app.py
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