0
votes

I am trying to run this repository. And, trying to test with my own data. While I was trying to do it, I am getting this error:

Traceback (most recent call last): File "test.py", line 34, in outputs = predict(model, inputs) File "/home/kbdp5524/Downloads/DenseDepth-master/utils.py", line 12, in predict predictions = model.predict(images, batch_size=batch_size) File "/home/kbdp5524/anaconda3/envs/densedepth/lib/python3.7/site-packages/keras/engine/training.py", line 1441, in predict x, _, _ = self._standardize_user_data(x) File "/home/kbdp5524/anaconda3/envs/densedepth/lib/python3.7/site-packages/keras/engine/training.py", line 579, in _standardize_user_data exception_prefix='input') File "/home/kbdp5524/anaconda3/envs/densedepth/lib/python3.7/site-packages/keras/engine/training_utils.py", line 145, in standardize_input_data str(data_shape))

ValueError: Error when checking input: expected input_1 to have shape (None, None, 3) but got array with shape (480, 640, 4)

This is the test.py and train.py code

Can anyone please help me through this. I am new to coding :)

1
You're feeding an RGBA image (4 channels), the network expects just 3. Convert the image to RGB (and make sure there are no other preprocessing operations you need to do) before feeding it to the networkGPhilo
Thank you :) Also, what does (None, None) mean?user12885009
None in a shape means any shape is allowed there. In this case, your net accepts as input images of any width/heightGPhilo

1 Answers

0
votes

Your input image have shape (None, None, 4) a RGBA image but model want a 3 channel image mean (None, None, 3) RGB. So you have to convert yout image to 3 channel . You can do that using OpenCV function cv2.cvtColor(Image, cv2.COLOR_RGBA2RGB ).

To install openCV : pip install python-opencv