Code Monkey home page Code Monkey logo

Comments (2)

Smirkey avatar Smirkey commented on May 29, 2024 1

Hi !
Thanks for taking the time to look this :) and for the numpy nms function
The discrepancy between the benchmarks in the readme indeed came from the number of trials which were too low in your case (number of cpu cores doesn't matter since neither numpy nor opencv seem to use multithreading here)

I updated your code (thanks again) to plot error bars, and to increase number of trials. I will integrate this in the colab notebook which holds the benchmarks visualizations. Here are the results I obtain on my laptop with a 12th Gen Intel(R) Core(TM) i7-1250U cpu
plot

One thing to note is that powerboxes nms scales particularly badly with the number of boxes compared to opencv, which in turn performs badly on a small number of boxes. The logic in opencv is quite different than what I implemented (actually it's adaptive nms). I will look into it and see if there's a way to take best of both approaches.

from powerboxes.

nexus1203 avatar nexus1203 commented on May 29, 2024 1

You are right about the threading. Numpy version is basically using vectorization to speedup the calculations. In fact, I tried Cython version of the same thing and yet numpy's native python implementation is twice as faster. Using jit (e.g. Jax or Numba) doesn't help either as the code cannot be parallelized efficiently.

As for OpenCV, it does uses adaptive NMS, however, implementation is unclear as I haven't seen the C++ code yet. Another thing is that OpenCV version of the code be further optimized using OPENCL or CUDA acceleration which is such a pain to setup in python.

What you have here (powerboxes) is a very well implemented and very efficient. Especially without threading, the performance is quite amazing.

from powerboxes.

Related Issues (8)

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.