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: cannot reshape array of size 8192000 into shape (1600,1280,3) #13

Open
justnealpatel opened this issue Jan 20, 2021 · 1 comment

Comments

@justnealpatel
Copy link

justnealpatel commented Jan 20, 2021

This error is coming from

def load_image_into_numpy_array(image):
    (im_width, im_height) = image.size
    return np.array(image.getdata()).reshape(
        (im_height, im_width, 3)).astype(np.uint8)

The image size in question is 1600 x 1280. The original shape is (1600, 1280, 4) which is why it's unable to go from 4 to 3. The other dimensions would also need changing.

I'm still getting introduced to this side of development so this is all fairly new to me. Any advice is appreciated!

I am using these versions:

  • Tensorflow: 2.4.0 (had to install this due to pip not finding the 2.0.1 version)
  • Pillow: 8.1.0
  • Numpy: 1.19.5
  • macos: 10.15.6
@justnealpatel justnealpatel changed the title ValueError: cannot reshape array of size 9946800 into shape (540,383,3) ValueError: cannot reshape array of size 8192000 into shape (1600,1280,3) Jan 20, 2021
@justnealpatel
Copy link
Author

I'm wondering if there's a better mathematical approach we can use to make sure that the array size will always equal the shape.

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

1 participant