MCPcopy Create free account
hub / github.com/cpaczek/skylight / tensorWith

Function tensorWith

tracker/test/net.test.ts:21–36  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

19/** Build a zeroed YOLOX output tensor, then plant one airplane detection at
20 * the given anchor index with explicit raw box regression values. */
21function 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
38describe("decodeYolox", () => {
39 it("decodes a centered airplane anchor to the right pixel box", () => {

Callers 1

net.test.tsFile · 0.85

Calls 1

anchorCountFunction · 0.85

Tested by

no test coverage detected