Optimise the anonymised livestream pipeline
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python, raspberry-pi
- Domain
- audio-video-rtc, embedded-iot, performance
Research direction
Start with pyro_camera_api/services/anonymizer_rtsp.py and the existing FPSMeter logs. Measure decoder, model and encoder CPU, latency and FPS on a station, then evaluate the listed copy, box-timing, hardware codec and model-input options one at a time. Done means recording before-and-after measurements in the issue and merging useful changes while the stream stays real time with the new model.
Written by the indexing model from the issue text.
Description
Part of pyronear/roadmap#41 (Livestream anonymisation). Independent of the model work.
Context
The blurred livestream (pyro_camera_api/services/anonymizer_rtsp.py) works like this: one ffmpeg decodes the RTSP to raw BGR frames, a thread runs the model on the last frame (BGR to RGB, PIL, letterbox), and an encoder thread copies the last frame, paints the boxes and sends it to a second ffmpeg (x264 to SRT). It works, but it spends CPU on copies and conversions, and the new model may be heavier.
What has to be done
- Measure on a station: CPU per thread, latency, FPS of decoder, model and encoder (
FPSMeterlogs exist). - Fewer copies: give the raw frame to the model directly (NCNN can do BGR to RGB, no PIL), paint the boxes in place, avoid
frame.copy()andtobytes()on every frame. - Box timing: boxes are painted on the current frame, not on the frame they come from. A moving object can show for a few frames. Delay the encoder by one inference, or keep the boxes longer and make them bigger.
- Hardware decode and encode on the Pi (
h264_v4l2m2m), or use a smaller camera substream. - Smaller model input, or run the model one frame out of N.
- Measure again after each change, keep what helps.
Done when
- Before and after measurements are in this issue
- The useful optimisations are merged and the stream stays real time with the new model
- Dominant language
- Python
- Stars
- 21
- Forks
- 10
- Avg merge
- 4d 4h
- Merged PRs (30d)
- 13
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pyronear/pyro-engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pyronear/pyro-engine#368 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
pyronear/pyro-engine#490 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
pyronear/pyro-engine#489 ·
Maintainers usually reply within 1 day
-
module: vision type: enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
pyronear/pyro-engine#466 ·
Maintainers usually reply within 1 day
-
module: vision type: enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
pyronear/pyro-engine#465 ·
Maintainers usually reply within 1 day
All issues in pyronear/pyro-engine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
software-mansion-labs/Diplomat#20 ·
Maintainers usually reply within 1 day
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
View Counts discarded due to field name mismatchPossibly taken @rsiva0400 claimed this today. Opensite-bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Model version publishes the new UK firm entity as a personPossibly taken @vahid-ahmadi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/policyengine.py#764 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
spcl/HPCAgent-Bench#264 ·
Maintainers usually reply within 1 day