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 default labels visibility in dataset app config + selective labels rendering optimization #5356

Merged
merged 80 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3ea9474
add default_visibility_labels to dataset app config
sashankaryal Dec 3, 2024
7b87e36
update gql for new app config
sashankaryal Dec 3, 2024
b4d0167
add selector for default visibility labels
sashankaryal Dec 3, 2024
b6d3d7d
add function to get dense labels list
sashankaryal Dec 5, 2024
0b01360
new hook for setting sidebar labels
sashankaryal Dec 5, 2024
8efbc3e
update _activeFields to respect default labels from app config (pendi…
sashankaryal Dec 6, 2024
91f8b67
move color resolver to another module
sashankaryal Dec 6, 2024
4957995
remove unused indexed png decoder code
sashankaryal Dec 6, 2024
a0beb46
add .env to gitignore
sashankaryal Dec 20, 2024
627b130
don't process overlays if path is there but overlay not decoded
sashankaryal Dec 20, 2024
3a8745f
pass activepaths to worker
sashankaryal Jan 6, 2025
5cbeb21
add refreshSample
sashankaryal Jan 6, 2025
43e4400
add render status
sashankaryal Jan 6, 2025
aef6244
remove redundant guard
sashankaryal Jan 6, 2025
de91567
refresh layout when sidebar is updated
sashankaryal Jan 6, 2025
3a38be8
remove decodeLabelOverlay
sashankaryal Jan 6, 2025
b8f6f83
fix modal
sashankaryal Jan 7, 2025
97b2857
better name
sashankaryal Jan 7, 2025
3c0c1ba
Remove unnecessary log
sashankaryal Jan 7, 2025
001476d
retry update sample
sashankaryal Jan 7, 2025
c244254
add painting status
sashankaryal Jan 7, 2025
72cb00c
add guard in painting loop
sashankaryal Jan 8, 2025
7864542
use local recoil state
sashankaryal Jan 8, 2025
9184f6b
remove fix me guard
sashankaryal Jan 8, 2025
d7cdfc5
use lru cache in color resolver
sashankaryal Jan 8, 2025
aca1679
add null check in visibility labels selector
sashankaryal Jan 9, 2025
ff4a318
sample id fallback to _id
sashankaryal Jan 9, 2025
b663582
sample id fallback to _id
sashankaryal Jan 9, 2025
89bf446
pass activepaths in frames
sashankaryal Jan 9, 2025
63211fe
explicit type for lru color cache
sashankaryal Jan 9, 2025
06a5fc3
fix cache
sashankaryal Jan 9, 2025
21a1b1a
impl default visibility for frames
sashankaryal Jan 10, 2025
b1654c0
add sample guard in refreshSample
sashankaryal Jan 11, 2025
45a6610
use more granular strategy for caching
sashankaryal Jan 11, 2025
216a374
move sync and check logic to another file and add unit tests
sashankaryal Jan 11, 2025
2accf0c
remove debug log
sashankaryal Jan 11, 2025
02d4338
fix modal
sashankaryal Jan 11, 2025
ae896a8
enable ground truth in sidebar tests
sashankaryal Jan 14, 2025
160f56a
enable ground truth and predictions in tagger e2e test
sashankaryal Jan 14, 2025
d7f371a
unit test default visible labels computation
sashankaryal Jan 14, 2025
f06c0d0
recolor already processed labels
sashankaryal Feb 3, 2025
140fadc
add more granular async labels processor with job queue
sashankaryal Feb 4, 2025
f971c38
add unit tests
sashankaryal Feb 4, 2025
9d29e3b
use async rendering in modal, too
sashankaryal Feb 4, 2025
0cb62a9
return after updating sample in refreshSample
sashankaryal Feb 4, 2025
8ab243f
add timeout for updating
sashankaryal Feb 4, 2025
a84dd31
rerender label fields in pending state, too
sashankaryal Feb 4, 2025
1a4cfab
return null where worker isn't supported
sashankaryal Feb 4, 2025
418bffd
more resilience in waitUntilGridVisible
sashankaryal Feb 4, 2025
fc8c1b9
reload if dataset not selected properly
sashankaryal Feb 4, 2025
e8980a2
wait until dom content loaded
sashankaryal Feb 4, 2025
e4385c6
better types, add docstrings
sashankaryal Feb 4, 2025
e951f61
couple bbox and mask painting
sashankaryal Feb 4, 2025
a268c3b
reset on dataset change
sashankaryal Feb 4, 2025
d8a0616
merge/replace for same sample
sashankaryal Feb 4, 2025
0c98619
fix reconciliation bug
sashankaryal Feb 4, 2025
b86b6b0
add clean_start args again
sashankaryal Feb 4, 2025
1cd00b7
turn loop off in imavid testing
sashankaryal Feb 4, 2025
ec08721
make imavid playUntilFrames more resilient
sashankaryal Feb 5, 2025
0ef338f
call update options regardless of whether refreshsample is called or not
sashankaryal Feb 5, 2025
27d08ec
add guard for mask in containsPoint
sashankaryal Feb 5, 2025
4d6a75a
fix video overalys rendering in grid
sashankaryal Feb 5, 2025
8788c66
fix pluckRelevant bug
sashankaryal Feb 5, 2025
e3afb1e
call update options multiple times
sashankaryal Feb 5, 2025
06019f5
fix frames merging bug
sashankaryal Feb 5, 2025
87f425c
don't create callback in every render
sashankaryal Feb 5, 2025
432306f
move selective rendering hook for modal to separate file
sashankaryal Feb 5, 2025
9c98e52
better imavid handling
sashankaryal Feb 5, 2025
d9578a9
fix setTargetsToNull bug
sashankaryal Feb 5, 2025
a84f781
fix redundant update sample
sashankaryal Feb 6, 2025
d71d8b5
fix modal video (hacky, refresh whole sample)
sashankaryal Feb 6, 2025
b297586
optimize modal imavid labels repainting
sashankaryal Feb 6, 2025
a7d8823
add uuid to looker
sashankaryal Feb 6, 2025
b506bbb
optimize imavid labels rendering in grid, too
sashankaryal Feb 6, 2025
f741c7f
use constants for render status
sashankaryal Feb 6, 2025
f7544a1
exhaustive deps in hook
sashankaryal Feb 6, 2025
a96c71e
don't rerender when options changes
sashankaryal Feb 6, 2025
3ec947c
fix coloring bug in imavid
sashankaryal Feb 7, 2025
b175c04
simpler hash
sashankaryal Feb 7, 2025
5d577ff
add guard for undefined bitmap
sashankaryal Feb 7, 2025
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ dist/
coverage.xml
.coverage.*
pyvenv.cfg

.env

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/packages/core/src/components/Dataset.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useTrackEvent } from "@fiftyone/analytics";
import { subscribe } from "@fiftyone/relay";
import { isModalActive } from "@fiftyone/state";
import React, { useEffect } from "react";
import { useRecoilValue } from "recoil";
import styled from "styled-components";
import ColorModal from "./ColorModal/ColorModal";
import { activeColorEntry } from "./ColorModal/state";
import EventTracker from "./EventTracker";
import Modal from "./Modal";
import SamplesContainer from "./SamplesContainer";
import EventTracker from "./EventTracker";
import { useTrackEvent } from "@fiftyone/analytics";

