I have an array of size 301 x 4096, for which I want to calculate the VLAD vector.
I tried to do the quantization using
center, assignments = vlfeat.vl_kmeans(data,8)
but this returns
ValueError: too many values to unpack
If I change number of clusters from 8 to 2, it works. I've also tried other numbers, but all of them returned the same ValueError. Except, when setting it to 1, it returns
ValueError: need more than 1 value to unpack
Could it be that it has to do with the number of samples in my data?
The sources of this inofficial Python interface to VLFeat is available on Github.
The
vl_kmeansfunction by default only returns thecenters, so there is only one value to unpack:The resulting
centersarray will have the shape(3, 8), i.e. a 8-dimensional point for each of the 3 centers.If you want to obtain the assignments for each of the inputs, you have to pass the option
quantizeto thevl_kmeansfunction. Then, the function does return bothcentersandassignment, and this works as expected: