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

Add backend logic for bounding box plots #5250

Merged
merged 23 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 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
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
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I based the output off of iterative/dvclive#766 (comment) description, but this will most likely change and we will need to adjust accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to top, bottom, right, left based off the top-left corner after a discussion with Alex (see his comment):

image


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

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

export type Color = (typeof colorsList)[number]

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

const boundingBoxColorsList = [
sroy3 marked this conversation as resolved.
Show resolved Hide resolved
'#ff3838',
'#ff9d97',
'#ff701f',
'#ffb21d',
'#cfd231',
'#48f90a',
'#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