0xgr3y commited on
Commit
208c1f1
Β·
verified Β·
1 Parent(s): bdc11b4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -51
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
- | File | Description |
289
- |------|-------------|
290
- | `fine_tuning_swa.keras` | Best model β€” SWA averaged weights (226.75 MB) |
291
- | `fine_tuning_swa.weights.h5` | Best model weights β€” clean, no ProtectAI flag (158.31 MB) |
292
- | `fine_tuning_swa.safetensors` | Best model weights β€” HF standard, cross-framework (157.10 MB) |
293
- | `build_model.py` | Architecture reconstruction + CLI inference (20.7 KB) |
294
- | `head_training.keras` | Phase 1 checkpoint |
295
- | `fine_tuning.keras` | Phase 2 checkpoint |
296
- | `fine_tuning_ema.keras` | Phase 2 EMA checkpoint |
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 βœ…, JFrog βœ…, HF Picklescan βœ… β€” all clean. Only Protect AI flags this file.
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
- This model is provided in multiple formats to suit different deployment scenarios. Formats marked βœ… are **not flagged** by Protect AI (no custom class serialization).
512
 
513
  | Format | File | Size | Protect AI | Inference Speed | Best For |
514
  |--------|------|------|------------|-----------------|----------|
515
- | **TF-Lite** βœ… | `tflite/model.tflite` | ~88 MB | βœ… Safe | **170.0 ms** (fastest) | Mobile, edge, embedded, HF Space |
516
- | **SavedModel** βœ… | `saved_model/` | ~183 MB | βœ… Safe | β€” | TensorFlow Serving, cloud backend |
517
- | **TFJS** βœ… | `tfjs_model/` | ~90 MB | βœ… Safe | β€” | Browser, Node.js (no backend) |
518
- | **Weights H5** βœ… | `fine_tuning_swa.weights.h5` | ~158 MB | βœ… Safe | β€” | Programmatic load via `build_model.py` |
519
- | **safetensors** βœ… | `fine_tuning_swa.safetensors` | ~157 MB | βœ… Safe | β€” | HF standard, cross-framework |
520
- | **Build Script** βœ… | `build_model.py` | ~21 KB | βœ… Safe | β€” | Architecture reconstruction + `load_weights()` |
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