-1

I use tensorflow https://github.com/tensorflow/models/tree/master/research/deeplab where i want to apply my own data augmentation.

TF:deeplab uses slim as generell learning framework.

In deeplab core preprocess_utils theres is deeplabs own Preprocessing augmentations.

All I want is manually (with my own human eyes) see a image before and after the preprocessing just to have a visual feedback

I already tried to get the tensor -> image -> imshow but it requieres the session. At this point I first want to ask the experts if this is possible or even for a hint....

Every function I directly insert in the code is just called once... even if somehow triggers on all images since it is preprocessing..

best jeahinator

VaaChar
  • 688
  • 8
  • 20
Jeahinator
  • 77
  • 7

1 Answers1

0

What is wrong with using a session? If the preprocessing is defined as a set of TensorFlow operations, you have to run a session to fill tensors with values. For instance:

valid_dataset = dataset([args.valid_data], args.batch_size, args.img_height, args.img_width)                                                                                                                                                       
x = train_dataset.make_one_shot_iterator().get_next()                                                                                                                                                                                                          
with tf.Session() as sess:                                                                                                                                                                                                                                        
    for i in range(50):                                                                                                                                                                                                                                           
        image = sess.run([x])[0]                                                                                                                                                                                                                            
        image = np.squeeze(image) * 255                                                                                                                                                                                                                                                                                                                                                                                                                        
        cv2.imwrite(os.path.join(args.log_dir, '{:04d}.png'.format(i)),                                                                                                                                                                                           
                    cv2.cvtColor(image, cv2.COLOR_RGB2BGR))

In this example the dataset function builds the input pipeline including pre-processing.

Alternatively, you can use eager execution.

Dmytro Prylipko
  • 4,762
  • 2
  • 25
  • 44