Skip to content

Confidence sort brandon#603

Merged
subdavis merged 4 commits into
client/confidence-sortfrom
confidence-sort-brandon
Feb 25, 2021
Merged

Confidence sort brandon#603
subdavis merged 4 commits into
client/confidence-sortfrom
confidence-sort-brandon

Conversation

@subdavis
Copy link
Copy Markdown
Contributor

There was still an off-by-1 issue with this function. If you provided additionalNum > confidencePairs.length - 1 you'd end up with a height miscalculation for lines n>1

Screenshot from 2021-02-25 10-29-13

However, I think the function was generally more complicated than it needed to be. Here's a version with a simple maxLines arg that will show up to maxLines rows. You don't have to think about any off-by-one conditions because there's just a single loop and no special external conditions or break condition.

Copy link
Copy Markdown
Collaborator

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

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

I like it simplified but I think we need to account for indices outside of the max pairs number.

Comment thread client/src/layers/TextLayer.ts Outdated
* @returns value or null. null indicates that the text should not be displayed.
*/
function defaultFormatter(track: FrameDataTrack, additionalNum = 0): TextData[] | null {
function defaultFormatter(track: FrameDataTrack, maxPairs = 3, lineHeight = 20): TextData[] | null {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Only thing is if we want to have maxPairs = 3 right now given how cluttered it could look for datasets with a lot of detections on screen at once?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh sure, I can reduce that to 1.

currentHeight += lineHeight;
pairCount += 1;
}
const totalVisiblePairs = Math.min(track.confidencePairs.length, maxPairs);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What if my trackType is outside of the maxPairs number? We don't re-sort the pairs list when changing filter or altering types we change the index into the currentPairs list for the getType. So if max pairs was 3 and my currentPairIndex was 9 you wouldn't have the proper name associated with the current type.

maxPairs.mp4

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Addressed in 1e69ab8

@BryonLewis BryonLewis self-requested a review February 25, 2021 16:27
Copy link
Copy Markdown
Collaborator

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

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

looks good

@subdavis subdavis merged commit 1fccd2f into client/confidence-sort Feb 25, 2021
@subdavis subdavis deleted the confidence-sort-brandon branch February 25, 2021 16:28
BryonLewis added a commit that referenced this pull request Feb 25, 2021
* Fixing confidence sorting

* Switched to useFilteredTracks

* Modify trackdata for types

* Adding in text display and filtering

* updating for the defaultFormatter to work

* mend

* Updating text displaying

* fix unused

* Update client/src/use/useTrackFilters.ts

Co-authored-by: Brandon Davis <brandon.davis@kitware.com>

* Update client/src/use/useLineChart.ts

Co-authored-by: Brandon Davis <brandon.davis@kitware.com>

* Update client/src/use/useTrackFilters.ts

Co-authored-by: Brandon Davis <brandon.davis@kitware.com>

* addressing comments

* converting getType to remove null return type

* some final fixes

* Confidence sort brandon (#603)

* defaultFormatter

* simpler syntax

* comments

* Change line height

Co-authored-by: Brandon Davis <brandon.davis@kitware.com>
subdavis added a commit that referenced this pull request Mar 1, 2021
* Fixing confidence sorting

* Switched to useFilteredTracks

* Modify trackdata for types

* Adding in text display and filtering

* updating for the defaultFormatter to work

* mend

* Updating text displaying

* fix unused

* Update client/src/use/useTrackFilters.ts

Co-authored-by: Brandon Davis <brandon.davis@kitware.com>

* Update client/src/use/useLineChart.ts

Co-authored-by: Brandon Davis <brandon.davis@kitware.com>

* Update client/src/use/useTrackFilters.ts

Co-authored-by: Brandon Davis <brandon.davis@kitware.com>

* addressing comments

* converting getType to remove null return type

* some final fixes

* Confidence sort brandon (#603)

* defaultFormatter

* simpler syntax

* comments

* Change line height

Co-authored-by: Bryon Lews <Bryon.Lewis@kitware.com>
Co-authored-by: BryonLewis <61746913+BryonLewis@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants