Is there a way to view the images that tensorflow object detection api trains on after all preprocessing/augmentation.
I'd like to verify that things look correctly. I was able to verify the resizing my looking at the graph post resize in inference but I obviously can't do that for augmentation options.
In the past with Keras I've been able to do that and I've found that I was to aggressive.
The API provides test code for augmentation options. In input_test.py file, the function
test_apply_image_and_box_augmentation
is for that. You can rewrite this function by passing your own images to thetensor_dict
and then save theaugmented_tensor_dict_out
for verification or you can directly visualize it.EDIT: Since this answer was long ago answered and still not accepted, I decided to provide a more specific answer with examples. I wrote a little test script called
augmentation_test.py
.You can put this script under
models/research/object_detection/
and simply run it withpython augmentation_test.py
. To successfully run it you should provide any image name 'lena.jpeg' and the output image after augmentation would be saved as 'lena_out.jpeg'.I ran it with the 'lena' image and here is the result before augmentation and after augmentation.
.
Note that I used
preprocessor.random_horizontal_flip
in the script. And the result showed exactly what the input image looks like afterrandom_horizontal_flip
. To test it with other augmentation options, you can replace therandom_horizontal_flip
with other methods (which are all defined in preprocessor.py and also in the config proto file), all you can append other options to thedata_augmentation_options
list, for example: