Skip to content

Projector: Metadata editor #753

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

Merged

Conversation

francoisluus
Copy link
Contributor

@francoisluus francoisluus commented Nov 19, 2017

Add a metadata editor to the Projector, which gives the option to modify attributes of selected points. Projector components related to metadata display are refreshed after attribute changes, which also expands the color palette for the modified attribute when a new class is added.

This is very helpful to make alterations and corrections to an existing labeling, although changes are only made in the browser session, but a modified metadata file can be downloaded.

Demo here: http://tensorserve.com:6018

git clone https://github.com/francoisluus/tensorboard-supervise.git
cd tensorboard-supervise
git checkout 43127d0a33d02ce06fdeb3e39e1e9822cf52c4d4
bazel run tensorboard -- --logdir /home/$USER/emnist-2000 --host 0.0.0.0 --port 6018

Supersedes:

  1. Projector: Metadata editor #709 Projector: Metadata editor
  2. Projector: Metadata editor #739 Projector: Metadata editor (closed due to too many conflicts with vz_projector namespace changes)

Superseded by #756, which integrates the metadata editor and supervision. Though this PR may be merged first and then #756 as there likely shouldn't be any conflicts.

@dsmilkov - This is currently the best version of the metadata editor to merge. Simplified the metadata editor status messaging, but we could consider using existing sample sizes of applied labels in future.

Design and behavior

  1. The metadata editor uses a new 'Edit by' dropdown-menu and adds a paper-input for typing label name and a paper-button to label selected points with provided label.
  2. A metadata download button is added that downloads modified metadata as a .tsv file.
  3. The label button is disabled if no selection has been made, or if no label has been specified, or if a numeric label is required but not provided.
  4. Multiline floating label is set for the metadata label paper-input to accommodate status messaging for longer labels.
  5. A metadata search is done to find the number of existing samples with the specified label.
  6. Projector components related to metadata display are refreshed after attribute changes, which also expands the color palette for the modified attribute when a new class is added.
  7. metadataChanged() is invoked in the projector after a metadata edit, which normally resets the attribute choices in the data panel and inspector panel. It is proposed that if there is an existing selection it should be retained if it is valid choice, which means that if another metadata file is loaded and it contains the selection it would be preferred.

Data panel before

screen shot 2017-11-19 at 5 17 51 pm

Data panel with metadata editor

screen shot 2017-12-11 at 4 07 10 pm

screen shot 2017-12-11 at 4 07 27 pm

screen shot 2017-12-11 at 4 08 11 pm

Status updates in metadata editor

screen shot 2017-12-11 at 4 08 59 pm

screen shot 2017-12-11 at 4 09 15 pm

screen shot 2017-12-11 at 4 09 28 pm

screen shot 2017-12-11 at 4 09 47 pm

screen shot 2017-12-11 at 4 10 11 pm

screen shot 2017-12-11 at 4 11 21 pm

screen shot 2017-12-11 at 4 11 40 pm

Add a metadata editor to the Projector, which gives the option to
modify attributes of selected points. Projector components related to
metadata display are refreshed after attribute changes, which also
expands the color palette for the modified attribute when a new class
is added. The main 'Label by' dropdown-menu is incorporated into the
metadata editor, which requires the user to view the point labels for
the metadata column being changed.
@nsthorat
Copy link
Contributor

nsthorat commented Dec 7, 2017

This is a wonderful change. Thank you for the detailed notes and screenshots, this really makes the review quite easy :)

One high level comment:

PointMetadata also contains a type: https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/projector/vz_projector/data.ts#L20

What do you think of enforcing the type? This way, you wont run into mixing and matching problems when we try to do things like coloring by a metadata field by a continuous value.


Review status: 0 of 4 files reviewed at latest revision, 6 unresolved discussions.


tensorboard/plugins/projector/vz_projector/vz-projector-data-panel.ts, line 133 at r1 (raw file):

    this.updateMetadataUI(this.spriteAndMetadata.stats, this.metadataFile);
    

remove this blank line


