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
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,25 +2,17 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
pipeline_tag: image-classification
|
| 4 |
tags:
|
| 5 |
-
- tensorflow
|
| 6 |
-
- keras
|
| 7 |
-
- safetensors
|
| 8 |
-
- tflite
|
| 9 |
-
- tensorflow.js
|
| 10 |
-
- image-classification
|
| 11 |
- efficientnetv2
|
| 12 |
-
- architecture
|
| 13 |
-
- building
|
| 14 |
- fgic
|
| 15 |
- transfer-learning
|
| 16 |
- gem-pooling
|
| 17 |
- focal-loss
|
| 18 |
-
- discriminative-learning-rate
|
| 19 |
- swa
|
| 20 |
- grad-cam
|
| 21 |
- calibration
|
| 22 |
-
- roc-auc
|
| 23 |
- temperature-scaling
|
|
|
|
|
|
|
| 24 |
library_name: keras
|
| 25 |
language: en
|
| 26 |
datasets:
|
|
@@ -285,39 +277,15 @@ See the dataset curation page for [World Architectural Buildings Dataset for Mul
|
|
| 285 |
|
| 286 |
## Files
|
| 287 |
|
| 288 |
-
|
|
| 289 |
-
|------
|
| 290 |
-
| `fine_tuning_swa.keras`
|
| 291 |
-
| `
|
| 292 |
-
| `
|
| 293 |
-
| `
|
| 294 |
-
| `
|
| 295 |
-
| `
|
| 296 |
-
| `
|
| 297 |
-
| `saved_model/` | TensorFlow SavedModel format (183.29 MB, for TF Serving) |
|
| 298 |
-
| `tflite/model.tflite` | TensorFlow Lite model (88.36 MB, mobile/embedded) |
|
| 299 |
-
| `tflite/label.txt` | Class label names for TF-Lite |
|
| 300 |
-
| `tfjs_model/` | TensorFlow.js model (89.54 MB, 23 shards + model.json) |
|
| 301 |
-
| `config.json` | Model configuration and evaluation metrics |
|
| 302 |
-
| `label_mapping.json` | Class name β ID mapping with training config and architecture info |
|
| 303 |
-
| `preprocessor_config.json` | Input preprocessing specification (320Γ320) |
|
| 304 |
-
| `confusion_pairs.json` | Auto-detected confusion pairs from confusion matrix (threshold >5%) |
|
| 305 |
-
| `class_confidence_stats.json` | Per-class mean/std/p5/p95 confidence distribution |
|
| 306 |
-
| `model_benchmark.json` | Model parameters, sizes, speed, Top-K, AUC, ECE, TTA metrics |
|
| 307 |
-
| `calibration_data.json` | ECE, bin accuracies/confidences, per-class AUC, Temperature Scaling (T_opt) for calibrated inference |
|
| 308 |
-
| `temperature_config.json` | Temperature Scaling parameters (T, ECE before/after, method) β Guo et al., ICML 2017 |
|
| 309 |
-
| `results/training_curves.png` | Training/validation accuracy and loss curves |
|
| 310 |
-
| `results/confusion_matrix.png` | Confusion matrix on test set |
|
| 311 |
-
| `results/per_class_accuracy.png` | Per-class accuracy bar chart |
|
| 312 |
-
| `results/reliability_diagram.png` | ECE calibration reliability diagram (15 bins) |
|
| 313 |
-
| `results/roc_curves.png` | Per-class ROC curves (One-vs-Rest) |
|
| 314 |
-
| `results/tsne_embedding.png` | t-SNE 2D scatter plot from GeM Pooling features |
|
| 315 |
-
| `results/gradcam_heatmaps.png` | Grad-CAM heatmap visualization per class |
|
| 316 |
-
| `results/confidence_per_class.png` | Per-class confidence distribution bar chart |
|
| 317 |
-
| `results/misclassification_examples.png` | Misclassified test samples |
|
| 318 |
-
| `results/augmentation_examples.png` | Example images after augmentation (training set) |
|
| 319 |
-
| `results/inference_keras.png` | Keras inference grid β 1 sample per class |
|
| 320 |
-
| `results/inference_tflite.png` | TF-Lite inference grid β 1 sample per class |
|
| 321 |
|
| 322 |
## Usage
|
| 323 |
|
|
@@ -497,7 +465,7 @@ The `.keras` files in this repository are flagged **"Unsafe"** by [Protect AI Gu
|
|
| 497 |
- **What the scanner checks:** String-matching of `class_name` fields in the Keras v3 config against a whitelist of built-in Keras layers.
|
| 498 |
- **Why flagged:** The model contains a custom layer (`GeMPooling`) β a non-standard class name triggers the flag.
|
| 499 |
- **What it does NOT check:** The scanner does not analyze the Python code of the custom class, does not look for `eval()`/`exec()`/`os.system()`, and does not detect actual malware.
|
| 500 |
-
- **Other scanners:** VirusTotal
|
| 501 |
|
| 502 |
**The custom classes are safe and open source:**
|
| 503 |
- `GeMPooling` β Generalized Mean Pooling (Radenovic et al., CVPR 2018). Pure tensor ops: `tf.pow`, `tf.reduce_mean`, `tf.maximum`.
|
|
@@ -508,16 +476,16 @@ Full source code for all custom classes is available in [`build_model.py`](https
|
|
| 508 |
|
| 509 |
## Multi-Format Deployment Guide
|
| 510 |
|
| 511 |
-
|
| 512 |
|
| 513 |
| Format | File | Size | Protect AI | Inference Speed | Best For |
|
| 514 |
|--------|------|------|------------|-----------------|----------|
|
| 515 |
-
| **TF-Lite**
|
| 516 |
-
| **SavedModel**
|
| 517 |
-
| **TFJS**
|
| 518 |
-
| **Weights H5**
|
| 519 |
-
| **safetensors**
|
| 520 |
-
| **Build Script**
|
| 521 |
| **Keras** β οΈ | `fine_tuning_swa.keras` | ~227 MB | β οΈ Flagged | 358.0 ms | Developer reference, fine-tuning |
|
| 522 |
|
| 523 |
### Load Examples
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
pipeline_tag: image-classification
|
| 4 |
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
- efficientnetv2
|
|
|
|
|
|
|
| 6 |
- fgic
|
| 7 |
- transfer-learning
|
| 8 |
- gem-pooling
|
| 9 |
- focal-loss
|
|
|
|
| 10 |
- swa
|
| 11 |
- grad-cam
|
| 12 |
- calibration
|
|
|
|
| 13 |
- temperature-scaling
|
| 14 |
+
- computer-vision
|
| 15 |
+
- fgvc
|
| 16 |
library_name: keras
|
| 17 |
language: en
|
| 18 |
datasets:
|
|
|
|
| 277 |
|
| 278 |
## Files
|
| 279 |
|
| 280 |
+
| Category | Files |
|
| 281 |
+
|----------|-------|
|
| 282 |
+
| **Model (best)** | `fine_tuning_swa.keras` (227 MB) Β· `.weights.h5` (158 MB) Β· `.safetensors` (157 MB) |
|
| 283 |
+
| **Code** | `build_model.py` (21 KB) β architecture + CLI inference |
|
| 284 |
+
| **Config** | `config.json` Β· `label_mapping.json` Β· `preprocessor_config.json` |
|
| 285 |
+
| **Evaluation** | `calibration_data.json` Β· `model_benchmark.json` Β· `confusion_pairs.json` Β· `class_confidence_stats.json` Β· `temperature_config.json` |
|
| 286 |
+
| **Deployment** | `saved_model/` (183 MB) Β· `tflite/` (88 MB) Β· `tfjs_model/` (90 MB, 23 shards) |
|
| 287 |
+
| **Results** | `results/` β 12 PNG (training curves, confusion matrix, ROC, t-SNE, Grad-CAM, etc.) |
|
| 288 |
+
| **Archive** | `models_keras/` β 3 checkpoints (head_training, fine_tuning, fine_tuning_ema) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
## Usage
|
| 291 |
|
|
|
|
| 465 |
- **What the scanner checks:** String-matching of `class_name` fields in the Keras v3 config against a whitelist of built-in Keras layers.
|
| 466 |
- **Why flagged:** The model contains a custom layer (`GeMPooling`) β a non-standard class name triggers the flag.
|
| 467 |
- **What it does NOT check:** The scanner does not analyze the Python code of the custom class, does not look for `eval()`/`exec()`/`os.system()`, and does not detect actual malware.
|
| 468 |
+
- **Other scanners:** VirusTotal, JFrog, HF Picklescan β all clean. Only Protect AI flags this file.
|
| 469 |
|
| 470 |
**The custom classes are safe and open source:**
|
| 471 |
- `GeMPooling` β Generalized Mean Pooling (Radenovic et al., CVPR 2018). Pure tensor ops: `tf.pow`, `tf.reduce_mean`, `tf.maximum`.
|
|
|
|
| 476 |
|
| 477 |
## Multi-Format Deployment Guide
|
| 478 |
|
| 479 |
+
With model is provided in multiple formats to suit different deployment scenarios. Formats marked β are **not flagged** by Protect AI (no custom class serialization).
|
| 480 |
|
| 481 |
| Format | File | Size | Protect AI | Inference Speed | Best For |
|
| 482 |
|--------|------|------|------------|-----------------|----------|
|
| 483 |
+
| **TF-Lite** β | `tflite/model.tflite` | ~88 MB | β Safe | **170.0 ms** (fastest) | Mobile, edge, embedded, HF Space |
|
| 484 |
+
| **SavedModel** β | `saved_model/` | ~183 MB | β Safe | β | TensorFlow Serving, cloud backend |
|
| 485 |
+
| **TFJS** β | `tfjs_model/` | ~90 MB | β Safe | β | Browser, Node.js (no backend) |
|
| 486 |
+
| **Weights H5** β | `fine_tuning_swa.weights.h5` | ~158 MB | β Safe | β | Programmatic load via `build_model.py` |
|
| 487 |
+
| **safetensors** β | `fine_tuning_swa.safetensors` | ~157 MB | β Safe | β | HF standard, cross-framework |
|
| 488 |
+
| **Build Script** β | `build_model.py` | ~21 KB | β Safe | β | Architecture reconstruction + `load_weights()` |
|
| 489 |
| **Keras** β οΈ | `fine_tuning_swa.keras` | ~227 MB | β οΈ Flagged | 358.0 ms | Developer reference, fine-tuning |
|
| 490 |
|
| 491 |
### Load Examples
|