Closed TD-101 closed 7 years ago
@tomdawson91 have you solved it? I had the same problem.
Same issue here! Have anyone solved it?
img0 = np.float32(img0)[:,:,:3]
It works! thanks @dattranx
@dattranx Thanks - as I understand it, this just cuts out the alpha channel
I get an error like: Status(StatusCode=InvalidArgument, Detail="input and filter must have the same depth: 1 vs 3 [[Node: conv2d_1/convolution = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_input_1_0_0, conv2d_1/kernel/read)]]")'
Any thoughts on this? for me it is 1 Vs 3
I have also met the problem and How you resolved it then? Thank you for your reply. @TD-101
@gonzalolc please explain in deep i cannot understood
I am coding Grad-CAM with keras vis I tried seed_input =tf.convert_to_tensor(img[:,:,:3]) seed_input=np.float32(img)[:,:,:3]
InvalidArgumentError Traceback (most recent call last)
The error is because of mismatch in dimensions of the input provided. The model requires a depth of '3' for the input but is given '4'.
whats depth of 3 means
whats depth of 3 means
It means if you are giving an image, it has 3 channels i.e. size of image is (256,256,3)
Yes you have to change the depth.
some one please help
I'm not an expert, but it seems that the 2 source images I'm using don't have the same number of channels. IE, I'm using PNG files and one set of them has a transparent background (Alpha 0) - Wheras the other set of images has colored backgrounds.. Saving both sets of files as JPG images, works around the error. I think because this gets rid of the transparent (alpha) channel. IE, the "shape" of your data needs to be the same.. If you feed a grayscale image into CNN which expects a color image. Find shape of input, e.g. print(model.input.shape) in Keras, you get (None, 224, 224, 3) and your input blob must have a corresponding shape, so having a grayscale image you have to convert it into a color image all three channels need to be the same.
Hi,
I get this error / exception, and while it is being, handled, the same error/exception occurs. I am fairly new to this so it could be a multitude of problems, from the way I have set up python, tf etc, to improper hardware, but I thought I would put it up here in case someone had an easy fix!
Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 965, in _do_call return fn(*args) File "/usr/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 947, in _run_fn status, run_metadata) File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py", line 66, in exit next(self.gen) File "/usr/local/lib/python3.5/site-packages/tensorflow/python/framework/errors.py", line 450, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors.InvalidArgumentError: input and filter must have the same depth: 4 vs 3 [[Node: import/conv2d0_pre_relu/conv = Conv2D[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/cpu:0"](ExpandDims, import/conv2d0_w)]]