#------------------------------------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_feat = mg.create_mlp(5, regress=False) cnn = mg.create_cnn(508, 508, 1, filters=(16,32,64), regress=False) mlp_dist = mg.create_mlp(6, regress=False) # create the input to our final set of layers as the *output* of both # the MLP and CNN combinedInput = concatenate([mlp_feat.output, cnn.output, mlp_dist.output]) # our final FC layer head will have two dense layers, the final one # being our regression head x = Dense(4, activation="relu")(combinedInput) x_0 = Dense(4, activation="relu")(x) x_100 = Dense(4, activation="relu")(x) x_200 = Dense(4, activation="relu")(x)
# 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)
# # Ran for 70 Epochs: # loss: 21.6689 - mean_absolute_error: 323.2171 - val_loss: 5.3846 - val_mean_absolute_error: 80.1602 # 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(5, regress=True) # 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")(mlp.output) 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