Подскажите, как обойти ошибку в процессе 02_ Train simple CNN в узле DL Python Network Learner
Value error
File ‘string’ line 24: axes don’t match array
Hi @Asa_66,
I tried to reproduce the error, but for me the workflow runs without any issue.
Did you make any changes to the preprocessing workflow 01_Preprocess_image_data?
Are you using the same images or are you trying to adjust the workflows to some other data?
Kind regards
Kathrin
@Asa_66 you might want to check out this example and see if the Cona Environment Propagation can help:
Кэтрин, день добрый. На 2000 изображений все работает, но получился низкий результат. Использовал другой набор - kagglecatsanddogs_3367a где данных больше. В 1 процессе пришлось сбросить галочку в компоненте в узле Image Reader контроля формата каждого файла((check file format…). Тогда таблица формируется. Но это видимо отразилось на 2 процессе. Значит дело в моих данных. Если возможно, поделитесь ссылкой на ваш надежный набор, буду весьма признателен.
I think most of the examples are based on the Kaggle dataset “Cats and Dogs”:
Я думаю, что большинство примеров основано на наборе данных Kaggle “Кошки и собаки”:
[Переведено с английского с помощью deepl.com].
Thank you @mlauber71.
@Asa_66: According to the workflow description this is the data which was originally used. Did you use the same dataset?
Катрин. Все выяснилось. Удалось таки скачать правильные данные25000 с Dogs vs. Cats | Kaggle и все отработало. Ранее не подтверждали телефон. К сожалению результат неточный, всего accuracy=0.502 (собак определить не смогли). на другом наборе где всего 2000 изображений, точность та же но кошек отделить не вышло
Hi @Asa_66,
thank you for the update good to hear that it works now
The defined example network structure is quite small and it is only trained tor 5 epochs. This explains the low accuracy. A common approach for image classification is transfer learning. The next two workflows in the same workflow group show, how VGG16 can be used as pre-trained network. This should improve the accuracy.
Cheers
Kathrin
Спасибо Кэтрин!
для начала добавлю эпох, потом новых процессов
Katrin.
what is the problems:
03_train-tune_vGG16_Python
in DL Python Network Creator execute faled: module ‘keras’ has no attribute ‘application’
02_train_simple_CNN
execute faled: EndVector() takes 1 positioonal arguments but 2 were given
thanks
Hi @Asa_66,
hm, I can’t reproduce the issues on my laptop.
Did you make any changes to the workflows? If yes, what did you change?
Did you setup your Python Deep Learning preferences? And have you been able to execute other deep learning workflows?
Cheers
Kathrin
@Asa_66 as it happens I have adapted some of the Workflows about cats and dogs and addaed a Python Environment Propagation:
There altough is a problem with the 03 example. I was not able to create an Environment Propagation - becaue the moment I use a user defined one some items from the basic KNIME Python Image integration are not there anymore:
I didn’t make any changes. I’ve only watched 02_train_simple_CNN so far. DL Python Network Creator worked after replacing the link instead of the local Python 3.9.7 with Anaconda 3.11 on different datasets (accuracy 0.587).
03_train-tune_vGG16_Python
in DL Python Network Creator (after F8 )
module ‘keras’ has no attribute ‘applications’
Traceback (most recent call last):
File “”, line 6, in
AttributeError: module ‘keras’ has no attribute ‘applications’
Thanks for the update!
Have you already setup your Python Environment for Deep Learning as described here:
Cheers
Kathrin
Katrin.
already setup Python Environment for Deep Learning as described.
03_train-tune_vGG16_Python *DL Python Network Creator (Download network from Keras.)
if f you press F8 (reset), then F7 : Error
module ‘keras’ has no attribute ‘applications’
Traceback (most recent call last):
File “”, line 6, in
AttributeError: module ‘keras’ has no attribute ‘applications’
Cause
anaconda 3-2021.11 tensorflow library (2.6), but max allowed is 2.00?
@Asa_66 you might want to try this adaption of the original with the Conda Environment Propagation with settings that should work on MacOSX or Windows:
@Kathrin - it might be an idea to provide YAML files or Conda Environment Propagations (like in your example here ) for the Deep Learning examples since sometimes it is hard to find the right combination that would be compatible with the KNIME version.
Thanks, I’ve tried. but the error is the same when loading the pretrained network
Hi @Asa_66,
hm that is strange.
Can you please try the following workflow:
Here the model is already included.
Cheers
Kathrin
Katrin/
This process has always worked, does not work with pre-prepared network 3_train-tune_vGG16_Python *DL Python Network Creator (Download network from Keras)
namely the line
output_network = keras.applications.vgg16.VGG16(include_top=False, weights=‘imagenet’, input_tensor=None, input_shape=(150,150,3), pooling=None, classes=2)
(error text above)
conda 4.10.3
keras 2.6.0
tensorflow 2.6.0 ( required <=2.00) ??
Hi @Asa_66,
Could you check on your Python Deep Learning preference page (File > Preferences > KNIME > Python Deep Learning) whether the entry Library used for the “DL Python” scripting nodes is set to Keras, set it accordingly if necessary, and retry?
Some context: The DL Python scripting nodes can be used with both Keras/TensorFlow 1 and TensorFlow 2. It seems as if you would try to use one with Keras/TensorFlow 1 while the preferences point the node to a TensorFlow 2 environment.
Marcel