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

Let's implement weight visualization feature #1486

Open
staddy opened this issue Jan 31, 2023 · 12 comments
Open

Let's implement weight visualization feature #1486

staddy opened this issue Jan 31, 2023 · 12 comments

Comments

@staddy
Copy link
Contributor

staddy commented Jan 31, 2023

What?

Let's implement weight visualization feature.

Why?

It will help to detect model issues easily and speed up debugging.

How?

@seanshpark, @jyoungyun, @dayo09, @stamalakhov, let's discuss it here.

@staddy
Copy link
Contributor Author

staddy commented Jan 31, 2023

2D weights can be visualized as a heatmap that appears, for example, after clicking on a node in CircleViewer.
For 3+D weights the respective axes can be selected.
We may also discuss 3D visualization.

@seanshpark
Copy link
Contributor

after clicking on a node in CircleViewer.

  1. can you please share some sketch how it appears ?
  2. can you please roughly describe user interaction and response of vscode?

@staddy
Copy link
Contributor Author

staddy commented Jan 31, 2023

@seanshpark,
I'm assuming we can handle node selection changed event from Netron (do you know if it's possible?).
So if the feature is enabled and a compatible node is selected a subwindow becomes visible.
The subwindow contains:

  • minimum and maximum weight values, weights shape, etc.
  • (if there are >2 axes with length > 1) a GUI to select 2 axes that should be used for heatmaps.
  • heatmap image(s) and a GUI to switch between different heatmaps.

Here is an example of existing software, that inspired us originally:
image
I will provide my GUI sketch as soon as I get familiar enough with ONE-vscode.

@seanshpark
Copy link
Contributor

seanshpark commented Jan 31, 2023

Thanks for the explanation! :)

from Netron (do you know if it's possible?).

I recommend to use CircleGraph which I modified as a common control(?) for circle graph view.

In media/CircleGraph/index.js, this handler is called when selection is changed.
You can follow caller or callee and understand how it works.
If you need more assist, please ping :)

  /**
   * @brief called from view.js for handle view events
   */
  onView(event) {
    if (event === "selection") {
      // there was a selection change and view requested to apply this
      let v = this._view.getSelection();
      vscode.postMessage({
        command: "selection",
        names: v.names,
        tensors: v.tensors,
      });
    }
  }

@staddy
Copy link
Contributor Author

staddy commented Feb 1, 2023

@seanshpark, thank you.
I also had a question about code in 'external' directory, can we modify it?

@seanshpark
Copy link
Contributor

I also had a question about code in 'external' directory, can we modify it?

files in external folder is copied as-is from upstream, without modification and without format check. purpose of this management is to make upgrade(change apply) from upstream a bit easier in IDE.

if you like to modify it, please make a copy to it's parent, modify caller code (like index.html).
parts of the code may be modified by the format checker, but resulting be harder to read.
you can add some directives like // clang-format off to prevent it; you can refer from existing codes in CircleGraph folder, but there is no strict rules for this.

@staddy
Copy link
Contributor Author

staddy commented Feb 3, 2023

@seanshpark, I've implemented basic visualization draft:
staddy@f2627b9
image
Planning to refactor the code and implement the following features:

  • Axes selector
  • Value selector
  • Value tooltip

@staddy
Copy link
Contributor Author

staddy commented Feb 6, 2023

@seanshpark, all planned items are implemented:
staddy@82bb390
staddy@e466802
staddy@b35c070
image
Should I create a pull request now?
Also is it ok to have standalone functions there?

@seanshpark
Copy link
Contributor

seanshpark commented Feb 6, 2023

Should I create a pull request now?

PR with one context per changes with comments explaining the purpose
would help review to understand the codes :)

See below comment.

Also is it ok to have standalone functions there?

I can't catch the meaning of standalone functions and there. Anyway we can see with the PRs.

@seanshpark
Copy link
Contributor

I don't have knowledge to understand the your new controls: axes selector and values selector,
and how they affect the graph rendering.
Some technical documents included in the change, not just codes, may help understand others
and to improve this functionality from others in the future.

@seanshpark
Copy link
Contributor

Should I create a pull request now?

Please post a working draft PR and let others see all the codes and try out before landing.

  • I don't fully understand the changes so below comments may be incorrect
  • I assume your current changes are for property side-bar window only.
  • I don't want you to change default behavior of the property side-bar of the graph view; you should add a flag to enable/disable it
  • Working draft means from the draft code, anyone can try out the new feature, but functionality may be imperfect with bugs.

@seanshpark
Copy link
Contributor

I think it would help if you can describe detailed UI to show weight visualization of the circle model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants