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

Improve bounding box frontend components #5305

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d32537c
move classes into its own collapsible row
julieg18 Jan 26, 2024
f6fb6c2
keep the same classnames for cells
julieg18 Jan 26, 2024
169384b
Store bounding box plot coordinates in single obj
julieg18 Jan 26, 2024
91c905e
Merge branch 'bounding-boxes' into stop-passing-bb-coords-as-props
julieg18 Jan 26, 2024
9045ab0
first iteration of backend code addition
julieg18 Jan 30, 2024
1e76753
Remove frontend bounding box fixture code
julieg18 Jan 30, 2024
2c85d58
fix bug in bb fixture
julieg18 Jan 30, 2024
ef0b553
fix bug in tests
julieg18 Jan 31, 2024
0692a99
Merge branch 'bounding-boxes' into stop-passing-bb-coords-as-props
julieg18 Jan 31, 2024
8cace73
fix merge conflicts
julieg18 Jan 31, 2024
ba4bdd0
fix typo
julieg18 Jan 31, 2024
b1abf5d
Merge branch 'stop-passing-bb-coords-as-props' into add-bb-backend-logic
julieg18 Jan 31, 2024
dd431e1
add toggle comparison class logic and additional tests
julieg18 Feb 1, 2024
d240272
Merge branch 'bounding-boxes' into add-bb-backend-logic
julieg18 Feb 1, 2024
4da57cb
final lookover
julieg18 Feb 1, 2024
d09e5f0
Update coordinate system
julieg18 Feb 2, 2024
646306a
apply review comments
julieg18 Feb 2, 2024
86767f6
update schema
julieg18 Feb 14, 2024
7fce713
Merge branch 'bounding-boxes' into add-bb-backend-logic
julieg18 Feb 15, 2024
0176f1a
move colors and use var when collecting plot class details
julieg18 Feb 15, 2024
ff95253
rely on collected comparison plots when grabbing selected class boxes
julieg18 Feb 15, 2024
c6e59f0
add additional optimisation
julieg18 Feb 15, 2024
06b6f5b
fix typo
julieg18 Feb 15, 2024
9535cd3
first iteration
julieg18 Feb 16, 2024
7dc8696
Merge branch 'add-bb-backend-logic' into improve-bounding-box-frontend
julieg18 Feb 16, 2024
681f914
add show more logic and tests
julieg18 Feb 16, 2024
00ab35b
fix bug
julieg18 Feb 16, 2024
56873dc
Fix slice typo
julieg18 Feb 20, 2024
3af7101
Next iteration based on review
julieg18 Feb 20, 2024
dc9cb8a
improve storybook and remove onclick
julieg18 Feb 20, 2024
729067e
Merge branch 'bounding-boxes' into improve-bounding-box-frontend
julieg18 Feb 20, 2024
f2f082f
Merge branch 'bounding-boxes' into improve-bounding-box-frontend
julieg18 Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions extension/src/cli/dvc/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,16 @@ export type TemplatePlotOutput = {
type: PlotsType
}

export type BoundingBox = {
box: { left: number; right: number; top: number; bottom: number }
score: number
}

export type ImagePlotOutput = {
revisions: string[]
type: PlotsType
url: string
boxes?: { [label: string]: BoundingBox[] }
}

export type PlotOutput = TemplatePlotOutput | ImagePlotOutput
Expand Down
40 changes: 40 additions & 0 deletions extension/src/common/colors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const colorsList = [
'#945dd6',
'#13adc7',
'#f46837',
'#48bb78',
'#4299e1',
'#ed8936',
'#f56565'
] as const

export type Color = (typeof colorsList)[number]

export const copyOriginalColors = (): Color[] => [...colorsList]

const boundingBoxColorsList = [
'#ff3838',
'#ff9d97',
'#ff701f',
'#ffb21d',
'#cfd231',
'#92cc17',
'#3ddb86',
'#1a9334',
'#00d4bb',
'#2c99a8',
'#00c2ff',
'#344593',
'#6473ff',
'#0018ec',
'#8438ff',
'#520085',
'#cb38ff',
'#ff95c8',
'#ff37c7'
] as const

export type BoundingBoxColor = (typeof boundingBoxColorsList)[number]

export const getBoundingBoxColor = (ind: number): BoundingBoxColor =>
boundingBoxColorsList[ind % boundingBoxColorsList.length]
2 changes: 1 addition & 1 deletion extension/src/experiments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
pickFilterToAdd,
pickFiltersToRemove
} from './model/filterBy/quickPick'
import { Color } from './model/status/colors'
import { MAX_SELECTED_EXPERIMENTS, UNSELECTED } from './model/status'
import { starredSort } from './model/sortBy/constants'
import { pickSortsToRemove, pickSortToAdd } from './model/sortBy/quickPick'
Expand All @@ -39,6 +38,7 @@ import { Experiment, ColumnType, TableData, Column } from './webview/contract'
import { WebviewMessages } from './webview/messages'
import { DecorationProvider } from './model/decorationProvider'
import { starredFilter } from './model/filterBy/constants'
import { Color } from '../common/colors'
import { ResourceLocator } from '../resourceLocator'
import { AvailableCommands, InternalCommands } from '../commands/internal'
import {
Expand Down
2 changes: 1 addition & 1 deletion extension/src/experiments/model/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { join } from 'path'
import { commands } from 'vscode'
import { ExperimentsModel } from '.'
import { copyOriginalColors } from './status/colors'
import { copyOriginalColors } from '../../common/colors'
import gitLogFixture from '../../test/fixtures/expShow/base/gitLog'
import rowOrderFixture from '../../test/fixtures/expShow/base/rowOrder'
import outputFixture from '../../test/fixtures/expShow/base/output'
Expand Down
2 changes: 1 addition & 1 deletion extension/src/experiments/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {
collectSelectedColors,
collectStartedRunningExperiments
} from './status/collect'
import { Color, copyOriginalColors } from './status/colors'
import { canSelect, ColoredStatus, UNSELECTED } from './status'
import { collectFlatExperimentParams } from './modify/collect'
import { Color, copyOriginalColors } from '../../common/colors'
import {
Commit,
Experiment,
Expand Down
2 changes: 1 addition & 1 deletion extension/src/experiments/model/status/collect.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UNSELECTED } from '.'
import { collectColoredStatus } from './collect'
import { copyOriginalColors } from './colors'
import { copyOriginalColors } from '../../../common/colors'
import { Experiment } from '../../webview/contract'
import {
ExecutorStatus,
Expand Down
2 changes: 1 addition & 1 deletion extension/src/experiments/model/status/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
tooManySelected,
UNSELECTED
} from '.'
import { Color, copyOriginalColors } from './colors'
import { Color, copyOriginalColors } from '../../../common/colors'
import { hasKey } from '../../../util/object'
import { Experiment, isQueued, RunningExperiment } from '../../webview/contract'
import { definedAndNonEmpty, reorderListSubset } from '../../../util/array'
Expand Down
13 changes: 0 additions & 13 deletions extension/src/experiments/model/status/colors.ts

This file was deleted.

2 changes: 1 addition & 1 deletion extension/src/experiments/model/status/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { canSelect, limitToMaxSelected } from '.'
import { copyOriginalColors } from './colors'
import { copyOriginalColors } from '../../../common/colors'
import { Experiment } from '../../webview/contract'
import { ExecutorStatus } from '../../../cli/dvc/contract'

Expand Down
2 changes: 1 addition & 1 deletion extension/src/experiments/model/status/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color } from './colors'
import { Color } from '../../../common/colors'
import { Experiment, isRunning } from '../../webview/contract'

export const MAX_SELECTED_EXPERIMENTS = 7
Expand Down
1 change: 1 addition & 0 deletions extension/src/persistence/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export enum PersistenceKey {
PLOT_SELECTED_METRICS = 'plotSelectedMetrics:',
PLOTS_SMOOTH_PLOT_VALUES = 'plotSmoothPlotValues:',
PLOTS_COMPARISON_MULTI_PLOT_VALUES = 'plotComparisonMultiPlotValues:',
PLOTS_COMPARISON_CLASSES_SELECTED = 'plotComparisonClassesSelected:',
PLOT_TEMPLATE_ORDER = 'plotTemplateOrder:',
SHOW_ONLY_CHANGED = 'columnsShowOnlyChanged:'
}
Expand Down
3 changes: 2 additions & 1 deletion extension/src/plots/model/collect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ describe('collectData', () => {
])

const heatmapPlot = join('plots', 'heatmap.png')
const boundingBoxPlot = join('plots', 'bounding_boxes.png')

expect(Object.keys(comparisonData.main)).toStrictEqual([
join('plots', 'acc.png'),
heatmapPlot,
join('plots', 'loss.png'),
join('plots', 'image'),
join('plots', 'bounding_boxes.png')
boundingBoxPlot
])

const testBranchHeatmap = comparisonData['test-branch'][heatmapPlot]
Expand Down
Loading
Loading