Randy Calatayud
Randy Calatayud

Reputation: 11

Is there any other function similar to slic() function of python?

I am working on a project about applying the method of superpixels in python. I used the slic() function, but because the images are very big, the program takes SEVERAL MINUTES to run all the code. I noted that that slic() function just uses 1 CPU. When I used MATLAB to do the same that I do in python, I use the function called superpixels() and that function uses all the resources of my computers (GPU also), so that means that it takes FEW SECONDS to run all the code.

So, I would like to know how can I improve that slic() function of python in order to make it faster. Where can I get the codes of the slic() function?

Or maybe I was making something wrong?

Upvotes: 1

Views: 315

Answers (1)

AntiMatterDynamite
AntiMatterDynamite

Reputation: 1512

well i don't have a solution but i do have a few suggestions:

  1. if you really want to see the code for the function it can be found here in the git-hub repository. but you should probably look at other implementations that already do this algorithm in parallel since converting the single threaded one to be parallel would probably take more time than translating an existing algorithm from another language to python
  2. alternatively you can take an implementation in c/c++ and just write a wrapping module for it to use in python.
  3. no matter what pure python would always run slower so even if you decide to write your own implementation you should do it with cython

Upvotes: 0

Related Questions