Beispiel #1
0
        test_imgs_with_guide += [(None, None,
                                  os.path.join(baseDirLabel, name, label_id,
                                               '00000.png'),
                                  os.path.join(baseDirImg, name, '00001.jpg'))]
        test_imgs_with_guide += [
            (None, None,
             os.path.join(resDirLabel, name, label_id,
                          prev_frame[:-4] + '.png'),
             os.path.join(baseDirImg, name, frame))
            for prev_frame, frame in zip(test_frames[1:-1], test_frames[2:])
        ]

        # Define Dataset
        dataset = Dataset(train_imgs_with_guide,
                          test_imgs_with_guide,
                          args,
                          data_aug=True)

        with tf.Graph().as_default():
            with tf.device('/gpu:' + str(args.gpu_id)):
                if not args.only_testing:
                    max_training_iters = args.training_iters
                    save_step = args.save_iters
                    display_step = args.display_iters
                    logs_path = os.path.join(args.model_save_path, name,
                                             label_id)
                    global_step = tf.Variable(0,
                                              name='global_step',
                                              trainable=False)
                    osmn.train_finetune(
                        dataset,
                              os.path.join(baseDirLabel, name,
                                           test_frames[0][:-4] + '.png'), None,
                              None)]
    test_imgs_with_guide += [(None, None,
                              os.path.join(baseDirLabel, name,
                                           test_frames[0][:-4] + '.png'),
                              os.path.join(baseDirImg, name, test_frames[1]))]

    test_imgs_with_guide += [
        (None, None, os.path.join(resDirLabel, name, prev_frame[:-4] + '.png'),
         os.path.join(baseDirImg, name, frame))
        for prev_frame, frame in zip(test_frames[1:-1], test_frames[2:])
    ]

# Define Dataset
dataset = Dataset([], test_imgs_with_guide, args)

## default config
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.allow_soft_placement = True
config.gpu_options.per_process_gpu_memory_fraction = 0.9

# Test the network
with tf.Graph().as_default():
    with tf.device('/gpu:' + str(args.gpu_id)):
        checkpoint_path = args.whole_model_path
        osmn.test(dataset,
                  args,
                  checkpoint_path,
                  args.result_path,