Keras Deep learning extension - axes dont match array

I don’t have a coding background.
I have been trying to train the deep learning algorithm KNIME > Examples> 04 Analytics>14 deep learning> 02 keras > 04 cats and dogs>02 train simple CNN.

when I train the DL python network learner to train the classification layer
I get the following error

Im using a CPU and not a GPU

ERROR DL Python Network Learner 3:81 Execute failed: axes don’t match array
Traceback (most recent call last):
File “”, line 24, in
ValueError: axes don’t match array

Line 24 being
for img in input_table[‘Image’]:

I have tried using stackoverflow to troubleshoot to no end

Please do help out

Hi @AdarshGhost,

it seems to be related to the data you are using. Is it the data used by the example workflow or your own data?
Anyway, if you are really only interested in training a deep learning network for classification, then there really is no need to look into Python any longer (unless you are interested in how setting up something like that in Python.
Check out this workflow for one way how to do it with KNIME nodes:
Behind the scenes our nodes also use Python (for the most part) but as a user you don’t have to bother with that anymore. Note that the workflow is actually slightly outdated as we now have nodes to freeze the weights of layers ( and select the output layers of a network (



Hey Adrain
It is my own images
The images were obtained from google search using specific terms and two image classification were used similar to cat and dog
I wonder how could I trouble shoot that problem

Ill definitely try out the other nodes too


If you want to fix the problem in the Python code, I’d first look at the shape of your images.
The code expects 2D color images where the color dimension is the first one. For example the shape could be [3, 500, 500] for a 500x500 color image.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.