DenisTome / Lifting-from-the-Deep-release

Implementation of "Lifting from the Deep: Convolutional 3D Pose Estimation from a Single Image"
https://denistome.github.io/papers/lifting-from-the-deep
GNU General Public License v3.0
450 stars 133 forks source link

ValueError: cannot reshape array of size 0 into shape (0,newaxis,2) #37

Closed MritulaC closed 5 years ago

MritulaC commented 5 years ago

in normalise_data d2 = d2.reshape(d2.shape[0], -1, 2).transpose(0, 2, 1) ValueError: cannot reshape array of size 0 into shape (0,newaxis,2)

Hi, I am getting the above error when giving a jpeg image for reconstruction. How am I to overcome this error?# Thanks, Mritula

DenisTome commented 5 years ago

That means that for that specific frame there are no predictions. Probably, by playing with /packages/lifting/utils/config.py VISIBLE_PART, you can find a threshold that is better for your specific images.

MritulaC commented 5 years ago

How to determine the maximum and minimum values for Visible part? I have given 1e-10 and 1e-20, and still the same error.

DenisTome commented 5 years ago

Okay that is weird. Just to be sure about it, what happens if you check the content of d2?

The way it's working right now is to have the mean(heatmap) > VISIBLE_PART https://github.com/DenisTome/Lifting-from-the-Deep-release/blob/d4f8a10a7d6887d83721cd2b24edb05056bb8a68/packages/lifting/utils/process.py#L125

you could change that to max(heatmap).

MritulaC commented 5 years ago

Thanks, I will check it and update you.

MritulaC commented 5 years ago

I did try but still, the same problem exists

DenisTome commented 5 years ago

so, what's the content of the variable part_hmap?

MritulaC commented 5 years ago

I have given print statement for part_hmap output, but the program is not priniting out the value for oid, (yc, xc) in enumerate(centers): part_hmap = skimage.transform.resize( .......... print(part_hmap)

not sure why :-(

DenisTome commented 5 years ago

the reason it's not printing anything is probably because it's empty. One thing you can do is to say:

if len(centers) < 1:

skip to next frame

return None, None, None
MritulaC commented 5 years ago

I did that and i got the following ValueError: too many values to unpack (expected 2)

len(centers) is 0.

manjuj123 commented 5 years ago

Hi, When I run this code, I am also getting ValueError: cannot reshape array of size 0 into shape (0,newaxis,2).

The png file I am using was created using an iOS app. This app creates an image of myself as JPEG. I converted it to a png file using Preview Export option. The program works with the test_image.png.

Can you help me understand what is it that I am missing?

DenisTome commented 5 years ago

I've updated the code to catch that error. However in order to fix that, you need to try to change the packages/lifting/utils/config.py file, specifically CENTER_TR.

manjuj123 commented 5 years ago

Thanks Denis. What do you suggest I change the CENTER_TR to from 0.4? Why do you suggest that I change it?

manjuj123 commented 5 years ago

After changing the CENTER_TR to 0.2, I did manage to go past this error and get the output generated. Thanks.

DenisTome commented 5 years ago

Perfect. Yeah, at the end there are 2 thresholds controlling everything and by adjusting them you can control the visibility.

MritulaC commented 5 years ago

Thanks, I will try the same and update.