File size: 2,819 Bytes
c2d0005
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0f436ce
 
 
 
 
 
 
c2d0005
 
 
 
 
 
 
 
 
 
 
 
 
0e93a3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98d23b3
 
 
 
 
 
 
 
 
 
c2d0005
 
165e291
 
 
c2d0005
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---

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](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 256` RGB 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

```bash

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`