revert: undo chained/seed-grown track 5 frames, back to b71f1d4
Reverts1530bbcand9c95a4a. Track 5 Frames sends the drawn box unchanged to all five frames - no chaining, no growth. Both were rejected: chaining let a wrong read on one frame poison the next, and growth was an attempt to follow a moving object that the user did not want. REQ-189, ui-spec and tasks.md return to theb71f1d4wording.
This commit is contained in:
1 parent
9c95a4a759
commit
f6b0335c93
4 files changed
+27
-83
No files matched your search
@@ -9,38 +9,6 @@ import ReviewSidebar from '../components/ReviewSidebar'
|
||||
import ExemplarFilterPanel from '../components/ExemplarFilterPanel'
|
||||
import useExemplarPool from '../hooks/useExemplarPool'
|
||||
|
||||
// How much bigger the seed box gets for each frame after the first, so the
|
||||
// object has room to have moved. Hand-tuned, not learned (REQ-189). The box
|
||||
// always derives from the drawn shape — never from a previous run's result.
|
||||
const SEED_GROWTH = 1.5
|
||||
|
||||
// SAM3 assist wants one normalized [x0, y0, x1, y1] box (REQ-043). A bbox
|
||||
// shape already is that; a polygon is reduced to its bounding box.
|
||||
function shapeBox(geometry) {
|
||||
const pts = geometry?.points
|
||||
if (geometry?.type === 'bbox' && pts?.length === 4) return pts
|
||||
if (geometry?.type === 'polygon' && pts?.length) {
|
||||
let minX = 1, minY = 1, maxX = 0, maxY = 0
|
||||
for (const [x, y] of pts) {
|
||||
if (x < minX) minX = x
|
||||
if (x > maxX) maxX = x
|
||||
if (y < minY) minY = y
|
||||
if (y > maxY) maxY = y
|
||||
}
|
||||
return [minX, minY, maxX, maxY]
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function growBox([x0, y0, x1, y1], k) {
|
||||
const cx = (x0 + x1) / 2
|
||||
const cy = (y0 + y1) / 2
|
||||
const hw = ((x1 - x0) * k) / 2
|
||||
const hh = ((y1 - y0) * k) / 2
|
||||
const clamp = (v) => Math.min(1, Math.max(0, v))
|
||||
return [clamp(cx - hw), clamp(cy - hh), clamp(cx + hw), clamp(cy + hh)]
|
||||
}
|
||||
|
||||
export default function ReviewPage({ batchId: rawBatchId, projectId, onProject }) {
|
||||
const [batch, setBatch] = useState(null)
|
||||
const [project, setProject] = useState(null)
|
||||
@@ -399,8 +367,23 @@ export default function ReviewPage({ batchId: rawBatchId, projectId, onProject }
|
||||
return
|
||||
}
|
||||
|
||||
const firstBox = shapeBox(current.geometry)
|
||||
if (!firstBox) {
|
||||
// SAM3 assist wants one normalized [x0, y0, x1, y1] box (REQ-043). A bbox
|
||||
// shape already is that; a polygon is reduced to its bounding box.
|
||||
const geometry = current.geometry
|
||||
let box = null
|
||||
if (geometry?.type === 'bbox' && geometry.points?.length === 4) {
|
||||
box = geometry.points
|
||||
} else if (geometry?.type === 'polygon' && geometry.points?.length) {
|
||||
let minX = 1, minY = 1, maxX = 0, maxY = 0
|
||||
for (const [x, y] of geometry.points) {
|
||||
if (x < minX) minX = x
|
||||
if (x > maxX) maxX = x
|
||||
if (y < minY) minY = y
|
||||
if (y > maxY) maxY = y
|
||||
}
|
||||
box = [minX, minY, maxX, maxY]
|
||||
}
|
||||
if (!box) {
|
||||
setError('That shape has no usable box — Track 5 Frames needs one.')
|
||||
return
|
||||
}
|
||||
@@ -417,15 +400,8 @@ export default function ReviewPage({ batchId: rawBatchId, projectId, onProject }
|
||||
const failures = []
|
||||
for (let i = 0; i < ahead.length; i++) {
|
||||
const targetFrame = ahead[i]
|
||||
// Every frame is seeded from the drawn box, never from a previous
|
||||
// result, so a bad read on one frame cannot carry into the next.
|
||||
// Frames 2-5 get it grown about its centre — the object has had
|
||||
// time to move by then.
|
||||
const seedBox = i === 0 ? firstBox : growBox(firstBox, SEED_GROWTH)
|
||||
try {
|
||||
await api.assist(targetFrame.id, {
|
||||
box: seedBox, class_id: current.class_id,
|
||||
})
|
||||
await api.assist(targetFrame.id, { box, class_id: current.class_id })
|
||||
tracked++
|
||||
patchFrameLocally(targetFrame.id, { annotation_count: (targetFrame.annotation_count ?? 0) + 1 })
|
||||
} catch (exc) {
|
||||
|
||||
Reference in new issue
Block a user