'Apply Conv3d to regular images

I am wondering if it is possible to apply to tensorflow conv3d layer to an image with 4 channels.

now the shape of the image is (None, None, None, 4) and the conv3d needs 5 dimensions, is there a way to achieve this.

currently I am using the following code

    x = KL.ZeroPadding3D((3, 3,3))(tf.expand_dims(input_image, axis=1))
    x = KL.Conv3D(64, (7, 7,7), strides=(2, 2,2), name='conv1', use_bias=True)(x)
    x = KL.Lambda(lambda x: tf.squeeze(x, axis=1))(x)
    x = BatchNorm(name='bn_conv1')(x, training=train_bn)
    x = KL.Activation('relu')(x)
    C1 = x = KL.MaxPooling2D((3, 3), strides=(2, 2), padding="same")(x)

but it invokes the following error

   1391             ValueError: if a cycle is detected.
   1392         """
-> 1393         node = layer._inbound_nodes[node_index]
   1394 
   1395         # Prevent cycles.

AttributeError: 'NoneType' object has no attribute '_inbound_nodes'

the idea seems feasible, if we suppose that we have a stack of 4 images and each image has one channel



Solution 1:[1]

if you suppose that you have a stack of 4 images and each image has one channel, than the shape of the input would be: (4, width, height, depth, 1)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1