Exploring TensorFlow checkpoints

TensorFlow is quickly becoming the underlying graph calculation engine that is powering most deep learning infrastructure. While we haven't covered how these graph engines are constructed in much detail, it can be helpful to review these TensorFlow models visually. Not only can we start to appreciate the complexity of these systems better, but a good visual is often worth a thousand words. Let's open up a web browser and follow the next exercise:

  1. Search for the phrase netron tensorflow in your browser with your favorite search engine. Netron is an OpenSource TensorFlow model viewer that is perfect for our needs.
  2. Find a link to the GitHub page and on the page the links to download the binary installers. Select the installer for your platform and click Download. This will take you to another download page where you can select the file for download.
  3. Use the installer for your platform to install the Netron application. On Windows, this is as simple as downloading the exe installer and running it. 
  1. Run the Netron application, and after it launches, you will see the following:

The Netron application
  1. Click the Open Model... button in the middle of the window
  1. Use File Explorer to locate the ML-Agents/ml-agents/models/vishall-0VisualHallwayLearning folder, and locate the raw_graph.def file as shown in the following screenshot:

Selecting the model graph definition to load
  1. After loading the graph, use the - button in the top-right to zoom the view as far out as you can, similar to the following screenshot:

The TensorFlow graph model of our agent's brain
  1. As the inset shows, this graph is beyond complex, and not something we would be easily able to make sense of. However, it can be interesting to look through and see how the model/graph is constructed.
  1. Scroll to the top of the graph and find a node called advantages, then select the node and note the Graph and Inputs, model properties as shown in the following screenshot:

Properties of the advantages graph model
  1. Within the properties view of this model, you should be able to see some very familiar terms and settings, such as visual_observation_0, for instance, which shows the model input is a tensor of shape [84,84,3].

When you are done, feel free to look over other models, and perhaps even explore with other models even outside Unity. While this tool isn't quite capable of summarizing a complex model like we have, it does show how powerful these types of tools are becoming. What's more, if you can find your way around, you can even export variables for later inspection or use. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset