Skip to content

Commit ccea11b

Browse files
authored
Merge pull request #5540 from voxel51/fix/detections-non-dense
treat detections as non-dense by default
2 parents 56afa36 + f33c713 commit ccea11b

File tree

7 files changed

+275
-261
lines changed

7 files changed

+275
-261
lines changed

app/packages/state/src/labelsVisibility.test.ts

+34-20
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ import { describe, expect, it } from "vitest";
22
import { computeDefaultVisibleLabels } from "./labelsVisibility";
33

44
const sampleSchemaMock = {
5+
segmentation: {
6+
ftype: "fiftyone.core.labels.Segmentation",
7+
dbField: "segmentation",
8+
name: "segmentation",
9+
embeddedDocType: "fiftyone.core.labels.Segmentation",
10+
path: "segmentation",
11+
description: null,
12+
info: null,
13+
subfield: null,
14+
},
515
detection: {
6-
ftype: "fiftyone.core.labels.Detections",
16+
ftype: "fiftyone.core.labels.Detection",
717
dbField: "detection",
818
name: "detection",
9-
embeddedDocType: "fiftyone.core.labels.Detections",
19+
embeddedDocType: "fiftyone.core.labels.Detection",
1020
path: "detection",
1121
description: null,
1222
info: null,
@@ -25,12 +35,12 @@ const sampleSchemaMock = {
2535
} as const;
2636

2737
const frameSchemaMock = {
28-
detection: {
29-
ftype: "fiftyone.core.labels.Detections",
30-
dbField: "frames.detection",
31-
name: "detection",
32-
embeddedDocType: "fiftyone.core.labels.Detections",
33-
path: "detection",
38+
segmentation: {
39+
ftype: "fiftyone.core.labels.Segmentation",
40+
dbField: "frames.segmentation",
41+
name: "segmentation",
42+
embeddedDocType: "fiftyone.core.labels.Segmentation",
43+
path: "segmentation",
3444
description: null,
3545
info: null,
3646
subfield: null,
@@ -39,8 +49,8 @@ const frameSchemaMock = {
3949

4050
describe("computeDefaultVisibleLabels", () => {
4151
it("returns all non-dense labels when no config is provided", () => {
42-
const allSampleLabels = ["detection", "classification"];
43-
const allFrameLabels = ["frames.detection"];
52+
const allSampleLabels = ["segmentation", "detection", "classification"];
53+
const allFrameLabels = ["frames.segmentation"];
4454

4555
const result = computeDefaultVisibleLabels(
4656
sampleSchemaMock,
@@ -50,12 +60,12 @@ describe("computeDefaultVisibleLabels", () => {
5060
undefined
5161
);
5262

53-
expect(result).toEqual(["classification"]);
63+
expect(result).toEqual(["detection", "classification"]);
5464
});
5565

5666
it("respects 'include' config only", () => {
57-
const allSampleLabels = ["detection", "classification", "otherLabel"];
58-
const allFrameLabels = ["frames.detection"];
67+
const allSampleLabels = ["segmentation", "classification", "otherLabel"];
68+
const allFrameLabels = ["frames.segmentation"];
5969

6070
const result = computeDefaultVisibleLabels(
6171
sampleSchemaMock,
@@ -69,8 +79,8 @@ describe("computeDefaultVisibleLabels", () => {
6979
});
7080

7181
it("respects 'exclude' config only", () => {
72-
const allSampleLabels = ["detection", "classification", "otherLabel"];
73-
const allFrameLabels = ["frames.detection"];
82+
const allSampleLabels = ["segmentation", "classification", "otherLabel"];
83+
const allFrameLabels = ["frames.segmentation"];
7484

7585
const result = computeDefaultVisibleLabels(
7686
sampleSchemaMock,
@@ -80,24 +90,28 @@ describe("computeDefaultVisibleLabels", () => {
8090
{ exclude: ["classification"] }
8191
);
8292

83-
expect(result).toEqual(["detection", "otherLabel", "frames.detection"]);
93+
expect(result).toEqual([
94+
"segmentation",
95+
"otherLabel",
96+
"frames.segmentation",
97+
]);
8498
});
8599

86100
it("correctly applies both include & exclude", () => {
87-
const allSampleLabels = ["detection", "classification", "otherLabel"];
88-
const allFrameLabels = ["frames.detection"];
101+
const allSampleLabels = ["segmentation", "classification", "otherLabel"];
102+
const allFrameLabels = ["frames.segmentation"];
89103

90104
const result = computeDefaultVisibleLabels(
91105
sampleSchemaMock,
92106
frameSchemaMock,
93107
allSampleLabels,
94108
allFrameLabels,
95109
{
96-
include: ["detection", "classification", "otherLabel"],
110+
include: ["segmentation", "classification", "otherLabel"],
97111
exclude: ["classification"],
98112
}
99113
);
100114

101-
expect(result).toEqual(["detection", "otherLabel"]);
115+
expect(result).toEqual(["segmentation", "otherLabel"]);
102116
});
103117
});

app/packages/utilities/src/schema.ts

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ export const SEGMENTATION_EMBEDDED_DOC_TYPE =
55
export const HEATMAP_EMBEDDED_DOC_TYPE = "fiftyone.core.labels.Heatmap";
66

77
export const DENSE_LABEL_EMBEDDED_DOC_TYPES = [
8-
DETECTION_EMBEDDED_DOC_TYPE,
9-
DETECTIONS_EMBEDDED_DOC_TYPE,
108
SEGMENTATION_EMBEDDED_DOC_TYPE,
119
HEATMAP_EMBEDDED_DOC_TYPE,
1210
];

e2e-pw/package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
"type": "commonjs",
66
"license": "MIT",
77
"devDependencies": {
8-
"@eslint/js": "^9.19.0",
8+
"@eslint/js": "^9.21.0",
99
"@playwright/test": "^1.50.1",
10-
"@types/node": "^22.13.0",
10+
"@types/node": "^22.13.9",
1111
"@types/wait-on": "^5.3.4",
12-
"@typescript-eslint/eslint-plugin": "^8.22.0",
13-
"@typescript-eslint/parser": "^8.22.0",
12+
"@typescript-eslint/eslint-plugin": "^8.26.0",
13+
"@typescript-eslint/parser": "^8.26.0",
1414
"dotenv": "^16.4.7",
15-
"eslint": "^9.19.0",
15+
"eslint": "^9.21.0",
1616
"eslint-plugin-playwright": "^2.2.0",
1717
"jimp": "^1.6.0",
18-
"mongodb": "^6.13.0",
18+
"mongodb": "^6.14.2",
1919
"tree-kill": "^1.2.2",
2020
"ts-dedent": "^2.2.0",
21-
"typescript": "^5.7.3",
22-
"typescript-eslint": "^8.22.0",
23-
"vitest": "^3.0.5",
21+
"typescript": "^5.8.2",
22+
"typescript-eslint": "^8.26.0",
23+
"vitest": "^3.0.7",
2424
"wait-on": "^8.0.2"
2525
},
2626
"scripts": {
@@ -34,5 +34,5 @@
3434
"devserver": "VITE_API=http://localhost:8787 VITE_NO_STATE=true FIFTYONE_DEFAULT_APP_PORT=5193 && (cd ../app && yarn dev --host 0.0.0.0)",
3535
"remove-pw-dbs": "./scripts/del-pw-dbs.sh"
3636
},
37-
"packageManager": "yarn@4.3.1"
37+
"packageManager": "yarn@4.7.0"
3838
}

e2e-pw/src/oss/poms/grid/index.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Locator, Page, expect } from "src/oss/fixtures";
2+
import { Duration } from "src/oss/utils";
23
import { EventUtils } from "src/shared/event-utils";
34
import { GridActionsRowPom } from "../action-row/grid-actions-row";
45
import { GridSliceSelectorPom } from "../action-row/grid-slice-selector";
56
import { GridTaggerPom } from "../action-row/tagger/grid-tagger";
67
import { UrlPom } from "../url";
7-
import { Duration } from "src/oss/utils";
88

99
export class GridPom {
1010
readonly assert: GridAsserter;
@@ -65,17 +65,19 @@ export class GridPom {
6565
}
6666

6767
async scrollBottom() {
68-
return this.getForwardSection()
69-
.locator("div")
70-
.last()
71-
.scrollIntoViewIfNeeded({ timeout: Duration.Seconds(20) });
68+
const forwardSectionDiv = this.getForwardSection().locator("div").last();
69+
await forwardSectionDiv.waitFor({ state: "visible" });
70+
return forwardSectionDiv.scrollIntoViewIfNeeded({
71+
timeout: Duration.Seconds(20),
72+
});
7273
}
7374

7475
async scrollTop() {
75-
return this.getBackwardSection()
76-
.locator("div")
77-
.first()
78-
.scrollIntoViewIfNeeded({ timeout: Duration.Seconds(20) });
76+
const backwardSectionDiv = this.getBackwardSection().locator("div").first();
77+
await backwardSectionDiv.waitFor({ state: "visible" });
78+
return backwardSectionDiv.scrollIntoViewIfNeeded({
79+
timeout: Duration.Seconds(20),
80+
});
7981
}
8082

8183
async selectSlice(slice: string) {

e2e-pw/src/oss/specs/sidebar/sidebar.spec.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ test.describe.serial("sidebar-filter-visibility", () => {
3939
sidebar,
4040
eventUtils,
4141
}) => {
42-
// only show ground_truth
43-
await sidebar.clickFieldCheckbox("ground_truth");
42+
// only show ground_truth (on by default), hide predictions
43+
await sidebar.clickFieldCheckbox("predictions");
44+
4445
const entryExpandPromise = eventUtils.getEventReceivedPromiseForPredicate(
4546
"animation-onRest",
4647
() => true
@@ -95,8 +96,8 @@ test.describe.serial("sidebar-filter-visibility", () => {
9596
sidebar,
9697
eventUtils,
9798
}) => {
98-
// only show ground_truth
99-
await sidebar.clickFieldCheckbox("ground_truth");
99+
// only show ground_truth (on by default), hide predictions
100+
await sidebar.clickFieldCheckbox("predictions");
100101

101102
const entryExpandPromise = eventUtils.getEventReceivedPromiseForPredicate(
102103
"animation-onRest",
@@ -153,8 +154,8 @@ test.describe.serial("sidebar-filter-visibility", () => {
153154
sidebar,
154155
eventUtils,
155156
}) => {
156-
// only show ground_truth
157-
await sidebar.clickFieldCheckbox("ground_truth");
157+
// only show ground_truth (on by default), hide predictions
158+
await sidebar.clickFieldCheckbox("predictions");
158159

159160
const entryExpandPromise = eventUtils.getEventReceivedPromiseForPredicate(
160161
"animation-onRest",
@@ -212,8 +213,9 @@ test.describe.serial("sidebar-filter-visibility", () => {
212213
sidebar,
213214
eventUtils,
214215
}) => {
215-
// only show ground_truth
216-
await sidebar.clickFieldCheckbox("ground_truth");
216+
// only show ground_truth (on by default), hide predictions
217+
await sidebar.clickFieldCheckbox("predictions");
218+
217219
const entryExpandPromise = eventUtils.getEventReceivedPromiseForPredicate(
218220
"animation-onRest",
219221
() => true

e2e-pw/src/oss/specs/smoke-tests/tagger.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ test.beforeAll(async ({ fiftyoneLoader, foWebServer }) => {
3838
});
3939
});
4040

41-
test.beforeEach(async ({ page, fiftyoneLoader, sidebar }) => {
41+
test.beforeEach(async ({ page, fiftyoneLoader }) => {
4242
await fiftyoneLoader.waitUntilGridVisible(page, datasetName);
43-
await sidebar.clickFieldCheckbox("ground_truth");
44-
await sidebar.clickFieldCheckbox("predictions");
4543
});
4644

4745
test.describe.serial("tag", () => {

0 commit comments

Comments
 (0)