close

[Solved] ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)

Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to convert numpy array but I am facing following error ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224) 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.

How ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224) Error Occurs?

I am just trying to convert numpy array but I am facing following error.

ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)  

How To Solve ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224) Error ?

  1. How To Solve ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224) Error ?

    To Solve ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224) Error You need to covert numpy.ndarray to object using astype(object). Something like this.

  2. ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)

    To Solve ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224) Error You need to covert numpy.ndarray to object using astype(object). Something like this.

Solution 1: covert numpy.ndarray to object using astype(object)

You need to covert numpy.ndarray to object using astype(object). Something like this.

a = [np.zeros((224,224,3)).astype(object), np.zeros((224,224,3)).astype(object), np.zeros((224,224,13)).astype(object)]

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