const Container = styled.div`
height: 100%;
Expand Down
26 changes: 25 additions & 1 deletion app/packages/core/src/components/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import React, {
useRef,
useState,
} from "react";
import { useRecoilValue } from "recoil";
import { useRecoilCallback, useRecoilValue } from "recoil";
import { v4 as uuid } from "uuid";
import { QP_WAIT, QueryPerformanceToastEvent } from "../QueryPerformanceToast";
import { gridActivePathsLUT } from "../Sidebar/useDetectNewActiveLabelFields";
import { gridCrop, gridSpacing, pageParameters } from "./recoil";
import useAt from "./useAt";
import useEscape from "./useEscape";
Expand Down Expand Up @@ -46,6 +47,16 @@ function Grid() {
const setSample = fos.useExpandSample(store);
const getFontSize = useFontSize(id);

const getCurrentActiveLabelFields = useRecoilCallback(
({ snapshot }) =>
() => {
return snapshot
.getLoadable(fos.activeLabelFields({ modal: false }))
.getValue();
},
[]
);

const spotlight = useMemo(() => {
/** SPOTLIGHT REFRESHER */
reset;
Expand All @@ -61,6 +72,7 @@ function Grid() {
const looker = lookerStore.get(id.description);
looker?.destroy();
lookerStore.delete(id.description);
gridActivePathsLUT.delete(id.description);
},
detach: (id) => {
const looker = lookerStore.get(id.description);
Expand Down Expand Up @@ -101,6 +113,18 @@ function Grid() {
);
lookerStore.set(id.description, looker);
looker.attach(element, dimensions);

// initialize active paths tracker
const currentActiveLabelFields = getCurrentActiveLabelFields();
if (
currentActiveLabelFields &&
!gridActivePathsLUT.has(id.description)
) {
gridActivePathsLUT.set(
id.description,
new Set(currentActiveLabelFields)
);
}
},
scrollbar: true,
spacing,
Expand Down
28 changes: 16 additions & 12 deletions app/packages/core/src/components/Grid/useRefreshers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { LRUCache } from "lru-cache";
import { useEffect, useMemo } from "react";
import uuid from "react-uuid";
import { useRecoilValue } from "recoil";
import { gridActivePathsLUT } from "../Sidebar/useDetectNewActiveLabelFields";
import { gridAt, gridOffset, gridPage } from "./recoil";

const MAX_LRU_CACHE_ITEMS = 510;
Expand Down Expand Up @@ -64,27 +65,30 @@ export default function useRefreshers() {
return uuid();
}, [layoutReset, pageReset]);

useEffect(
() =>
subscribe(({ event }, { reset }) => {
if (event === "fieldVisibility") return;
useEffect(() => {
const unsubscribe = subscribe(({ event }, { reset }) => {
if (event === "fieldVisibility") return;

// if not a modal page change, reset the grid location
reset(gridAt);
reset(gridPage);
reset(gridOffset);
}),
[]
);
// if not a modal page change, reset the grid location
reset(gridAt);
reset(gridPage);
reset(gridOffset);
});

return () => {
unsubscribe();
};
}, []);

const lookerStore = useMemo(() => {
/** LOOKER STORE REFRESHER */
reset;
/** LOOKER STORE REFRESHER */

return new LRUCache<string, fos.Lookers>({
dispose: (looker) => {
dispose: (looker, id) => {
looker.destroy();
gridActivePathsLUT.delete(id);
},
max: MAX_LRU_CACHE_ITEMS,
noDisposeOnSet: true,
Expand Down
Loading
Loading