`log_graph = True` for tensorboard logger doesn't show model graph.
See original GitHub issueDescribe the bug
I wanted to show the computational graph of the patchcore
model and for that I enable project.logger: tensorboard
and set log_graph = True
logger = AnomalibTensorBoardLogger(
name="Tensorboard Logs",
save_dir=os.path.join(config.project.path, "logs"),
log_graph=True
)
Now, when I finished training, I run the tensorboard and under the GRAPHS
tag, it showed nothing.
To Reproduce Steps to reproduce the behavior:
- Go to the
patchcore
config file and set `logger: tensorboard’ - Next,
working/anomaly_detection_engine/anomalib/anomalib/utils/loggers/__init__.py
and setlog_graph=True
- Run the anomalib with patchcore config
- After training, run the event log in tensorboard.
Expected behavior
- It should give a computational graph, like https://github.com/PyTorchLightning/pytorch-lightning/issues/2915
Screenshots
- (Mention above)
Hardware and Software Configuration
- OS: [Ubuntu, OD] Ubuntu
- PyTorch-Lighting: ‘1.5.9’
- NVIDIA Driver Version [470.57.02]
- CUDA Version [e.g. 11.4] 10.2
- CUDNN Version [e.g. v11.4.120] 7605
- OpenVINO Version [Optional e.g. v2021.4.2]
Additional context
- I also found that the
add_image
function of the tensorboard callback, doesn’t write any image on the tensorboard either. - Is there any way, I can write the Histogram in tensorboard in pytorch-lighting. Histograms are made for weights and bias matrices in the network. They tell us about the distribution of weights and biases among themselves. Is there any convenient way to add it to anomalib’ models?
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Tensorboard log_graph does not seem to do anything #4885
Bug While exploring Tensorboard's logging features I experimented with ... is displayed and Tensorboard does not recognise any logged graph.
Read more >tensorboard — PyTorch Lightning 1.8.6 documentation
Record hyperparameters. TensorBoard logs with and without saved hyperparameters are incompatible, the hyperparameters are then not displayed in the TensorBoard.
Read more >TensorBoard Scalars: Logging training metrics in Keras
As training progresses, the Keras model will start logging data. TensorBoard will periodically refresh and show you your scalar metrics.
Read more >python - How to log model graph to tensorboard when using ...
The best way to do this (TF 2.3.0, TB 2.3.0) is to use tf.summary and pass the model through a wrapper function with...
Read more >Deep Dive Into TensorBoard: Tutorial With Examples
This callback is responsible for logging events such as Activation Histograms, Metrics Summary Plots, Profiling and Training Graph Visualizations.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Edit: I have moved the for loop after trainer.fit so that it works with Patchcore @innat I am working on updating the documentation but for now you can use the following snippet in
train.py
to log model graph.So your train method should look like this
And here is the output![tensorboard_graph](https://user-images.githubusercontent.com/17232914/165116323-3ee31843-917c-4a1c-91f9-fa77d999a395.jpg)
Not sure if this is what you wanted. Also, to access other methods provided by tensorboard you can access
logger.experiment
object. But I’d be more inclined towards using this https://pytorch-lightning.readthedocs.io/en/stable/api/pytorch_lightning.loggers.tensorboard.html rather than accessing experiment object. I’ll try to make this more clear in the PR.@ashwinvaidya17 Thanks a lot, it’s really helpful. I’m currently out of my workplace, will check soon.