#------------------------------------SETUP------------------------------------------------------------- #set up the tensorflow backend in order to use gpu #only give 85% of gpu over otherwise it crashes config = tf.ConfigProto() config.gpu_options.allow_growth = True config.gpu_options.per_process_gpu_memory_fraction = 0.85 sess = tf.Session(config=config) K.tensorflow_backend.set_session(tf.Session(config=config)) K.tensorflow_backend._get_available_gpus() #source folder of ships folder = "D:\Pickled_Data_2\\" # create the MLP and CNN models mlp = mg.create_mlp(5, regress=False) cnn = mg.create_cnn(508, 508, 1, filters=(16, 32), regress=False) # create the input to our final set of layers as the *output* of both # the MLP and CNN combinedInput = concatenate([mlp.output, cnn.output]) # our final FC layer head will have two dense layers, the final one # being our regression head x = Dense(4, activation="relu")(combinedInput) comb_output = (Dense(1, activation='linear', kernel_regularizer=regularizers.l1_l2(l1=0.01, l2=0.01)))(x) # our final model will accept categorical/numerical data on the MLP # input and images on the CNN input, outputting a single value
config = tf.ConfigProto() config.gpu_options.allow_growth = True config.gpu_options.per_process_gpu_memory_fraction = 0.85 sess = tf.Session(config=config) K.tensorflow_backend.set_session(tf.Session(config=config)) K.tensorflow_backend._get_available_gpus() folder = "D:\PickledData\\" # create the MLP and CNN models mlp = mg.create_mlp(3, regress=False) cnn = mg.create_cnn(512, 512, 1, regress=False) # create the input to our final set of layers as the *output* of both # the MLP and CNN combinedInput = concatenate([mlp.output, cnn.output]) # our final FC layer head will have two dense layers, the final one # being our regression head x = Dense(4, activation="relu")(combinedInput) comb_output = (Dense(1,activation='linear', kernel_regularizer=regularizers.l1_l2(l1 = 0.001,l2 = 0.001)))(x) # our final model will accept categorical/numerical data on the MLP # input and images on the CNN input, outputting a single value model = Model(inputs=[mlp.input, cnn.input], outputs=comb_output) adam = optimizers.Adam(lr=0.0001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0, amsgrad=False) model.compile(loss="mean_absolute_percentage_error", optimizer=adam,metrics=['mse'])
#------------------------------------SETUP------------------------------------------------------------- #set up the tensorflow backend in order to use gpu #only give 85% of gpu over otherwise it crashes config = tf.ConfigProto() config.gpu_options.allow_growth = True config.gpu_options.per_process_gpu_memory_fraction = 0.85 sess = tf.Session(config=config) K.tensorflow_backend.set_session(tf.Session(config=config)) K.tensorflow_backend._get_available_gpus() #source folder of ships folder = "D:\Pickled_Data_2\\" # create the MLP and CNN models mlp = mg.create_mlp(5, regress=False) cnn = mg.create_cnn(508, 508, 1, regress=False) # create the input to our final set of layers as the *output* of both # the MLP and CNN combinedInput = concatenate([mlp.output, cnn.output]) # our final FC layer head will have two dense layers, the final one # being our regression head x = Dense(4, activation="relu")(combinedInput) comb_output = (Dense(1, activation='linear', kernel_regularizer=regularizers.l1_l2(l1=0.001, l2=0.001)))(x) # our final model will accept categorical/numerical data on the MLP # input and images on the CNN input, outputting a single value