keras-layer

Can't change activations in existing Keras model

梦想与她 提交于 2021-02-20 05:44:10
问题 I have a normal VGG16 model with relu activations, i.e. def VGG_16(weights_path=None): model = Sequential() model.add(ZeroPadding2D((1, 1),input_shape=(3, 224, 224))) model.add(Convolution2D(64, 3, 3, activation='relu')) model.add(ZeroPadding2D((1, 1))) model.add(Convolution2D(64, 3, 3, activation='relu')) model.add(MaxPooling2D((2, 2), strides=(2, 2))) [...] model.add(Flatten()) model.add(Dense(4096, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(4096, activation='relu')) model

how i can create 3d input / 3d output Convolution model with keras?

限于喜欢 提交于 2021-02-20 05:12:34
问题 I have a bit question i couldnt solve. I wanna implement CNN model with fully-connected MLP to my protein database which has 2589 proteins. Each protein has 1287 rows and 69 columns as input and and 1287 rows and 8 columns as output. Actually there was 1287x1 output, but i used one hot encoding for class labels to use crossentropy loss in my model. Also i want if we consider as image i have an 3d matrix ** X_train = (2589, 1287, 69) for input** and y_train =(2589, 1287, 8) output , i mean

how i can create 3d input / 3d output Convolution model with keras?

一个人想着一个人 提交于 2021-02-20 05:12:34
问题 I have a bit question i couldnt solve. I wanna implement CNN model with fully-connected MLP to my protein database which has 2589 proteins. Each protein has 1287 rows and 69 columns as input and and 1287 rows and 8 columns as output. Actually there was 1287x1 output, but i used one hot encoding for class labels to use crossentropy loss in my model. Also i want if we consider as image i have an 3d matrix ** X_train = (2589, 1287, 69) for input** and y_train =(2589, 1287, 8) output , i mean

how i can create 3d input / 3d output Convolution model with keras?

天涯浪子 提交于 2021-02-20 05:09:30
问题 I have a bit question i couldnt solve. I wanna implement CNN model with fully-connected MLP to my protein database which has 2589 proteins. Each protein has 1287 rows and 69 columns as input and and 1287 rows and 8 columns as output. Actually there was 1287x1 output, but i used one hot encoding for class labels to use crossentropy loss in my model. Also i want if we consider as image i have an 3d matrix ** X_train = (2589, 1287, 69) for input** and y_train =(2589, 1287, 8) output , i mean

how can I overcome “ValueError: Shapes (None, 1) and (None, 7) are incompatible”

天大地大妈咪最大 提交于 2021-02-20 04:24:27
问题 I am new to Keras and CNN. I am working on an assignment to build a CNN for predicting face emotions. I built the model as per the assignment but while compiling the model I get "ValueError: Shapes (None, 1) and (None, 7) are incompatible". Can someone help me how to resolve this? Pasting my code below for reference: ''' model = Sequential() model.add(Conv2D(filters = 64, kernel_size = 5,input_shape = (48,48,1))) model.add(Conv2D(filters=64, kernel_size=5,strides=(1, 1), padding='valid'))

Is dropout layer still active in a freezed Keras model (i.e. trainable=False)?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-16 21:27:25
问题 I have two trained models ( model_A and model_B ), and both of them have dropout layers. I have freezed model_A and model_B and merged them with a new dense layer to get model_AB (but I have not removed model_A 's and model_B 's dropout layers). model_AB 's weights will be non-trainable, except for the added dense layer. Now my question is: are the dropout layers in model_A and model_B active (i.e. drop neurons) when I am training model_AB ? 回答1: Short answer: The dropout layers will continue

Is dropout layer still active in a freezed Keras model (i.e. trainable=False)?

大兔子大兔子 提交于 2021-02-16 21:22:49
问题 I have two trained models ( model_A and model_B ), and both of them have dropout layers. I have freezed model_A and model_B and merged them with a new dense layer to get model_AB (but I have not removed model_A 's and model_B 's dropout layers). model_AB 's weights will be non-trainable, except for the added dense layer. Now my question is: are the dropout layers in model_A and model_B active (i.e. drop neurons) when I am training model_AB ? 回答1: Short answer: The dropout layers will continue

Keras model summary incorrect

删除回忆录丶 提交于 2021-02-11 15:51:05
问题 I am doing data augmentation using data_gen=image.ImageDataGenerator(rotation_range=20,width_shift_range=0.2,height_shift_range=0.2, zoom_range=0.15,horizontal_flip=False) iter=data_gen.flow(X_train,Y_train,batch_size=64) data_gen.flow() needs a rank 4 data matrix, so the shape of X_train is (60000, 28, 28, 1) . We need to pass the same shape i.e (60000, 28, 28, 1) while defining the architecture of the model as follows; model=Sequential() model.add(Dense(units=64,activation='relu',kernel

Keras model summary incorrect

﹥>﹥吖頭↗ 提交于 2021-02-11 15:48:44
问题 I am doing data augmentation using data_gen=image.ImageDataGenerator(rotation_range=20,width_shift_range=0.2,height_shift_range=0.2, zoom_range=0.15,horizontal_flip=False) iter=data_gen.flow(X_train,Y_train,batch_size=64) data_gen.flow() needs a rank 4 data matrix, so the shape of X_train is (60000, 28, 28, 1) . We need to pass the same shape i.e (60000, 28, 28, 1) while defining the architecture of the model as follows; model=Sequential() model.add(Dense(units=64,activation='relu',kernel

Dataset shape mismatch Conv1D input layer

心不动则不痛 提交于 2021-02-10 14:33:28
问题 Trying to set up a Conv1D layer to be the input layer in keras. The dataset is 1000 timesteps, and each timestep has 1 feature. After reading a bunch of answers I reshaped my dataset to be in the following format of (n_samples, timesteps, features), which corresponds to the following in my case: train_data = (78968, 1000, 1) test_data = (19742, 1000, 1) train_target = (78968,) test_target = (19742,) I later create and compile the code using the following lines model = Sequential() model.add