pyfishervector
pyfishervector copied to clipboard
ValueError: zero-dimensional arrays cannot be concatenated
Hi,
I'm trying to run the code but I receive the following error:
Traceback (most recent call last):
File "C:\Users\dangz\Documents\Fotolog\Aesthetic\descriptors\fish.py", line 139, in <module>
fisher_features = fisher_features(working_folder, gmm)
File "C:\Users\dangz\Documents\Fotolog\Aesthetic\descriptors\fish.py", line 102, in fisher_features
features = {f : get_fisher_vectors_from_folder(f, gmm) for f in folders}
File "C:\Users\dangz\Documents\Fotolog\Aesthetic\descriptors\fish.py", line 102, in <dictcomp>
features = {f : get_fisher_vectors_from_folder(f, gmm) for f in folders}
File "C:\Users\dangz\Documents\Fotolog\Aesthetic\descriptors\fish.py", line 97, in get_fisher_vectors_from_folder
return np.float32([fisher_vector(image_descriptors(file), *gmm) for file in files])
File "C:\Users\dangz\Documents\Fotolog\Aesthetic\descriptors\fish.py", line 97, in <listcomp>
return np.float32([fisher_vector(image_descriptors(file), *gmm) for file in files])
File "C:\Users\dangz\Documents\Fotolog\Aesthetic\descriptors\fish.py", line 74, in fisher_vector
fv = np.concatenate([np.concatenate(a), np.concatenate(b), np.concatenate(c)])
ValueError: zero-dimensional arrays cannot be concatenated
The error seems to be in line 74:
fv = np.concatenate([np.concatenate(a), np.concatenate(b), np.concatenate(c)])
Also, when I check
a = fisher_vector_weights(s0, s1, s2, means, covs, w, T)
b = fisher_vector_means(s0, s1, s2, means, covs, w, T)
c = fisher_vector_sigma(s0, s1, s2, means, covs, w, T)
the means (b) and sigma (c) fisher vectors are all 0s.
Have you already solve this problem? I meet this problem too。— —!
@dangz90 I have been stuck in this problem for a week, could you please send the right answer to [email protected],if you have solved this problem .Thank you very much.
Putting square brackets around the a
solved the problem for me:
fv = np.concatenate([np.concatenate([a]), np.concatenate(b), np.concatenate(c)])
Hi, I also find the same problem as you did. that is,"the means (b) and sigma (c) fisher vectors are all 0s".May I ask you this result is true or false? Did you use this code finally?Thank you very much
Did this not work for you?
Putting square brackets around the
a
solved the problem for me:fv = np.concatenate([np.concatenate([a]), np.concatenate(b), np.concatenate(c)])
Actually,this part is ok. But I have another problem. when I print means and sigma , "the means (b) and sigma (c) fisher vectors are all 0s",I dont know whether it means a mistake or not.
And, may I ask you whether this code has some requirements of library version?I think this sentence
return map(lambda file: np.load(file), map(lambda s: folder + "/", files))
is wrong ,is it?
Anyway, I just think the code has some [bug.If you use it successfully, can you send me?Thank you very much! E-mai:[email protected]