Ask Your Question
0

2 questions about PCA

asked 2018-03-21 07:08:06 -0600

Krakada gravatar image

updated 2018-03-21 07:22:25 -0600

Hi,

I have 2 questions concerning the PCA in OpenCV:

  • if the input array is too big to fit in memory, is there a way to pass it incrementally (I mean in several passes)?

  • is the PCA computation performed in parallel on all the available CPUs?

Thanks in advance for your help.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2018-03-21 07:35:13 -0600

berak gravatar image

updated 2018-03-21 07:36:37 -0600

  1. NO. (there are ways to do incremental pca, but opencv does not have it)
  2. partly. (the pca itself is not optimized, but a lot of the used functions, like matrix multiplication/inversion are) also, this depends heavily on what optimizations you enabled, when building the opencv libs, so no general answer possible here.
edit flag offensive delete link more
1

answered 2018-03-21 09:57:45 -0600

Though @berak answer is valid, refer to my answer if

  1. If the memory issue becomes a REAL problem and you are willing to switch over to the OpenCV Python API
  2. Stumbled on this question but are using Python instead of C++

Since images are numpy arrays in OpenCV, you can leverage scikit learn for incremental PCA which allows you to declare your desired batch size. Here's an example of how to use it.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-03-21 07:07:28 -0600

Seen: 190 times

Last updated: Mar 21 '18