Search code examples
pythontensorflowdeep-learninggoogle-colaboratoryobject-detection-api

How to prevent printing loss at each step while using the tensorflow object detection api?


I am training using the Tensorflow Object Detection API in Google Colab. I want to suppress printing the loss at each step as the web page crashes after 30 minutes due to a large amount of text being printed as the output of the cell. I have to manually clear the output of the cell every 30 minutes or so to avoid this issue. Is there any way to modify the train.py code so that Tensorflow stops printing the loss at every step. I have tried changing the code in line 57 of the research/object_detection/legacy/train.py from tf.logging.set_verbosity(tf.logging.INFO) to tf.logging.set_verbosity(tf.logging.WARN) but it did not seem to work. Any suggestions/workarounds?


Solution

  • add ; if thats the print statement at the end of the print statement

    Add %%capture in the first line of the cell for no print for the cell

    and for speficic function

    from IPython.utils import io

    with io.capture_output() as captured: function()