def End_Net_Out(self, X1, pooled_input2, phase_rgb, phase): """ Computation Graph """ with tf.variable_scope('ResNet34_RGB'): RGB_Net_obj = model.ResNet34_RGB(X1, phase_rgb) with tf.device('/device:GPU:0'): output_rgb, summary1 = RGB_Net_obj.Net() # output_rgb = tf.reshape(output_rgb, (batch_size * Frame, 6, 20, 512)) with tf.variable_scope('ResNet34_Depth'): Depth_Net_obj = model.ResNet34_Depth(pooled_input2, phase) with tf.device('/device:GPU:0'): output_depth, summary2 = Depth_Net_obj.Net() # output_depth = tf.reshape(output_depth, [batch_size, Frame, 6, 20, 256]) with tf.variable_scope('End_Net'): with tf.device('/device:GPU:0'): cnn_output, summaries = self.End_Net(output_rgb, output_depth, phase, phase_rgb) return cnn_output, summaries + summary1 + summary2
import urllib.request # Download a pre-trained MNIST model for inception score calculation. # This is a tiny model (<100kb). if not os.path.exists(MODEL_PATH): print("downloading model") os.makedirs(os.path.dirname(MODEL_PATH), exist_ok=True) urllib.request.urlretrieve( "https://github.com/ray-project/ray/raw/master/python/ray/tune/" "examples/pbt_dcgan_mnist/mnist_cnn.pt", MODEL_PATH) dataloader = get_data_loader() if not args.smoke_test: plot_images(dataloader) # load the pretrained mnist classification model for inception_score mnist_cnn = Net() mnist_cnn.load_state_dict(torch.load(MODEL_PATH)) mnist_cnn.eval() mnist_model_ref = ray.put(mnist_cnn) # __tune_begin__ scheduler = PopulationBasedTraining( time_attr="training_iteration", metric="is_score", mode="max", perturbation_interval=5, hyperparam_mutations={ # distribution for resampling "netG_lr": lambda: np.random.uniform(1e-2, 1e-5), "netD_lr": lambda: np.random.uniform(1e-2, 1e-5), })