Image Classification
Keras
LiteRT
TF-Keras
Safetensors
English
efficientnetv2-s
efficientnetv2
fgic
transfer-learning
gem-pooling
focal-loss
swa
grad-cam
calibration
temperature-scaling
computer-vision
tensorflow.js
Eval Results (legacy)
Instructions to use 0xgr3y/Arch-Building-Image-Classification with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use 0xgr3y/Arch-Building-Image-Classification with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://0xgr3y/Arch-Building-Image-Classification") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- .gitattributes +2 -0
- best_phase2.keras +3 -0
- best_phase2_swa.keras +3 -0
- config.json +117 -0
- label_mapping.json +18 -0
- preprocessor_config.json +20 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
best_phase2.keras filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
best_phase2_swa.keras filter=lfs diff=lfs merge=lfs -text
|
best_phase2.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc267da784afaad435bc15a5f01a8e6bcf91c453721b0edfad3254a7c283f355
|
| 3 |
+
size 102521223
|
best_phase2_swa.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3605c70db3680a8d81be1f305b901a08de5214065a5f9691c7ec1eb7b12d59b2
|
| 3 |
+
size 102521272
|
config.json
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "densenet121_custom",
|
| 3 |
+
"base_model": "tensorflow/densenet121",
|
| 4 |
+
"task": "image-classification",
|
| 5 |
+
"num_labels": 6,
|
| 6 |
+
"id2label": {
|
| 7 |
+
"0": "bridge",
|
| 8 |
+
"1": "castle",
|
| 9 |
+
"2": "mosque",
|
| 10 |
+
"3": "skyscraper",
|
| 11 |
+
"4": "stadium",
|
| 12 |
+
"5": "temple"
|
| 13 |
+
},
|
| 14 |
+
"label2id": {
|
| 15 |
+
"bridge": 0,
|
| 16 |
+
"castle": 1,
|
| 17 |
+
"mosque": 2,
|
| 18 |
+
"skyscraper": 3,
|
| 19 |
+
"stadium": 4,
|
| 20 |
+
"temple": 5
|
| 21 |
+
},
|
| 22 |
+
"input_shape": [320, 320, 3],
|
| 23 |
+
"preprocessing": {
|
| 24 |
+
"mode": "densenet_preprocess_input",
|
| 25 |
+
"mean": [123.675, 116.28, 103.53],
|
| 26 |
+
"std": [58.395, 57.12, 57.375],
|
| 27 |
+
"channel_order": "BGR"
|
| 28 |
+
},
|
| 29 |
+
"training_info": {
|
| 30 |
+
"dataset_source": "Pexels Architecture (10.080 images, 6 classes, balanced)",
|
| 31 |
+
"dataset_size": 10080,
|
| 32 |
+
"split_ratio": [0.8, 0.1, 0.1],
|
| 33 |
+
"split_seed": 42,
|
| 34 |
+
"phases": [
|
| 35 |
+
{
|
| 36 |
+
"name": "Phase 1 - Feature Extraction",
|
| 37 |
+
"optimizer": "AdamW",
|
| 38 |
+
"lr": 0.001,
|
| 39 |
+
"epochs_max": 25,
|
| 40 |
+
"epochs_actual": 1,
|
| 41 |
+
"val_accuracy": 0.8671,
|
| 42 |
+
"val_loss": 1.0042,
|
| 43 |
+
"train_accuracy": 0.5589,
|
| 44 |
+
"cutmix_mixup": true,
|
| 45 |
+
"label_smoothing": 0.1,
|
| 46 |
+
"early_stop_reason": "myCallback val_acc >= 0.85"
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"name": "Phase 2 - Selective Fine-Tuning",
|
| 50 |
+
"optimizer": "DiscriminativeAdamW",
|
| 51 |
+
"lr": 0.0003,
|
| 52 |
+
"epochs_max": 50,
|
| 53 |
+
"epochs_actual": 6,
|
| 54 |
+
"val_accuracy": 0.9335,
|
| 55 |
+
"val_loss": 0.4877,
|
| 56 |
+
"train_accuracy": 0.9065,
|
| 57 |
+
"unfreeze": "conv4_block+conv5_block (BN frozen)",
|
| 58 |
+
"discriminative_lr": {"conv4_block": 0.1},
|
| 59 |
+
"cutmix_mixup": false,
|
| 60 |
+
"label_smoothing": 0.05,
|
| 61 |
+
"early_stop_reason": "myCallback val_acc >= 0.92"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"name": "SWA Post-Training",
|
| 65 |
+
"epochs": 5,
|
| 66 |
+
"lr": 0.0001,
|
| 67 |
+
"bn_update": true,
|
| 68 |
+
"bn_update_steps": 100,
|
| 69 |
+
"val_accuracy": 0.9593,
|
| 70 |
+
"val_loss": 0.3981,
|
| 71 |
+
"method": "Izmailov et al., UAI 2018"
|
| 72 |
+
}
|
| 73 |
+
],
|
| 74 |
+
"metrics": {
|
| 75 |
+
"train_accuracy": 0.9945,
|
| 76 |
+
"val_accuracy": 0.9593,
|
| 77 |
+
"test_accuracy": 0.9623,
|
| 78 |
+
"test_loss": 0.3974,
|
| 79 |
+
"tta_accuracy": 0.9633,
|
| 80 |
+
"overfitting_gap": 0.0322,
|
| 81 |
+
"test_correct": 970,
|
| 82 |
+
"test_total": 1008,
|
| 83 |
+
"macro_precision": 0.9629,
|
| 84 |
+
"macro_recall": 0.9623,
|
| 85 |
+
"macro_f1": 0.9621,
|
| 86 |
+
"per_class_f1": {
|
| 87 |
+
"bridge": 0.9529,
|
| 88 |
+
"castle": 0.9792,
|
| 89 |
+
"mosque": 0.9593,
|
| 90 |
+
"skyscraper": 0.9795,
|
| 91 |
+
"stadium": 0.9412,
|
| 92 |
+
"temple": 0.9607
|
| 93 |
+
},
|
| 94 |
+
"per_class_recall": {
|
| 95 |
+
"bridge": 0.9643,
|
| 96 |
+
"castle": 0.9821,
|
| 97 |
+
"mosque": 0.9821,
|
| 98 |
+
"skyscraper": 0.9940,
|
| 99 |
+
"stadium": 0.9048,
|
| 100 |
+
"temple": 0.9464
|
| 101 |
+
},
|
| 102 |
+
"checkpoint_comparison": {
|
| 103 |
+
"best_phase2_swa": {"val_accuracy": 0.9593, "val_loss": 0.3981, "rank": 1},
|
| 104 |
+
"best_phase2": {"val_accuracy": 0.9335, "val_loss": 0.4877, "rank": 2},
|
| 105 |
+
"best_phase2_ema": {"val_accuracy": 0.8720, "val_loss": 0.6621, "rank": 3},
|
| 106 |
+
"best_phase1": {"val_accuracy": 0.8671, "val_loss": 1.0042, "rank": 4}
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
},
|
| 110 |
+
"version": "v15",
|
| 111 |
+
"license": "cc-by-4.0",
|
| 112 |
+
"author": {
|
| 113 |
+
"name": "Saugani",
|
| 114 |
+
"email": "mr.asyir@gmail.com"
|
| 115 |
+
},
|
| 116 |
+
"dicoding_id": "gani24"
|
| 117 |
+
}
|
label_mapping.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id2label": {
|
| 3 |
+
"0": "bridge",
|
| 4 |
+
"1": "castle",
|
| 5 |
+
"2": "mosque",
|
| 6 |
+
"3": "skyscraper",
|
| 7 |
+
"4": "stadium",
|
| 8 |
+
"5": "temple"
|
| 9 |
+
},
|
| 10 |
+
"label2id": {
|
| 11 |
+
"bridge": 0,
|
| 12 |
+
"castle": 1,
|
| 13 |
+
"mosque": 2,
|
| 14 |
+
"skyscraper": 3,
|
| 15 |
+
"stadium": 4,
|
| 16 |
+
"temple": 5
|
| 17 |
+
}
|
| 18 |
+
}
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_processing": {
|
| 3 |
+
"size": {
|
| 4 |
+
"width": 320,
|
| 5 |
+
"height": 320
|
| 6 |
+
},
|
| 7 |
+
"resample": "bilinear",
|
| 8 |
+
"normalize": true,
|
| 9 |
+
"mode": "densenet_preprocess_input",
|
| 10 |
+
"channel_order": "RGB",
|
| 11 |
+
"mean": [123.675, 116.28, 103.53],
|
| 12 |
+
"std": [58.395, 57.12, 57.375],
|
| 13 |
+
"scale": 1.0,
|
| 14 |
+
"description": "Gunakan tf.keras.applications.densenet.preprocess_input untuk preprocessing otomatis. Untuk TF-Lite manual: RGB->BGR, subtract ImageNet mean. Catatan: preprocessor_config.json menyimpan 'BGR' untuk referensi DenseNet ImageNet, tapi densenet.preprocess_input() bekerja pada RGB input dan menangani konversi internal."
|
| 15 |
+
},
|
| 16 |
+
"input_name": "input_1",
|
| 17 |
+
"output_name": "output_1",
|
| 18 |
+
"input_shape": [1, 320, 320, 3],
|
| 19 |
+
"output_shape": [1, 6]
|
| 20 |
+
}
|