Search code examples
pythontensorflowjupyter-notebookgoogle-colaboratorytensorboard

TensorBoard in TensorFlow 1 using Google Colab


I would like to use TensorBoard in TensorFlow 1 in Google Colab. The tutorials I have found seem to be on TensorFlow 2 and the suggestions do not seem to work in TensorFlow 1.

It seems I need some equivalent to tf.summary.create_file_writer and tf.summary.scalar. I have tried tf.contrib.summary.create_file_writer and tf.contrib.summary.scalar, but these do not seem to work.

Here is the recreation of my problem:

https://colab.research.google.com/drive/1M3CL0oasd8pCjXLaaHl15I1yz-LUXNhq


Solution

  • !wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
    !unzip ngrok-stable-linux-amd64.zip
    
    get_ipython().system_raw('tensorboard --logdir /content/trainingdata/objectdetection/ckpt_output/trainingImatges/ --host 0.0.0.0 --port 6006 &')
    
    get_ipython().system_raw('./ngrok http 6006 &')
    
    ! curl -s http://localhost:4040/api/tunnels | python3 -c \
     "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"
    

    This gives you a tensorboard from the log files created. And it works with TF1.13