Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: zero-dimensional arrays cannot be concatenated #6

Open
dangz90 opened this issue Oct 19, 2017 · 6 comments
Open

ValueError: zero-dimensional arrays cannot be concatenated #6

dangz90 opened this issue Oct 19, 2017 · 6 comments

Comments

@dangz90
Copy link

dangz90 commented Oct 19, 2017

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.

@YeRen123455
Copy link

Have you already solve this problem? I meet this problem too。— —!

@YeRen123455
Copy link

@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.

@soominkang
Copy link

soominkang commented Jun 15, 2018

Putting square brackets around the a solved the problem for me:
fv = np.concatenate([np.concatenate([a]), np.concatenate(b), np.concatenate(c)])

@a2322522167
Copy link

a2322522167 commented Jun 6, 2019

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

@soominkang
Copy link

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)])

@a2322522167
Copy link

a2322522167 commented Jun 6, 2019

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants