Open jpgutierrez opened 6 years ago
Tambien agregar a este capo:
Stackoverflow, que otro link podria ser
Soluciono un problema que tenia al convertir los fully connected layers en convolutional layers.
''' a. No need to do complicated rotation. Just reshape is working
b. Use get_weights() and init new layer
Iterate through the model.layers, create same layer with config and load weights using set_weights or as shown below.
Following piece of pseudo code works for me. (Keras 2.0)
Pseudo Code:
f_dim = flatten_layer.input_shape
m_layer = model.get_layer(layer.name) input_shape = m_layer.input_shape output_dim = m_layer.get_weights()[1].shape[0] W,b = layer.get_weights() if first dense layer : shape = (f_dim[1],f_dim[2],f_dim[3],output_dim) new_W = W.reshape(shape) new_layer = Convolution2D(output_dim,(f_dim[1],f_dim[2]),strides=(1,1),activation='relu',padding='valid',weights=[new_W,b])
else: (not first dense layer) shape = (1,1,input_shape[1],output_dim) new_W = W.reshape(shape) new_layer = Convolution2D(output_dim,(1,1),strides=(1,1),activation='relu',padding='valid',weights=[new_W,b]) shareimprove this answer '''
BTW, para que te ahorres el paper: Capo ruso Miralo desde el min 9:24 por unos cuantos minutos y ya.
Update Readme to include data_raw info