def tracking(dataset, seq, display, restore_path):
train_data = reader.read_seq(dataset, seq)
im_size = proc.load_image(train_data.data[seq].frames[0]).shape[:2]
config = Config(im_size)
# create session and saver
gpu_config = tf.ConfigProto(allow_soft_placement=True)
sess = tf.InteractiveSession(config=gpu_config)
# load model, weights
model = MDNet(config)
model.build_generator(config.batch_size, reuse=False, dropout=True)
tf.global_variables_initializer().run()
# create saver
saver = tf.train.Saver([v for v in tf.global_variables() if ('conv' in v.name or 'fc4' in v.name or 'fc5' in v.name) \
and 'lr_rate' not in v.name], max_to_keep=50)
# restore from model
saver.restore(sess, restore_path)
# run mdnet
mdnet_run(sess, model, train_data.data[seq].gts[0], train_data.data[seq].frames, config, display)
评论列表
文章目录