Problem running MNIST classifier example using Keras and TensorFlow extensions.

Dear all,

Tahnks in advance. I am using Knime 3.7.1, Python 3.6, Tensorflow 1.8 or 1.12 (both are crashing)

I am having two problems within example “03_Train_MNIST_classifier”

1. Line 6 of Python code within learner
x_train = np.array([x.array for x in input_table[‘Image’].values])[…,None]
Throws next error:

ERROR DL Python Network Learner 0:24 Execute failed: Traceback (most recent call last):
File “/home/simon/knime_3.7.1/plugins/org.knime.python2_3.7.1.v201901281201/py/PythonKernelBase.py”, line 278, in execute
exec(source_code, self._exec_env, self._exec_env)
File “”, line 6, in
File “”, line 6, in
AttributeError: ‘str’ object has no attribute ‘array’

See picture

2. If I rewrite that node without “.array” in line 6 of Learner node
x_train = np.array([x for x in input_table[‘Image’].values])[…,None]

I goes further but crashes again with following error:

Traceback (most recent call last):
File “/home/simon/knime_3.7.1/plugins/org.knime.python2_3.7.1.v201901281201/py/PythonKernelBase.py”, line 278, in execute
exec(source_code, self._exec_env, self._exec_env)
File “”, line 57, in
File “/home/simon/venvml3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 929, in run
run_metadata_ptr)
File “/home/simon/venvml3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py”, line 1121, in _run
np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
File “/home/simon/venvml3.6/lib/python3.6/site-packages/numpy/core/numeric.py”, line 492, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: could not convert string to float: ‘Image[\nname=Row0.png;\nsource=;\ndimensions=28,28 (X,Y);\nmin=0,0;\npixel type=FloatType)]’

Any idea? Thanks again

Hi Iceman,

You’re probably missing the KNIME Image Processing - Python integration.

1 Like

You are right!! Thanks!!

1 Like

Glad that helped :slight_smile:.

I created a bug report for that to make sure a more meaningful error message that suggests that an extension is missing is displayed in the future.

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