Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error **ValueError: cannot reshape array of size 50176 into shape (1,224,224,3)** **in python**. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

Table of Contents

## How ValueError: cannot reshape array of size 50176 into shape (1,224,224,3) Error Occurs?

Today I get the following error **ValueError: cannot reshape array of size 50176 into shape (1,224,224,3)** **in python**.

## How To Solve ValueError: cannot reshape array of size 50176 into shape (1,224,224,3) Error ?

**How To Solve ValueError: cannot reshape array of size 50176 into shape (1,224,224,3) Error ?**To Solve ValueError: cannot reshape array of size 50176 into shape (1,224,224,3) Error Seems your input is of size

`[224, 224, 1]`

instead of`[224, 224, 3]`

. Looks like you converting your inputs to`gray scale`

in`process_test_data()`

**ValueError: cannot reshape array of size 50176 into shape (1,224,224,3)**To Solve ValueError: cannot reshape array of size 50176 into shape (1,224,224,3) Error Seems your input is of size

`[224, 224, 1]`

instead of`[224, 224, 3]`

. Looks like you converting your inputs to`gray scale`

in`process_test_data()`

## Solution 1

Seems your input is of size `[224, 224, 1]`

instead of `[224, 224, 3]`

. Looks like you converting your inputs to `gray scale`

in `process_test_data()`

you may need to change:

img = cv2.imread(path,cv2.IMREAD_GRAYSCALE) img = cv2.resize(img,(IMG_SIZ,IMG_SIZ))

to:

img = cv2.imread(path) img = cv2.resize(img,(IMG_SIZ,IMG_SIZ),3)

## Solution 2

In my case function was expecting `RGB`

image and it has failed cause it was `RGBA`

one what automatically means it’s got 4 channels instead of 3. so I’ve refurbished their function in order to be able to swallow RGBA

def load_image_into_numpy_array(image): (im_width, im_height) = image.size if image.getdata().mode == "RGBA": image = image.convert('RGB') np_array = np.array(image.getdata()) reshaped = np_array.reshape((im_height, im_width, 3)) return reshaped.astype(np.uint8)

**Summery**

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

**Also, Read**