Ghadhul Bashar Vision ONNX (gb-head-modesty-v1)

Compact multi-task face, age-exemption, hijab/niqab modesty, and visual-domain router built for 100% on-device WebGPU & WASM SIMD inference inside ridloabelian/ghadhul-bashar and ridloabelian/ghadhul-bashar-architecture.

Try it live: ridloabelian/ghadhul-bashar-vision-demo runs this model entirely in your browser (ONNX Runtime Web, WASM) and verifies the weights' SHA-256 before use.

Why This Model Exists

Legacy gaze-protection cascades rely on separate upstream models for age/gender estimation (Intel AGR0013, 4.29 MB) and color heuristics, which cannot distinguish hijab/niqab-covered heads from uncovered hair and require separate domain routing for anime/manga vs UI diagrams.

gb-head-modesty-v1 unifies 5 inference outputs into a single mobilenetv4_conv_small.e2400_r224_in1k forward pass (160x160 RGB input with ImageNet normalization baked directly into the ONNX graph):

  1. age_years ([B, 1]): continuous estimated age (0–95 years).
  2. child_logit ([B, 1]): dedicated < 10 years exemption head (logit).
  3. gender_logits ([B, 2]): male, female.
  4. head_modesty_logits ([B, 3]): hijab_niqab_covered, hair_uncovered, male_head.
  5. domain_logits ([B, 4]): real_photo, anime_illustration, bw_manga, ui_non_human.

Evaluated Benchmarks (Held-Out Validation Β· 2026-12-02T21:42:43Z)

Measured directly from exported ONNX models via onnxruntime (CPUExecutionProvider):

File Precision Size Modesty F1 Gender F1 Child <10y F1 Age MAE Domain F1 P50 Latency P95 Latency
onnx/gb-head-modesty-v1-fp32.onnx FP32 10.78 MB 0.9204 0.9295 0.8086 6.51 y 0.9987 2.55 ms 3.14 ms
onnx/gb-head-modesty-v1-fp16.onnx FP16 5.42 MB 0.9207 0.9301 0.8094 6.51 y 0.9987 3.77 ms 4.55 ms
onnx/gb-head-modesty-v1-int8.onnx INT8 2.84 MB 0.7768 0.7393 0.6349 10.35 y 0.7979 2.62 ms 2.85 ms

PyTorch vs FP32 ONNX max output delta: 4.58e-05

Ethical Training & Zero-Explicit-Content Guarantee

gb-head-modesty-v1 was trained 100% on clean, non-explicit public datasets and procedural UI/screentone frames β€” zero explicit or adult imagery was collected, annotated, or processed during dataset preparation or training:

  • HuggingFaceM4/FairFace (cc-by-4.0): race-balanced portraits with age buckets (0-2, 3-9 for exact < 10y supervision) and binary gender.
  • mlnomad/imnet1k_abaya: real full-color RGB abaya/hijab/niqab ImageNet class photos audited with zero-shot SigLIP filtering to retain human portraits and reject non-portrait garment shots.
  • Thunderbeast/anime-faces (cc0-1.0): clean anime face domain supervision.
  • MichaelP84/manga-colorization-dataset: monochrome manga panels strictly filtered via title/tag SFW blocklist prior to image decoding.
  • Procedural UI Frames: deterministic code editors, telemetry dashboards, data tables, and doc banners for ui_non_human.

Dataset Audit & Curation

  • Train / Validation rows: 28195 train / 4397 validation
  • Modesty pseudo-label verifier: google/siglip-base-patch16-224
  • Hijab portrait curation: kept 1192 verified portraits, filtered 158 non-portrait/ambiguous images
  • Ambiguous FairFace headcrops masked (IGNORE_INDEX=-100): 18

Model Artifacts & Checksums

Artifact Size SHA-256 Prefix
gb-head-modesty-v1.safetensors 10.91 MB 2b180783d2b19782...
onnx/gb-head-modesty-v1-fp32.onnx 10.78 MB be25821e53071738...
onnx/gb-head-modesty-v1-fp16.onnx 5.42 MB 46efbf4675db8157...
onnx/gb-head-modesty-v1-int8.onnx 2.84 MB 414663703a602e31...

Quick Usage (Python onnxruntime)

Inputs are float32[batch, 3, 160, 160] RGB normalized only to [0.0, 1.0] (ImageNet mean/std scaling is fused inside the ONNX graph).

import json
import numpy as np
import onnxruntime as ort
from PIL import Image

cfg = json.loads(open("config.json", encoding="utf-8").read())
sess = ort.InferenceSession("onnx/gb-head-modesty-v1-int8.onnx", providers=["CPUExecutionProvider"])

img = Image.open("face_crop.jpg").convert("RGB").resize((160, 160))
x = np.transpose(np.asarray(img, dtype=np.float32) / 255.0, (2, 0, 1))[None, ...]

age_years, child_logit, gender_logits, modesty_logits, domain_logits = sess.run(
    cfg["output_names"], {cfg["input_name"]: x}
)
print("Age:", float(age_years[0, 0]), "Child prob:", 1.0 / (1.0 + np.exp(-float(child_logit[0, 0]))))

Quick Usage (Browser onnxruntime-web Β· WebGPU / WASM)

import * as ort from "onnxruntime-web";

const session = await ort.InferenceSession.create("./onnx/gb-head-modesty-v1-fp16.onnx", {
  executionProviders: ["webgpu", "wasm"],
});
const tensor = new ort.Tensor("float32", nchwFloat01Buffer, [1, 3, 160, 160]);
const results = await session.run({ pixel_values: tensor });
// results.age_years, results.child_logit, results.gender_logits, results.head_modesty_logits, results.domain_logits

License

Weights, configuration, and training pipeline are released under Apache-2.0. Upstream datasets retain their respective licenses (CC-BY-4.0, CC0-1.0).

Downloads last month
29
Safetensors
Model size
2.85M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Datasets used to train ridloabelian/ghadhul-bashar-vision-onnx

Spaces using ridloabelian/ghadhul-bashar-vision-onnx 2

Collections including ridloabelian/ghadhul-bashar-vision-onnx

Article mentioning ridloabelian/ghadhul-bashar-vision-onnx