Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MO][POC] TensorBoard for ov::Model - Alternative to Netron #14105

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rkazants
Copy link
Member

@rkazants rkazants commented Nov 20, 2022

Details: Implemented alternative way to visualize IR, ov::Model via TensorBoard tool.
Implemented functionality generates TensorBoard logs for IR and ov::Model

Currently the frameworks (PyTorch, Paddle, not only TensorFlow) use TensorBoard to visualize their models. The idea is to generate TensorBoard logs for the input model and open it up via TensorBoard tool.
Here is an example for PyTorch by this link.

There is a similar way to visualize Pytorch model in TensorBoard like as follows:

from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter('logs_dir')
writer.add_graph(net, images)
writer.close()

In OpenVINO we have two ways to generate TB logs. The first one is using OpenVino Tools API:

from openvino.tools.mo.utils.tensorboard.writer import SummaryWriter
writer = SummaryWriter('logs_dir')
writer.add_graph(ov_model)
writer.close()

The second way is using new MO option --tensorboard_ir_logdir.

Example of how IR for FaceNet is displayed in TensorBoard:
image

TODO:

  • Support Loop, If
  • Support attributes
  • Constant values
  • Fill GitHub issue in TB repo: complain on bugs in the visualization

Ticket: TBD

Signed-off-by: Kazantsev, Roman [email protected]

@rkazants rkazants requested a review from a team as a code owner November 20, 2022 12:26
@rkazants rkazants changed the title [MO][POC] TensorBoard for ov::Model - Alternative Way for Netron [MO][POC] TensorBoard for ov::Model - Alternative to Netron Nov 20, 2022
@ilyachur
Copy link
Contributor

This approach will work only wit MO.
Why do we need a new visualisation tool for IR? Can we contribute to Netron if we have any problems?

@rkazants
Copy link
Member Author

This approach will work only wit MO. Why do we need a new visualisation tool for IR? Can we contribute to Netron if we have any problems?

Ilya, good question. Currently, we have a problem with Netron to visualize graphs with Loops and Ifs operations because they have body graphs, etc. It is not easy to add such support to there and we should ask the main contributors to wait for this feature. Several years passed but it is still unimplemented. In the meantime, we can add it this feature very easy, it costs just couple of hours:) Really easy to maintain from our side in the centralized way.

@slyalin
Copy link
Contributor

slyalin commented Nov 21, 2022

The only problem with TB is that you must prepare a model to visualize it by writing some code. So even if you already have a model represented as a file (IR -- in out case) it is not enough to look at it. If you have the model in Python you still need to serialize it twice -- for IR itself and to format that TB can accept. This is a major and probably deciding factor. Is it possible to implement a way to load IRs directly to TB without such pre-processing?

As for the advantages of TB vs the disadvantages of Netron: could you provide example of how Loop/If from IR is visualized in TB?

@rkazants
Copy link
Member Author

rkazants commented Nov 21, 2022

The only problem with TB is that you must prepare a model to visualize it by writing some code. So even if you already have a model represented as a file (IR -- in out case) it is not enough to look at it. If you have the model in Python you still need to serialize it twice -- for IR itself and to format that TB can accept. This is a major and probably deciding factor. Is it possible to implement a way to load IRs directly to TB without such pre-processing?

As for the advantages of TB vs the disadvantages of Netron: could you provide example of how Loop/If from IR is visualized in TB?

Sergey, I will add this support for Loop and If.

@akladiev
Copy link
Collaborator

This PR will be closed in 2 weeks in case of no activity.

@akladiev akladiev added the Stale label May 11, 2023
@akladiev
Copy link
Collaborator

This PR was closed because it has been stalled for 2 week with no activity.

@akladiev akladiev closed this May 23, 2023
@rkazants rkazants reopened this May 24, 2023
@github-actions github-actions bot added the category: MO Model Optimizer label May 24, 2023
@rkazants
Copy link
Member Author

rkazants commented May 24, 2023

No need to close. I hope to continue this effort soon:) That is especially needed for analysis of huge models.

@slyalin, @AlexKoff88

@akladiev akladiev removed the Stale label May 25, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

This PR will be closed in a week because of 2 weeks of no activity.

@github-actions github-actions bot added the Stale label Jun 9, 2023
@github-actions
Copy link
Contributor

This PR was closed because it has been stalled for 2 week with no activity.

@github-actions github-actions bot closed this Jun 17, 2023
@rkazants rkazants reopened this Jun 19, 2023
@github-actions github-actions bot removed the Stale label Jun 20, 2023
@p-wysocki
Copy link
Contributor

@rkazants there's a no_stale label if you need it, it disables the PR closing feature.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

This PR will be closed in a week because of 2 weeks of no activity.

@github-actions github-actions bot added the Stale label Jul 6, 2023
@github-actions
Copy link
Contributor

This PR was closed because it has been stalled for 2 week with no activity.

@github-actions github-actions bot closed this Jul 14, 2023
@rkazants rkazants reopened this Jul 14, 2023
@rkazants rkazants added the no_stale Do not mark as stale label Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: MO Model Optimizer do not merge no_stale Do not mark as stale Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants