def train(self): # dsn_2_loss + dsn_3_loss + dsn_4_loss + dsn_5_loss + main_loss with tf.Graph().as_default(): global_step = tf.Variable(0, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, self.boundaries, self.values) osvos.train_parent(self.dataset, self.imagenet_ckpt, 1, learning_rate, self.model_result_path, self.train_iters[0], self.save_step, self.display_step, global_step, iter_mean_grad=self.iter_mean_grad, test_image_path=None, ckpt_name=self.ckpt_name) # 0.5 * (dsn_2_loss + dsn_3_loss + dsn_4_loss + dsn_5_loss) + main_loss with tf.Graph().as_default(): global_step = tf.Variable(self.train_iters[0], name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, self.boundaries, self.values) osvos.train_parent(self.dataset, self.imagenet_ckpt, 2, learning_rate, self.model_result_path, self.train_iters[1], self.save_step, self.display_step, global_step, iter_mean_grad=self.iter_mean_grad, resume_training=True, test_image_path=None, ckpt_name=self.ckpt_name) # main_loss with tf.Graph().as_default(): global_step = tf.Variable(self.train_iters[1], name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, self.boundaries, self.values) osvos.train_parent(self.dataset, self.imagenet_ckpt, 3, learning_rate, self.model_result_path, self.train_iters[2], self.save_step, self.display_step, global_step, iter_mean_grad=self.iter_mean_grad, resume_training=True, test_image_path=None, ckpt_name=self.ckpt_name) pass
ini_learning_rate = 1e-8 boundaries = [10000, 15000, 25000, 30000, 40000] values = [ini_learning_rate, ini_learning_rate * 0.1, ini_learning_rate, ini_learning_rate * 0.1, ini_learning_rate, ini_learning_rate * 0.1] # Define Dataset train_file = 'train_parent.txt' dataset = Dataset(train_file, None, './DAVIS', store_memory=store_memory, data_aug=data_aug) # Train the network with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(0, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, imagenet_ckpt, 1, learning_rate, logs_path, max_training_iters_1, save_step, display_step, global_step, iter_mean_grad=iter_mean_grad, test_image_path=test_image, ckpt_name='OSVOS_parent') with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(max_training_iters_1, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, imagenet_ckpt, 2, learning_rate, logs_path, max_training_iters_2, save_step, display_step, global_step, iter_mean_grad=iter_mean_grad, resume_training=True, test_image_path=test_image, ckpt_name='OSVOS_parent') with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(max_training_iters_2, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, imagenet_ckpt, 3, learning_rate, logs_path, max_training_iters_3, save_step,
ini_learning_rate = 1e-8 boundaries = [10000, 15000, 25000, 30000, 40000] values = [ini_learning_rate, ini_learning_rate * 0.1, ini_learning_rate, ini_learning_rate * 0.1, ini_learning_rate, ini_learning_rate * 0.1] # Define Dataset train_file = 'train_parent.txt' dataset = Dataset(train_file, None, './DAVIS', store_memory=store_memory, data_aug=data_aug) # Train the network with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(0, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, imagenet_ckpt, 1, learning_rate, logs_path, max_training_iters_1, save_step, display_step, global_step, iter_mean_grad=iter_mean_grad, test_image_path=test_image, ckpt_name='OSVOS_parent') with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(max_training_iters_1, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, imagenet_ckpt, 2, learning_rate, logs_path, max_training_iters_2, save_step, display_step, global_step, iter_mean_grad=iter_mean_grad, resume_training=True, test_image_path=test_image, ckpt_name='OSVOS_parent') with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(max_training_iters_2, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, imagenet_ckpt, 3, learning_rate, logs_path, max_training_iters_3, save_step,
# Define Dataset # smoke dataset train_file = 'smoke_train_list.txt' dataset = Dataset(train_file, None, './dataset/smoke_dataset/*', store_memory=store_memory, data_aug=data_aug, flow_given=True) # davis 2016 dataset # train_file = 'train_parent_davis.txt' # dataset = Dataset(train_file, None, './dataset/DAVIS/', store_memory=store_memory, data_aug=data_aug) # Train the network with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(0, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, pretrained_ckpt, 1, learning_rate, logs_path, max_training_iters_1, save_step, display_step, global_step, iter_mean_grad=iter_mean_grad, test_image_path=test_image, ckpt_name='OSVOS_parent', backbone=backbone_arch, batch_size=batch_size) with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(max_training_iters_1, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, pretrained_ckpt, 2, learning_rate, logs_path, max_training_iters_2, save_step, display_step, global_step, iter_mean_grad=iter_mean_grad, resume_training=True, test_image_path=test_image, ckpt_name='OSVOS_parent') with tf.Graph().as_default(): with tf.device('/gpu:' + str(gpu_id)): global_step = tf.Variable(max_training_iters_2, name='global_step', trainable=False) learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) osvos.train_parent(dataset, pretrained_ckpt, 3, learning_rate, logs_path, max_training_iters_3, save_step,