Downloads · 30 days
16
52% of all-time downloads
mlboydaisuke/nsfw-image-detection-ExecuTorch
nsfw-image-detection-ExecuTorch is a image classification model from mlboydaisuke. Use it when you need a label for an image. The card lists the license as apache-2.0.
A two-class image classifier: normal or nsfw. For filtering, moderation or parental controls that run on the phone, where sending the photograph to a server is the thing you were trying to avoid.
Downloads · 30 days
16
52% of all-time downloads
All-time downloads
31
Public
Repo size
777 MB
Likes
0
Public
Click a slice to open those files.
.pte777 MB · 100%
From the Hugging Face model README
A two-class image classifier: normal or nsfw. For filtering, moderation or parental controls that run on the phone, where sending the photograph to a server is the thing you were trying to avoid.
pixel_values [1, 3, 224, 224] fp32 — RGB image resized to 224x224, scaled to [0,1], then normalised with mean=(0.5, 0.5, 0.5) std=(0.5, 0.5, 0.5)| build | file | size (MB) | Mac median (ms)* | labels kept | margin shift at the boundary (logits) |
|---|---|---|---|---|---|
| fp32 | imgcls_nsfw_xnnpack_fp32.pte | 343.4 | 41.8 | 24 of 24 | 0.0001 |
| fp16 | imgcls_nsfw_xnnpack_fp16.pte | 173.1 | 71.4 | 24 of 24 | 0.0168 |
| int8 (dynamic) | imgcls_nsfw_xnnpack_int8.pte | 88.9 | 31.5 | 24 of 24 | 1.4795 |
| Core ML (fp16, iOS) | imgcls_nsfw_coreml_all.pte | 172.1 | 4.3 | 24 of 24 | 0.2215 |
*Mac arm64, single process, median of 10. PyTorch eager fp32 on the same machine is 38.3 ms, so the Core ML build is 8.9x eager and the int8 build is the fastest portable one. fp16 is slower than fp32 here — XNNPACK emulates it — and is listed only because it halves the file.
Label agreement on ordinary photographs is free: the fp32 model calls all
24 of them normal at probability 1.000, and every build reproduces that to 0.0000.
Correlation says 1.000000 for all four. None of that separates a good quantized build from
one that only errs near the decision boundary — and the boundary is the only place the error
changes an answer.
So each photograph is also walked along the gradient of the class margin until the margin crosses zero, bisected onto it, and the builds compared there. The number in the last column is how far the margin moves at that point. It answers the question a caller has: how confident does fp32 have to be before this build is guaranteed to agree with it?
Measured on this set, the closest photograph sits 7.88 logits from the decision, median 8.90. Every build's shift is smaller than that, so none of them could relabel any of these images — but the margin between them is real and only this test shows it.
The boundary inputs are perturbed photographs, not natural ones. They exercise the arithmetic where it decides something; they are not a claim about accuracy on real data.
Every calibration photograph on this shelf is normal, and none were fetched for the other
class. So what is verified is fidelity to the fp32 model, not the model's own accuracy
on the class it was trained to find. If that matters for your use, evaluate the upstream
model on your own data first; these files reproduce whatever it does.
python convert/export_imgcls.py nsfw
python convert/check_imgcls.py nsfw int8
(conversion scripts: executorch-models)