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

Fix Looker Classifications handing #5322

Merged
merged 9 commits into from
Jan 3, 2025
Merged
20 changes: 13 additions & 7 deletions app/packages/looker/src/lookers/abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import { Events } from "../elements/base";
import { COMMON_SHORTCUTS, LookerElement } from "../elements/common";
import { ClassificationsOverlay, loadOverlays } from "../overlays";
import { CONTAINS, LabelMask, Overlay } from "../overlays/base";
import DetectionOverlay from "../overlays/detection";
import HeatmapOverlay from "../overlays/heatmap";
import SegmentationOverlay from "../overlays/segmentation";
import processOverlays from "../processOverlays";
import {
BaseState,
Expand Down Expand Up @@ -528,10 +531,13 @@ export abstract class AbstractLooker<
for (const overlay of this.pluckedOverlays ?? []) {
let overlayData: LabelMask = null;

if ("mask" in overlay.label) {
overlayData = overlay.label.mask as LabelMask;
} else if ("map" in overlay.label) {
overlayData = overlay.label.map as LabelMask;
if (
overlay instanceof DetectionOverlay ||
overlay instanceof SegmentationOverlay
) {
overlayData = overlay.label.mask;
} else if (overlay instanceof HeatmapOverlay) {
overlayData = overlay.label.map;
}

const buffer = overlayData?.data?.buffer;
Expand All @@ -546,9 +552,9 @@ export abstract class AbstractLooker<
if (buffer.detached) {
// most likely sample is already being processed, skip update
return;
} else {
arrayBuffers.push(buffer);
}

arrayBuffers.push(buffer);
benjaminpkane marked this conversation as resolved.
Show resolved Hide resolved
} else if (buffer.byteLength) {
// hope we don't run into this edge case (old browser)
// sometimes detached buffers have bytelength > 0
Expand Down Expand Up @@ -743,7 +749,7 @@ export abstract class AbstractLooker<

protected cleanOverlays() {
for (const overlay of this.sampleOverlays ?? []) {
overlay.cleanup();
overlay.cleanup?.();
}
}

Expand Down
Loading