Giter Site home page Giter Site logo

CPU not fully utilized about dashcamcleaner HOT 4 OPEN

tfaehse avatar tfaehse commented on June 14, 2024
CPU not fully utilized

from dashcamcleaner.

Comments (4)

tfaehse avatar tfaehse commented on June 14, 2024

Lots of bottlenecks unfortunately. Detection can run in almost any batch size, especially on GPUs the higher the better. But there's two issues with that, you need quite a bit of memory and frames need to arrive quickly enough. So far, that's not really given.

I've tried offloading reading and writing frames to separate processes, but surprisingly that didn't help much - the additional overhead, at least on my system, ate the gains from parallelisation. So far, the best approach I could find was to massively speed up reading/writing frames. #32 contains a very much WIP draft, but the performance improvements are already quite large.
Basically, it makes sure that extracting frames, reading frames and detection (given a high enough batch size) all attempt to saturate the given resources. As long as each of the steps use near 100% of your CPU, it doesn't matter if they're properly pipelined or not. So far, that has lead to really nice results on my laptop at least - up to 20fps for inference at 360p, with small weights. Maybe not the most realistic workload, but it's my default test case...

I still have to fix a lot of things there though, and check how this works when using a GPU.

TL;DR: Increasing the batch size and improving frame extraction should help.

from dashcamcleaner.

joshinils avatar joshinils commented on June 14, 2024

hm, I found when using CPU that increasing batchsize does not really help, rather the opposite.

with batch_size==5:
image
the dips are where the progress-bar updates, so when the batch of frames is saved and the next are loaded...
so even then the detection does not use more cpu% :-/

from dashcamcleaner.

joshinils avatar joshinils commented on June 14, 2024

almost makes me think having two batches run detections in parallel would be beneficial, however weird that may sound.
since one batch of detections does not utilize the cpu well.

from dashcamcleaner.

tfaehse avatar tfaehse commented on June 14, 2024

Hmm.. it's not perfect for me, but much better. batch size 16:
image

I'll do some profiling soon.

from dashcamcleaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.