feat: skip track forward on result overlap, not class presence (REQ-189)

Frame holding the tracked class is now annotated like any other; the run's
result is dropped only when it intersects a same-class shape already there.
This commit is contained in:
asus committed 2026-10-06 16:08:54 +07:00
1 parent 3eeb529e3d
commit f5be7880b0
8 files changed
+86 -30

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
import React from 'react'
import { api } from '../api'
export default function Filmstrip({ frames, index, onSelectIndex, stripRef, markedIds, markLabel = 'already has it' }) {
export default function Filmstrip({ frames, index, onSelectIndex, stripRef, markedIds, markLabel = 'overlaps an existing shape' }) {
return (
<div className="filmstrip" ref={stripRef}>
{frames.map((item, position) => {
+15 -14
View File
@@ -418,22 +418,23 @@ export default function ReviewPage({ batchId: rawBatchId, projectId, onProject }
const marked = new Set()
for (let i = 0; i < ahead.length; i++) {
const targetFrame = ahead[i]
// A frame that already holds this class is left alone — hidden or
// dimmed shapes count. It is reported, never silently passed over.
if ((targetFrame.class_ids ?? []).includes(current.class_id)) {
skipped++
marked.add(targetFrame.id)
continue
}
try {
await api.assist(targetFrame.id, { box, class_id: current.class_id }, { signal: controller.signal })
// dedupe makes the backend drop a result that lands on a shape of
// this class already on the frame — that is the same object twice —
// and answer { skipped: true } without writing it.
const created = await api.assist(
targetFrame.id,
{ box, class_id: current.class_id, dedupe: true },
{ signal: controller.signal },
)
if (created?.skipped) {
skipped++
marked.add(targetFrame.id)
continue
}
tracked++
patchFrameLocally(targetFrame.id, {
annotation_count: (targetFrame.annotation_count ?? 0) + 1,
// Keeps the skip check honest for a second run in this session.
class_ids: (targetFrame.class_ids ?? []).includes(current.class_id)
? targetFrame.class_ids
: [...(targetFrame.class_ids ?? []), current.class_id],
})
} catch (exc) {
if (controller.signal.aborted) {
@@ -448,7 +449,7 @@ export default function ReviewPage({ batchId: rawBatchId, projectId, onProject }
setSkippedLabel(className)
}
const parts = [`Tracked ${tracked} of ${ahead.length}`]
if (skipped) parts.push(`skipped ${skipped} already had ${className}`)
if (skipped) parts.push(`skipped ${skipped} overlapping ${className}`)
if (failures.length) parts.push(failures.join(' · '))
if (tracked === 0 || skipped || failures.length) setError(parts.join(' — '))
} finally {
@@ -780,7 +781,7 @@ export default function ReviewPage({ batchId: rawBatchId, projectId, onProject }
<Filmstrip
frames={frames} index={index} onSelectIndex={setIndex} stripRef={stripRef}
markedIds={skippedIds}
markLabel={`already has ${skippedLabel}`}
markLabel={`overlaps an existing ${skippedLabel}`}
/>
</div>