face-frontalization icon indicating copy to clipboard operation
face-frontalization copied to clipboard

ValueError: array is not broadcastable to correct shape!

Open getengqing opened this issue 8 years ago • 11 comments

Hello, I got the error:

frontal_raw[ind_frontal, :] = cv2.remap(img, temp_proj2[0, :].astype('float32'), temp_proj2[1, :].astype('float32'), cv2.INTER_CUBIC) ValueError: array is not broadcastable to correct shape

what's the error?How can i sovle?

getengqing avatar May 10 '16 08:05 getengqing

Hi @getengqing,

Could you give more details about the error? How are you reading the image? Is it a RGB image? Are having this issue with one image in particular?

dougsouza avatar May 11 '16 14:05 dougsouza

I run your demo.py , I have no anyway change to your program. Then got the error!

getengqing avatar May 12 '16 01:05 getengqing

That's odd. Which version of OpenCV are you using?

dougsouza avatar May 12 '16 01:05 dougsouza

Hi, I've got the same error. OpenCV version is 2.4.8

Traceback (most recent call last): File "/usr/lib/pycharm/helpers/pydev/pydevd.py", line 1531, in globals = debugger.run(setup['file'], None, None, is_module) File "/usr/lib/pycharm/helpers/pydev/pydevd.py", line 938, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/boss/face-frontalization/demo.py", line 48, in demo() File "/home/boss/face-frontalization/demo.py", line 37, in demo frontal_raw, frontal_sym = frontalize.frontalize(img, proj_matrix, model3D.ref_U, eyemask) File "/home/boss/face-frontalization/frontalize.py", line 57, in frontalize frontal_raw[ind_frontal, :] = cv2.remap(img, temp_proj2[0, :].astype('float32'), temp_proj2[1, :].astype('float32'), cv2.INTER_CUBIC) ValueError: array is not broadcastable to correct shape

181066 avatar May 26 '16 14:05 181066

@181066,

Could you give more details about the input image? It would be great if could share the image itself

dougsouza avatar May 27 '16 00:05 dougsouza

The input image is the one from your demo - test.jpg I just run your code without changes. Well, initially I tried to use my image that was looking much more difficult for frontalization. It didn't find facial points and failed. Ok then I just decided to check your demo and got that error.

Thank you.

181066 avatar May 27 '16 19:05 181066

Try upgrading your numpy version

dougsouza avatar May 30 '16 19:05 dougsouza

I have the latest numpy 1.8.2 for ubuntu 14.04.

181066 avatar Jun 02 '16 14:06 181066

@181066, this is the not last version, I am using 1.10.4 on ubuntu 14.04, for example.

PS.: I am using the Anaconda python distribution.

dougsouza avatar Jun 02 '16 16:06 dougsouza

Thanks a lot. Works fine with Anaconda.

181066 avatar Jun 03 '16 07:06 181066

I also meet this problem and my numpy version is also 1.8.2. I just use sudo pip install --upgrade numpy to get latest numpy 1.13.1, and this problem can be solved.

zhanlv600 avatar Aug 18 '17 10:08 zhanlv600