Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ Against ~239 ms of inference, the difference is noise.
## Reproduce

```bash
python scripts/bench_decode.py # decode comparison
pip install psutil matplotlib # bench/plot tools, not runtime deps
python scripts/bench_gifs.py --procs "1" --duration 30 # single-worker profile -> bench_results.jsonl
python scripts/bench_decode.py # decode comparison
python scripts/plot_results.py bench_results.jsonl # regenerate the charts in media/
```

## Results log
Expand Down
Binary file modified media/perf_latency.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/perf_stages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "pyframe-gif-video-image-moderation"
version = "0.2.0"
version = "0.3.0"
description = "Two-stage NSFW moderation for GIFs, videos, and images via local HuggingFace models and/or AWS Rekognition."
readme = "README.md"
requires-python = ">=3.10"
Expand Down
4 changes: 2 additions & 2 deletions scripts/bench_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Micro-benchmark: cv2 file-path decode vs in-memory Pillow decode (the scan_bytes path).

Shows the per-GIF decode cost of each, so you can see the millisecond delta against
the ~789 ms ViT inference that dominates total time.
the ViT inference that dominates total time (~91% of wall-clock; see docs/performance.md).

python scripts/bench_decode.py [path/to.gif] # synthesizes one if omitted
"""
Expand Down Expand Up @@ -52,4 +52,4 @@ def synth(path, n=60, w=320):
print(f" cv2 file-path decode: median {c:6.1f} ms")
print(f" in-memory bytes decode: median {m:6.1f} ms")
delta = m - c
print(f" delta: {delta:+.1f} ms ({delta / c * 100:+.0f}%) -- vs ~789 ms ViT inference, this is noise")
print(f" delta: {delta:+.1f} ms ({delta / c * 100:+.0f}%) -- vs the ViT inference (~91% of total), this is noise")
Loading
Loading