license: mit
pipeline_tag: image-classification
tags:
- onnx
- onnxruntime
- image-classification
- binary-classification
library_name: onnx
cstria0106/shit-detector
ONNX image classifier for detecting whether an image contains feces or toilet waste/staining under this project's labeling policy.
Try It In Your Browser
Live browser demo: https://huggingface.co/spaces/cstria0106/shit-detector-browser
Runs fully client-side: the demo downloads this ONNX model in the browser and runs inference locally with ONNX Runtime Web.
Files
shit_detector.onnx: ONNX model exported with dynamic batch axis.metadata.json: preprocessing values, threshold, class names, evaluation metrics, and deployment notes.inference.py: minimal ONNX Runtime inference helper.requirements.txt: runtime dependencies for the helper.
Labels
Class order: ['shit', 'not_shit'].
The positive class is shit. The default decision threshold is 0.149 on the positive-class probability.
Dataset
The model was trained on a project-specific binary image dataset.
| Split | shit | not_shit |
|---|---|---|
| Train | 483 | 2,894 |
| Validation | 120 | 686 |
| Test | 189 | 1,003 |
Training
- Objective: 2-class cross entropy
- Optimizer: AdamW
- Learning rate:
1.5e-4 - Weight decay:
0.01 - Epochs: up to 80
- Best checkpoint selected by validation F1
- Backbone frozen for first 5 epochs, then unfrozen
- Balanced sampling enabled with positive sampling fraction
0.40 - Augmentation: random resized crop, horizontal flip, color jitter
- Positive-only color augmentation was used to improve robustness to color-shifted positive examples.
Model Specs
- Base model:
tf_efficientnet_b0.ns_jft_in1k - Format: ONNX, opset
17 - Input size:
256 x 256RGB image - Parameters:
4010110 - ONNX size:
15.34 MB - Class order:
['shit', 'not_shit'] - Positive threshold:
0.149
Evaluation Snapshot
- Precision: 93.51%
- Recall: 91.53%
- F1: 92.51%
- ROC-AUC: 99.09%
- PR-AUC: 97.42%
These metrics come from the local evaluation set recorded in metadata.json; they are not a public benchmark.
Intended Use
This model is intended for project-specific binary image triage. It may produce false positives on visually similar brown food, stains, mud, and other hard negatives, and false negatives on small, occluded, color-shifted, or unusual positive cases.
Runtime
pip install -r requirements.txt
python inference.py path/to/image.jpg
Deployment Target
- Target:
lattepanda_n4120 - CPU:
Intel Celeron N4120 - Model parameters:
4010110 - ONNX size MB:
15.341004371643066