CNN, dropout error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: CNN, dropout error (/thread-19499.html) |
CNN, dropout error - habib - Jul-02-2019 using python3 at ubuntu. Reciving error constantly at each cnn code run. WARNING:tensorflow:From /home/habib/.virtualenvs/kerasTF/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use rate instead of keep_prob . Rate should be set to rate = 1 - keep_prob .went to tensorflow_backend.py:3445 But there is retain_prob instead keep_prob. eventhen changed but it prompts with new error keep_prob not defined. RE: CNN, dropout error - scidam - Jul-02-2019 I see just a warning, not an error. Where is the code of your CNN (convolutional nerual network) model? You likely just need to change keep_prob to rate in your dropout layers.
RE: CNN, dropout error - ThomasL - Jul-02-2019 What is the problem to have a look at official documents? https://www.tensorflow.org/api_docs/python/tf/keras/layers/Dropout There is no argument keep_prob or retain_prob. Now it´s e.g. Dropout(rate=0.2) or Dropout(0.2) which means 20% of the weights will be dropped out. In the past it meant the opposite (80% drop out). RE: CNN, dropout error - habib - Jul-05-2019 Excuse me sir i am bit new to programming, so kindly be clear in wording. # CNN import keras from keras.preprocessing.image import ImageDataGenerator from keras_tqdm import TQDMNotebookCallback from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import Flatten from keras.constraints import maxnorm from keras.optimizers import SGD from keras.layers.convolutional import Conv2D from keras.layers.convolutional import MaxPooling2D from keras.utils import np_utils from keras.callbacks import Callback model = Sequential() model.add(Conv2D(32, (3, 3), input_shape=(150, 150, 3), padding='same', activation='relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(32, (3, 3), padding='same', activation='relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Conv2D(64, (3, 3), activation='relu', padding='same')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Dropout(0.25)) model.add(Flatten()) model.add(Dense(64, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(2, activation='softmax')) epochs = 50 lrate = 0.01 decay = lrate/epochs sgd = SGD(lr=lrate, momentum=0.9, decay=decay, nesterov=False) model.compile(loss='binary_crossentropy', optimizer=sgd, metrics=['accuracy']) RE: CNN, dropout error - ThomasL - Jul-05-2019 Your code is fine. As Scidam wrote your 'error' message is just a warning. I get this warning too if i use the Dropout() method in my code. The warning tells you that the value e.g. 0.2 is now meant to be the rate of weights that are dropped. In the past the value was meant to be the rate of weights that were NOT dropped. |