frigate icon indicating copy to clipboard operation
frigate copied to clipboard

optimize output_frame_resize

Open skrashevich opened this issue 1 year ago • 16 comments

#6853

skrashevich avatar Jun 26 '23 02:06 skrashevich

Deploy Preview for frigate-docs canceled.

Name Link
Latest commit ebcdb63aac21b1be627b5338a0576553f426268e
Latest deploy log https://app.netlify.com/sites/frigate-docs/deploys/6563d8d74fee5d0008eed1f6

netlify[bot] avatar Jun 26 '23 02:06 netlify[bot]

I have ~x2 performance improvement with this modifications

skrashevich avatar Jun 26 '23 03:06 skrashevich

I have ~x2 performance improvement with this modifications

to be clear, that means ~ one half CPU usage? I'll try this in the morning and see how it goes in my setup

NickM-27 avatar Jun 26 '23 03:06 NickM-27

to be clear, that means ~ one half CPU usage? I'll try this in the morning and see how it goes in my setup

that means ~25% CPU utilisation by frigate.output process before, and ~12% after

in the morning

so relative... :-)

skrashevich avatar Jun 26 '23 03:06 skrashevich

So I ended up trying this now, wanted to clarify the above because I think https://github.com/blakeblackshear/frigate/issues/6853 got steered into the direction of the motion detection CPU usage which is separate from frigate.output. My motion detection CPU usage is unaffected by this PR.

In any case, this PR brought the frigate.output CPU usage in my setup from 20% of to 13% in top. I am just wondering if the openblas changes have affect that at all or if it is just the other changes, in which case maybe the openblas changes aren't needed?

NickM-27 avatar Jun 26 '23 03:06 NickM-27

My motion detection CPU usage is unaffected by this PR.

test within latest commit (7ee53df)

skrashevich avatar Jun 26 '23 04:06 skrashevich

maybe the openblas changes aren't needed?

Given in mind my mistake in pushed Dockerfile (openblas and env vars were installed only in wheels step, but not in the final step) and your feedback on performance improvements - apparently, openblas does not significantly affect the result :)

skrashevich avatar Jun 26 '23 06:06 skrashevich

My motion detection CPU usage is unaffected by this PR.

test within latest commit (7ee53df)

This has caused my CPU usage to go up for each camera detect process by ~ 2 - 3 %

NickM-27 avatar Jun 26 '23 12:06 NickM-27

Might be better for this PR to keep things focused on the frame_resize improvements which reduced CPU usage by frigate.output and potentially work on other changes in a separate PR

NickM-27 avatar Jun 26 '23 12:06 NickM-27

Might be better for this PR to keep things focused on the frame_resize improvements which reduced CPU usage by frigate.output and potentially work on other changes in a separate PR

You suggest rollback this PR to 4f9cf22, and move other commits to separate PR?

skrashevich avatar Jun 26 '23 12:06 skrashevich

Might be better for this PR to keep things focused on the frame_resize improvements which reduced CPU usage by frigate.output and potentially work on other changes in a separate PR

You suggest rollback this PR to 4f9cf22, and move other commits to separate PR?

Based on previous conversation I would also suggest removing openblas, but yeah I think it makes sense to keep it separate since the frigate.output is separate from the motion detector

NickM-27 avatar Jun 26 '23 13:06 NickM-27

Might be better for this PR to keep things focused on the frame_resize improvements which reduced CPU usage by frigate.output and potentially work on other changes in a separate PR

You suggest rollback this PR to 4f9cf22, and move other commits to separate PR?

Based on previous conversation I would also suggest removing openblas, but yeah I think it makes sense to keep it separate since the frigate.output is separate from the motion detector

What do you think about create configuration option for interpolation algorithm, used in internal calculations?

skrashevich avatar Jun 26 '23 13:06 skrashevich

I think it is too advanced for most users to understand / our docs to explain which one to use. I'm also not sure in which cases a user would want to change that

NickM-27 avatar Jun 26 '23 13:06 NickM-27

this decreased my output process CPU usage by at least half its previous usage. good work!

ccutrer avatar Jun 26 '23 17:06 ccutrer

@blakeblackshear this PR is related to #6986 I didn't test them separately

skrashevich avatar Jul 06 '23 13:07 skrashevich

up?

skrashevich avatar Nov 27 '23 01:11 skrashevich