Visualizing the neural network used by PPO Model
Hi all, I am working on a project in Unity where my agent has two Cameras and 281 vector observations. To obtain a better understanding on what is going on I was wondering if it is possible to visualize the underlying architecture used by the PPO model? Unforunately, under graphs in Tensorboard I found this message "No graph definition files were found."
Hi @Dreadnut93 -- this should be possible as the graph definitions are being saved when the model is output after training. I'm not sure where exactly Tensorboard needs the graph definition file to be located, but we'd welcome instructions or changes to make this process easier if you are able to make it work.
Hi @harperj, here are the steps I used to plot the my graph.
1.) I copied the "import_pb_to_tensorboard.py " from (https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/import_pb_to_tensorboard.py) to my ml-agents-master directory.
2.) Using anaconda to activate the ml-agents environment and navigated to the directory where the ML-Agents Toolkit is installed.
3.) From there I executed the following command
python import_pb_to_tensorboard.py --model_dir models\X\NewLearningBrain\raw_graph_def.pb --log_dir=summaries
If everything done correctly, the following message should appear "Model Imported. Visualize by running: tensorboard --logdir=summaries"
4.) Run tensorboard --logdir=summaries
Now, next to the Scalars there should be an option to select graphs.
5.) By double klicking on the “import” node one can see the full graph.
I hope it will be useful to somebody.
Hi @Dreadnut93 - hope you are doing well. Thank you for raising this and providing instructions. We've added this as a potential enhancement for future versions of ML-Agents. In the meantime, would you be open to creating PR, for a single MD document, in our /docs folder from the develop branch that details these instructions?
Happy to do it as well, if you are busy and cannot make the contribution at this time.
Hi @unityjeffrey, is there a deadline for the task? I would do it gladly, but it may take some time.
hi @Dreadnut93 - no deadline. happy to write it up for you as well. let me know. thanks!
To see the computation graph, I initialized summary_writer as :
self.summary_writer = tf.summary.FileWriter(self.summary_path, self.policy.sess.graph)
I logged a feature request in our internal tracker to automatically save the graph for Tensorboard. Closing this issue for now, but please reopen (or make a new one) if you have more problems.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.