Build a zeroed YOLOX output tensor, then plant one airplane detection at * the given anchor index with explicit raw box regression values.
(
anchorIdx: number,
raw: { x: number; y: number; w: number; h: number; obj: number; cls: number },
classId = 4,
)
| 19 | /** Build a zeroed YOLOX output tensor, then plant one airplane detection at |
| 20 | * the given anchor index with explicit raw box regression values. */ |
| 21 | function tensorWith( |
| 22 | anchorIdx: number, |
| 23 | raw: { x: number; y: number; w: number; h: number; obj: number; cls: number }, |
| 24 | classId = 4, |
| 25 | ) { |
| 26 | const A = anchorCount(INPUT); |
| 27 | const data = new Float32Array(A * STEP); |
| 28 | const o = anchorIdx * STEP; |
| 29 | data[o] = raw.x; |
| 30 | data[o + 1] = raw.y; |
| 31 | data[o + 2] = raw.w; |
| 32 | data[o + 3] = raw.h; |
| 33 | data[o + 4] = raw.obj; |
| 34 | data[o + 5 + classId] = raw.cls; |
| 35 | return { data, dims: [1, A, STEP] }; |
| 36 | } |
| 37 | |
| 38 | describe("decodeYolox", () => { |
| 39 | it("decodes a centered airplane anchor to the right pixel box", () => { |
no test coverage detected