models icon indicating copy to clipboard operation
models copied to clipboard

Way too huge event files - Disabled feature for GPU in model_lib_v2.py

Open lechwolowski opened this issue 5 years ago • 3 comments

Prerequisites

Please answer the following question for yourself before submitting an issue.

  • [x] I checked to make sure that this feature has not been requested already.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/blob/master/research/object_detection/model_lib_v2.py#L553

2. Describe the feature you request

I would like training on gpu to write less often to event files, since it's a waste of I/O and disk space

3. Additional context

I wonder what is the reason for this feature to be disabled? Only a comment about GPU issues, while it seems to be working just fine on my setup.

if use_tpu:
  num_steps_per_iteration = 100
else:
  # TODO(b/135933080) Explore setting to 100 when GPU performance issues
  # are fixed.
  num_steps_per_iteration = 1

4. Are you willing to contribute it? (Yes or No)

Yes

lechwolowski avatar Jan 22 '21 18:01 lechwolowski

Hi, to address the I/O problem (but not necessarily the python overhead problem of having 1 step per iteration), I removed the image summary created on line 267 of model_lib_v2.py. This line specifically:

tf.compat.v2.summary.image( name='train_input_images', step=global_step, data=features[fields.InputDataFields.image], max_outputs=3).

As far as I could tell, 3 images were being written to the event file every iteration, which for a GPU is every step (as highlighted by you). Removing this reduced my event files by orders of magnitude, and I did observe a decrease in training time (but the time reduction was more anecdotal - I mainly did it to reduce the enormous event files).

Jon573 avatar Jan 26 '21 13:01 Jon573

Hi, thanks for Your answer. It would partially meet my needs however it doesn't entirely solve my problem since those images are nice to have. I would really like to know why was it disabled 😊

lechwolowski avatar Feb 16 '21 20:02 lechwolowski

@lechwolowski add an if statement such that it only shows some sample training images in the beginning. You have to disable it at some point as this is what is causing your issue


 if global_step.value()<=250:
     #if num_visualizations > 0:
    # Rescale visualized images from range (-1, 1) to (0, 1)
    image_data = (features[fields.InputDataFields.image]
                  [:num_visualizations] + 1) / 2
    tf.compat.v2.summary.image(
        name='train_input_images',
        step=global_step,
        data=image_data,
        max_outputs=num_visualizations)

jartantupjar avatar Feb 17 '21 10:02 jartantupjar