tensorboard/plugins/projector/vz_projector/vz-projector-data-panel.ts, line 135 at r1 (raw file):

    
    if (this.selectedColorOptionName == null || this.colorOptions.filter(c =>
        c.name == this.selectedColorOptionName).length == 0) {

use "===" everywhere except for "== null".

=== is exact equality, == will do an implicit cast (so when you check null it will also check undefined)

here and below


tensorboard/plugins/projector/vz_projector/vz-projector-data-panel.ts, line 254 at r1 (raw file):

    let selectionSize = this.selectedPointIndices.length + 
        this.neighborsOfFirstPoint.length;
    

remove this blank line


tensorboard/plugins/projector/vz_projector/vz-projector-data-panel.ts, line 264 at r1 (raw file):

        }
        else {
          this.metadataEditorInputLabel = 

remove trailing space


tensorboard/plugins/projector/vz_projector/vz-projector-data-panel.ts, line 301 at r1 (raw file):

        this.projector.dataSet.points[i].metadata[this.metadataEditorColumn] =
        this.metadataEditorInput);
    

remove the spaces


tensorboard/plugins/projector/vz_projector/vz-projector-data-panel.ts, line 305 at r1 (raw file):

        this.projector.dataSet.points[p.index]
            .metadata[this.metadataEditorColumn] = this.metadataEditorInput);
    

remove the spaces


Comments from Reviewable

Corrected spacing and now checking for exact non-cast equalities,
according to pull request feedback.
@francoisluus
Copy link
Contributor Author

@nsthorat Please check the newest corrections, based on your feedback, thanks.

To enforce a number-only metadata column will require checking isNumeric in the ColumnStats, adding a check and extra status message in the metadata editor with a label-button disabling. This is sensible and a relatively minor addition to make, thanks for the suggestion.

As there are some other additions to the metadata editor already integrated into some of the open PRs, such as the metadata context and keybindings, I'd like to add the type-enforcing on top of those to prevent conflicts with existing PRs so as to speed up merging.

Alas, I believe it will be necessary to separate the display column (currently used for metadata editor) and an edited column so that one can edit metadata while viewing other metadata. This becomes important when working with text data where there is no other visual representation available as with images having sprites.

Actually, to be prudent, I think I should make all these additions here to get the metadata editor as solid as possible. Then I'll just fix conflicts for later PRs.

Allow for the metadata editor label paper-input to capture Enter
keydown as a Label button press. Now button becomes disabled upon
application of a label, then the labeling is applied, then the metadata
editor paper-input status message confirms application.
Check if metadata column isNumeric, and disable label button if label
input is not numeric. This enforces isNumeric metadata columns to
remain numeric when label changes are made.
Reintroduce 'Label by' field, which is necessary to view text-based
data representations while labeling in another 'Edit by' field.
Add a metadata context to the inspector panel, showing the available
labels and label counts for the 'Edit by' metadata column. By clicking
a label in this list it is immediately applied to the point selection,
which makes it easier to modify metadata with longer labels since they
do not have to be entered every time.

Metadata context is entered whenever there is content in the metadata
editor label field, as soon as the field is cleared the context is
removed. While in metadata context the neighborhood size can still be
changed, and a label search can be performed to highlight points with a
certain label not necessarily from the same metadata column. This adds
versatility in locating point groups with a specified label while being
able to quickly modify the metadata.
Properly disable metadata edit for non-numeric inputs where isNumeric
required.
Add download button to data panel to allow for download of metadata
with label modifications that may have been made. Filename is hardcoded
to 'metadata-edited.tsv' and set as text blob.
Replace == with === in inspector-panel code.
@francoisluus
Copy link
Contributor Author

francoisluus commented Dec 11, 2017

@nsthorat The metadata editor is now fully fledged and can be merged after inspection, please check the newest demo at http://tensorserve.com:6018 .

@nsthorat
Copy link
Contributor

:lgtm:


Review status: 0 of 5 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@nsthorat
Copy link
Contributor

Looks like I can't merge this +@chihuahua

@chihuahua chihuahua self-requested a review December 11, 2017 18:32
Copy link
Member

@chihuahua chihuahua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving because reviewable didn't seem to trigger approval of the PR.

@chihuahua chihuahua merged commit adbb994 into tensorflow:master Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants