@hackbuild/vision 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,6 +38,14 @@ also MIT. No weights ship here.
38
38
  | segment.person | selfie-segmenter | MediaPipe | Apache-2.0 |
39
39
  | landmarks.face | face-landmarker, then `faceApiRecord(url)` | MediaPipe with blendshapes, then face-api.js tiny 68 points | Apache-2.0; MIT |
40
40
  | landmarks.hand, landmarks.pose | hand-landmarker, pose-landmarker-lite | MediaPipe | Apache-2.0 |
41
+
42
+ `PICKER_RECORDS` lists models for pickers that no hub registers by
43
+ default, so routing by capability keeps the small defaults above: SmolVLM
44
+ 500M and SmolVLM2 256M video, Gemma 4 E2B, depth anything v2 base
45
+ (CC-BY-NC-4.0) and v1 small, YOLOv10 nano, small and medium and FastSAM-s
46
+ (AGPL-3.0 upstream), and the face swap set (scrfd 10g, ArcFace r50,
47
+ inswapper 128; InsightFace, non-commercial). Sizes are the Hugging Face
48
+ file listings (vendor, no download). A hub that runs one adds the record.
41
49
  | landmarks.gesture (optional) | gesture-recognizer | MediaPipe, hand points plus 7 canned gestures | unknown, model card not checked |
42
50
  | vision.caption, vision.ask | smolvlm-256m-instruct | transformers.js, per sub graph dtypes, repetition penalty 1.3 | Apache-2.0 |
43
51
  | vision.caption, vision.ask | lfm2-vl-450m | transformers.js, q4f16 on webgpu only (as earlier builds did) | LFM Open License v1.0, commercial use limited by revenue |
@@ -191,9 +199,9 @@ signals and the lowercase note do.
191
199
 
192
200
  | file | gzip (measured) | ceiling |
193
201
  |---|---|---|
194
- | `dist/index.js` (main entry, imports external) | 21,326 bytes | 22,392 bytes |
195
- | `dist/single/index.iife.js` (single file build) | 51,302 bytes | 53,867 bytes |
202
+ | `dist/index.js` (main entry, imports external) | 23,015 bytes | 24,165 bytes |
203
+ | `dist/single/index.iife.js` (single file build) | 53,082 bytes | 55,736 bytes |
196
204
 
197
- Measured 2026-11-24 by `node tools/lint-packages.mjs` (gzip level 9) from the packed
205
+ Measured 2026-11-25 by `node tools/lint-packages.mjs` (gzip level 9) from the packed
198
206
  tarball. Generated from `tools/size-budget.json`; CI fails when a file moves more than
199
207
  5 percent from its row.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { ImageInput, Pixels, DepthMap, DepthModel, Box, Detection, Detector, Mask, SegmentPrompt, SegmentOptions, Segmenter, LandmarkKind, Landmarks, Landmarker, Vlm, } from "./types.js";
2
- export { VISION_RECORDS, MP_MODELS, mediapipeLadder, faceApiRecord, yoloRecord } from "./records.js";
2
+ export { VISION_RECORDS, PICKER_RECORDS, MP_MODELS, mediapipeLadder, faceApiRecord, yoloRecord } from "./records.js";
3
3
  export { attachVision, depth, detect, segment, landmarks, landmarkChain, caption, ask, type CallOptions } from "./api.js";
4
4
  export { depthLoader, vlmLoader, samLoader, depthFromOutput } from "./loaders.js";
5
5
  export { mediapipeProvider, loadTasksVision, tasksVisionUrls, tasksVisionWasm, TASKS_VISION, type TasksVision, type MediapipeProviderOptions } from "./mediapipe.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { VISION_RECORDS, MP_MODELS, mediapipeLadder, faceApiRecord, yoloRecord } from "./records.js";
1
+ export { VISION_RECORDS, PICKER_RECORDS, MP_MODELS, mediapipeLadder, faceApiRecord, yoloRecord } from "./records.js";
2
2
  export { attachVision, depth, detect, segment, landmarks, landmarkChain, caption, ask } from "./api.js";
3
3
  export { depthLoader, vlmLoader, samLoader, depthFromOutput } from "./loaders.js";
4
4
  export { mediapipeProvider, loadTasksVision, tasksVisionUrls, tasksVisionWasm, TASKS_VISION } from "./mediapipe.js";
package/dist/records.d.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  /**
2
2
  * Vision records for the models hub. Licences are the model cards' as of
3
- * 2026-11-22; sizes are inferred from the builds and parameter counts.
3
+ * 2026-11-22; sizes are inferred from the builds and parameter counts, except where
4
+ * a row says vendor: those sum the hub listing's files (no download), in MiB.
4
5
  * YOLO weights are AGPL-3.0 (Ultralytics): they are never registered by
5
- * default, and `yoloRecord` builds a record only for a URL the app
6
- * supplies.
6
+ * default. YOLOv8n has no public hub repo, so `yoloRecord` builds a record
7
+ * only for a URL the app supplies; YOLOv10 n, s and m, FastSAM and the face
8
+ * swap set sit in PICKER_RECORDS.
7
9
  */
8
10
  import type { ModelRecord, Rung } from "@hackbuild/models";
9
11
  export declare const MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
10
12
  /** MediaPipe ladder: GPU delegate (webgl), then the CPU delegate (wasm). */
11
13
  export declare const mediapipeLadder: () => Rung[];
12
14
  export declare const VISION_RECORDS: ModelRecord[];
15
+ export declare const PICKER_RECORDS: ModelRecord[];
13
16
  /** A face landmark fallback record over face-api.js tiny nets (code MIT; weights MIT from @vladmandic/face-api). */
14
17
  export declare function faceApiRecord(baseUrl: string): ModelRecord;
15
18
  /** YOLOv8n exported to ONNX (640 input, [1, 84, 8400] output). External: the app supplies the URL and accepts the weight licence. */
package/dist/records.js CHANGED
@@ -1,17 +1,22 @@
1
1
  /**
2
2
  * Vision records for the models hub. Licences are the model cards' as of
3
- * 2026-11-22; sizes are inferred from the builds and parameter counts.
3
+ * 2026-11-22; sizes are inferred from the builds and parameter counts, except where
4
+ * a row says vendor: those sum the hub listing's files (no download), in MiB.
4
5
  * YOLO weights are AGPL-3.0 (Ultralytics): they are never registered by
5
- * default, and `yoloRecord` builds a record only for a URL the app
6
- * supplies.
6
+ * default. YOLOv8n has no public hub repo, so `yoloRecord` builds a record
7
+ * only for a URL the app supplies; YOLOv10 n, s and m, FastSAM and the face
8
+ * swap set sit in PICKER_RECORDS.
7
9
  */
8
10
  import { LADDERS, tjsLadder } from "@hackbuild/devices";
9
11
  export const MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
10
12
  /** MediaPipe ladder: GPU delegate (webgl), then the CPU delegate (wasm). */
11
13
  export const mediapipeLadder = () => [{ device: "webgl" }, { device: "wasm" }];
12
- const mp = (id, provides, path, sizeMB, label) => ({
14
+ const mp = (id, provides, path, sizeMB, label, verdict = "light, on the gpu", group = "start here") => ({
13
15
  id,
14
16
  label,
17
+ group,
18
+ speed: "instant",
19
+ verdict,
15
20
  provides: [provides],
16
21
  provider: "mediapipe",
17
22
  source: { url: MP_MODELS + path },
@@ -27,6 +32,9 @@ export const VISION_RECORDS = [
27
32
  {
28
33
  id: "depth-anything-v2-small",
29
34
  label: "depth anything v2 small",
35
+ speed: "fast",
36
+ verdict: "good edges",
37
+ group: "start here",
30
38
  provides: ["depth"],
31
39
  provider: "tjs",
32
40
  source: { modelId: "onnx-community/depth-anything-v2-small" },
@@ -39,7 +47,7 @@ export const VISION_RECORDS = [
39
47
  runtime: "@huggingface/transformers@4.3.2",
40
48
  notes: ["earlier builds: fp16 on webgpu, fp32 on the same device after a failure"],
41
49
  },
42
- mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)"),
50
+ mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)", "light, 80 things"),
43
51
  mp("selfie-segmenter", "segment.person", "image_segmenter/selfie_segmenter/float16/latest/selfie_segmenter.tflite", 1, "mediapipe selfie segmenter"),
44
52
  mp("face-landmarker", "landmarks.face", "face_landmarker/face_landmarker/float16/1/face_landmarker.task", 4, "mediapipe face landmarker with blendshapes"),
45
53
  mp("hand-landmarker", "landmarks.hand", "hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task", 8, "mediapipe hand landmarker"),
@@ -54,11 +62,15 @@ export const VISION_RECORDS = [
54
62
  {
55
63
  id: "slimsam-77-uniform",
56
64
  label: "slimsam 77 uniform (point prompts)",
65
+ speed: "fast",
66
+ verdict: "click to cut",
67
+ group: "start here",
57
68
  provides: ["segment"],
58
69
  provider: "tjs",
59
70
  source: { modelId: "Xenova/slimsam-77-uniform" },
60
- sizeMB: 40,
61
- sizeSource: "inferred",
71
+ // fp32 vision encoder 23.3 plus prompt decoder 16.6 MB in the hub listing, 38 MiB; quantized 13.8 MB (vendor, 2026-11-25)
72
+ sizeMB: 38,
73
+ sizeSource: "vendor",
62
74
  ladder: tjsLadder({ webgpu: ["fp16", "fp32"], wasm: ["fp32"] }),
63
75
  licence: "Apache-2.0",
64
76
  commercial: true,
@@ -69,6 +81,9 @@ export const VISION_RECORDS = [
69
81
  {
70
82
  id: "smolvlm-256m-instruct",
71
83
  label: "smolvlm 256m",
84
+ speed: "fast",
85
+ verdict: "fastest, short answers",
86
+ group: "start here",
72
87
  provides: ["vision.caption", "vision.ask"],
73
88
  provider: "tjs",
74
89
  source: { modelId: "HuggingFaceTB/SmolVLM-256M-Instruct" },
@@ -84,6 +99,9 @@ export const VISION_RECORDS = [
84
99
  {
85
100
  id: "lfm2-vl-450m",
86
101
  label: "lfm2-vl 450m",
102
+ speed: "fast",
103
+ verdict: "faster, sharper",
104
+ group: "tiny",
87
105
  provides: ["vision.caption", "vision.ask"],
88
106
  provider: "tjs",
89
107
  source: { modelId: "onnx-community/LFM2-VL-450M-ONNX" },
@@ -100,11 +118,218 @@ export const VISION_RECORDS = [
100
118
  notes: ["earlier builds: q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"],
101
119
  },
102
120
  ];
121
+ /**
122
+ * Records listed for pickers and never registered by default, so a hub's
123
+ * routing by capability keeps its small defaults: larger alternates the
124
+ * earlier tools offered (smolvlm 500m and 2 video, gemma 4 e2b, two more
125
+ * depth models), and records under licences that limit use (YOLOv10 and
126
+ * FastSAM are AGPL-3.0 upstream, Ultralytics; the face swap set is
127
+ * InsightFace, non-commercial). A hub that runs one adds it itself. Sizes
128
+ * are the hub listings' files (vendor, 2026-11-25), in MiB.
129
+ */
130
+ const yolo10 = (size, mb, speed, verdict) => ({
131
+ id: `yolov10${size}`,
132
+ label: `yolov10 ${({ n: "nano", s: "small", m: "medium" })[size]}`,
133
+ group: size === "n" ? "tiny" : "good",
134
+ speed,
135
+ verdict,
136
+ provides: ["detect"],
137
+ provider: "ort",
138
+ source: { repo: `onnx-community/yolov10${size}`, file: "onnx/model.onnx" },
139
+ sizeMB: mb,
140
+ sizeSource: "vendor",
141
+ ladder: [
142
+ { device: "webgpu", ort: { executionProviders: ["webgpu", "wasm"] } },
143
+ { device: "wasm", ort: { executionProviders: ["wasm"] } },
144
+ ],
145
+ licence: "AGPL-3.0 (Ultralytics weights, the model card's licence field)",
146
+ commercial: false,
147
+ place: "gpu",
148
+ notes: ["output [1, 300, 6] after the model's own selection, so no nms pass (vendor, the yolov10 paper)", "an earlier room offered nano, small and medium"],
149
+ });
150
+ export const PICKER_RECORDS = [
151
+ {
152
+ id: "smolvlm-500m-instruct",
153
+ label: "smolvlm 500m",
154
+ speed: "steady",
155
+ verdict: "better captions, slower",
156
+ group: "good",
157
+ provides: ["vision.caption", "vision.ask"],
158
+ provider: "tjs",
159
+ source: { modelId: "HuggingFaceTB/SmolVLM-500M-Instruct" },
160
+ // q4 decoder 229.1, q4 vision 66.7, q4 embed 189.2 MB in the onnx folder of the hub listing (vendor, 2026-11-25)
161
+ sizeMB: 463,
162
+ sizeSource: "vendor",
163
+ ladder: LADDERS.smolvlm(),
164
+ quirks: { repetitionPenalty: 1.3, maxTokensAction: 64 },
165
+ licence: "Apache-2.0",
166
+ commercial: true,
167
+ place: "cpu-worker",
168
+ runtime: "@huggingface/transformers@4.3.2",
169
+ },
170
+ {
171
+ id: "smolvlm2-256m-video-instruct",
172
+ label: "smolvlm2 256m video",
173
+ speed: "fast",
174
+ verdict: "watches short clips",
175
+ group: "tiny",
176
+ provides: ["vision.caption", "vision.ask"],
177
+ provider: "tjs",
178
+ source: { modelId: "HuggingFaceTB/SmolVLM2-256M-Video-Instruct" },
179
+ // q4 decoder 86.9, q4 vision 63.8, q4 embed 113.5 MB in the hub listing (vendor, 2026-11-25), in MiB
180
+ sizeMB: 252,
181
+ sizeSource: "vendor",
182
+ ladder: LADDERS.smolvlm(),
183
+ quirks: { repetitionPenalty: 1.3, maxTokensAction: 64 },
184
+ licence: "Apache-2.0",
185
+ commercial: true,
186
+ place: "cpu-worker",
187
+ runtime: "@huggingface/transformers@4.3.2",
188
+ notes: ["an earlier room offered it beside smolvlm 256m and 500m"],
189
+ },
190
+ {
191
+ id: "depth-anything-v2-base",
192
+ label: "depth anything v2 base",
193
+ speed: "steady",
194
+ verdict: "finer depth, non commercial",
195
+ group: "good",
196
+ provides: ["depth"],
197
+ provider: "tjs",
198
+ source: { modelId: "onnx-community/depth-anything-v2-base" },
199
+ // model_fp16.onnx 194.6 MB, model.onnx 388.9 MB in the hub listing (vendor, 2026-11-25); the first rung loads fp16
200
+ sizeMB: 186,
201
+ sizeSource: "vendor",
202
+ ladder: LADDERS.depth(),
203
+ licence: "CC-BY-NC-4.0 (the model card's licence field)",
204
+ commercial: false,
205
+ place: "cpu-worker",
206
+ runtime: "@huggingface/transformers@4.3.2",
207
+ },
208
+ {
209
+ id: "depth-anything-small-v1",
210
+ label: "depth anything v1 small",
211
+ speed: "fast",
212
+ verdict: "the first version",
213
+ group: "tiny",
214
+ provides: ["depth"],
215
+ provider: "tjs",
216
+ source: { modelId: "Xenova/depth-anything-small-hf" },
217
+ // model_fp16.onnx 49.9 MB in the hub listing (vendor, 2026-11-25)
218
+ sizeMB: 48,
219
+ sizeSource: "vendor",
220
+ ladder: LADDERS.depth(),
221
+ licence: "Apache-2.0 (the upstream card; this export's card has no licence field)",
222
+ commercial: "unknown",
223
+ place: "cpu-worker",
224
+ runtime: "@huggingface/transformers@4.3.2",
225
+ },
226
+ {
227
+ id: "gemma-4-e2b-vision",
228
+ label: "gemma 4 e2b",
229
+ speed: "slow",
230
+ verdict: "sees most, heavy",
231
+ group: "good",
232
+ provides: ["vision.caption", "vision.ask"],
233
+ provider: "tjs",
234
+ source: { modelId: "onnx-community/gemma-4-E2B-it-ONNX" },
235
+ // q4 decoder, vision and embed graphs with their external data, no audio encoder: 3739.7 MB in the hub listing (vendor, 2026-11-25)
236
+ sizeMB: 3566,
237
+ sizeSource: "vendor",
238
+ ladder: LADDERS.vlmGpuOnly(),
239
+ quirks: { systemRole: false, strictAlternation: true, maxTokensAction: 96 },
240
+ licence: "Apache-2.0 (the model card's licence field)",
241
+ commercial: true,
242
+ place: "gpu",
243
+ runtime: "@huggingface/transformers@4.3.2",
244
+ notes: ["an earlier dog sim used it as the cortex at about 3.3 GB (vendor there)"],
245
+ },
246
+ yolo10("n", 9, "instant", "nano, quick"),
247
+ yolo10("s", 28, "fast", "small, sharper"),
248
+ yolo10("m", 59, "steady", "medium, best boxes"),
249
+ {
250
+ id: "fastsam-s",
251
+ label: "fastsam s",
252
+ speed: "fast",
253
+ verdict: "finds everything, cpu ok",
254
+ group: "good",
255
+ provides: ["segment.everything"],
256
+ provider: "ort",
257
+ source: { repo: "anakhiu/fastsam-onnx", file: "fastsam_s.onnx" },
258
+ sizeMB: 45,
259
+ sizeSource: "vendor",
260
+ ladder: [
261
+ { device: "webgpu", ort: { executionProviders: ["webgpu", "wasm"] } },
262
+ { device: "wasm", ort: { executionProviders: ["wasm"] } },
263
+ ],
264
+ licence: "AGPL-3.0 upstream (Ultralytics FastSAM); the export's card says apache-2.0",
265
+ commercial: false,
266
+ place: "cpu-worker",
267
+ notes: ["an earlier mask tool found every mask in one pass on onnxruntime-web (93 MB there, vendor)", "segment everything: prototype masks, nms, then a pick by click"],
268
+ },
269
+ {
270
+ id: "scrfd-10g",
271
+ label: "face finder (scrfd 10g)",
272
+ speed: "fast",
273
+ verdict: "finds faces",
274
+ group: "start here",
275
+ provides: ["face.detect"],
276
+ provider: "ort",
277
+ source: { repo: "immich-app/buffalo_l", file: "detection/model.onnx" },
278
+ sizeMB: 16,
279
+ sizeSource: "vendor",
280
+ ladder: [{ device: "wasm", ort: { executionProviders: ["wasm"] } }],
281
+ licence: "InsightFace model pack: non-commercial research only (the buffalo_l pack terms)",
282
+ commercial: false,
283
+ place: "cpu-worker",
284
+ },
285
+ {
286
+ id: "arcface-w600k-r50",
287
+ label: "face id (arcface r50)",
288
+ speed: "steady",
289
+ verdict: "who is who",
290
+ group: "start here",
291
+ provides: ["face.embed"],
292
+ provider: "ort",
293
+ source: { repo: "immich-app/buffalo_l", file: "recognition/model.onnx" },
294
+ sizeMB: 166,
295
+ sizeSource: "vendor",
296
+ ladder: [
297
+ { device: "webgpu", ort: { executionProviders: ["webgpu", "wasm"] } },
298
+ { device: "wasm", ort: { executionProviders: ["wasm"] } },
299
+ ],
300
+ licence: "InsightFace model pack: non-commercial research only (the buffalo_l pack terms)",
301
+ commercial: false,
302
+ place: "cpu-worker",
303
+ },
304
+ {
305
+ id: "inswapper-128",
306
+ label: "face swap (inswapper 128)",
307
+ speed: "slow",
308
+ verdict: "the swap itself",
309
+ group: "start here",
310
+ provides: ["face.swap"],
311
+ provider: "ort",
312
+ source: { repo: "hacksider/inswapper_128", file: "inswapper_128.onnx" },
313
+ sizeMB: 529,
314
+ sizeSource: "vendor",
315
+ ladder: [
316
+ { device: "webgpu", ort: { executionProviders: ["webgpu", "wasm"] } },
317
+ { device: "wasm", ort: { executionProviders: ["wasm"] } },
318
+ ],
319
+ licence: "InsightFace: non-commercial research only; the mirror's card says gpl-3.0",
320
+ commercial: false,
321
+ place: "gpu",
322
+ notes: ["128 px faces; an earlier face swap tool pasted the result back with a feathered mask"],
323
+ },
324
+ ];
103
325
  /** A face landmark fallback record over face-api.js tiny nets (code MIT; weights MIT from @vladmandic/face-api). */
104
326
  export function faceApiRecord(baseUrl) {
105
327
  return {
106
328
  id: "face-api-tiny",
107
329
  label: "face-api tiny landmarks (68 points)",
330
+ speed: "instant",
331
+ verdict: "68 points, cpu",
332
+ group: "cpu",
108
333
  provides: ["landmarks.face"],
109
334
  provider: "faceapi",
110
335
  source: { url: baseUrl },
@@ -121,6 +346,9 @@ export function yoloRecord(o) {
121
346
  return {
122
347
  id: o.id ?? "yolov8n",
123
348
  label: "yolov8n (external)",
349
+ group: "tiny",
350
+ speed: "instant",
351
+ verdict: "nano, your file",
124
352
  provides: ["detect"],
125
353
  provider: "ort",
126
354
  source: { url: o.url, ...(o.sha256 ? { sha256: o.sha256 } : {}) },
@@ -3392,17 +3392,22 @@ var HackbuildVision = (function(exports) {
3392
3392
  // packages/vision/src/records.ts
3393
3393
  /**
3394
3394
  * Vision records for the models hub. Licences are the model cards' as of
3395
- * 2026-11-22; sizes are inferred from the builds and parameter counts.
3395
+ * 2026-11-22; sizes are inferred from the builds and parameter counts, except where
3396
+ * a row says vendor: those sum the hub listing's files (no download), in MiB.
3396
3397
  * YOLO weights are AGPL-3.0 (Ultralytics): they are never registered by
3397
- * default, and `yoloRecord` builds a record only for a URL the app
3398
- * supplies.
3398
+ * default. YOLOv8n has no public hub repo, so `yoloRecord` builds a record
3399
+ * only for a URL the app supplies; YOLOv10 n, s and m, FastSAM and the face
3400
+ * swap set sit in PICKER_RECORDS.
3399
3401
  */
3400
3402
  const MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
3401
3403
  /** MediaPipe ladder: GPU delegate (webgl), then the CPU delegate (wasm). */
3402
3404
  const mediapipeLadder = () => [{ device: "webgl" }, { device: "wasm" }];
3403
- const mp = (id, provides, path, sizeMB, label) => ({
3405
+ const mp = (id, provides, path, sizeMB, label, verdict = "light, on the gpu", group = "start here") => ({
3404
3406
  id,
3405
3407
  label,
3408
+ group,
3409
+ speed: "instant",
3410
+ verdict,
3406
3411
  provides: [provides],
3407
3412
  provider: "mediapipe",
3408
3413
  source: { url: MP_MODELS + path },
@@ -3418,6 +3423,9 @@ var HackbuildVision = (function(exports) {
3418
3423
  {
3419
3424
  id: "depth-anything-v2-small",
3420
3425
  label: "depth anything v2 small",
3426
+ speed: "fast",
3427
+ verdict: "good edges",
3428
+ group: "start here",
3421
3429
  provides: ["depth"],
3422
3430
  provider: "tjs",
3423
3431
  source: { modelId: "onnx-community/depth-anything-v2-small" },
@@ -3430,7 +3438,7 @@ var HackbuildVision = (function(exports) {
3430
3438
  runtime: "@huggingface/transformers@4.3.2",
3431
3439
  notes: ["earlier builds: fp16 on webgpu, fp32 on the same device after a failure"]
3432
3440
  },
3433
- mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)"),
3441
+ mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)", "light, 80 things"),
3434
3442
  mp("selfie-segmenter", "segment.person", "image_segmenter/selfie_segmenter/float16/latest/selfie_segmenter.tflite", 1, "mediapipe selfie segmenter"),
3435
3443
  mp("face-landmarker", "landmarks.face", "face_landmarker/face_landmarker/float16/1/face_landmarker.task", 4, "mediapipe face landmarker with blendshapes"),
3436
3444
  mp("hand-landmarker", "landmarks.hand", "hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task", 8, "mediapipe hand landmarker"),
@@ -3444,11 +3452,14 @@ var HackbuildVision = (function(exports) {
3444
3452
  {
3445
3453
  id: "slimsam-77-uniform",
3446
3454
  label: "slimsam 77 uniform (point prompts)",
3455
+ speed: "fast",
3456
+ verdict: "click to cut",
3457
+ group: "start here",
3447
3458
  provides: ["segment"],
3448
3459
  provider: "tjs",
3449
3460
  source: { modelId: "Xenova/slimsam-77-uniform" },
3450
- sizeMB: 40,
3451
- sizeSource: "inferred",
3461
+ sizeMB: 38,
3462
+ sizeSource: "vendor",
3452
3463
  ladder: tjsLadder({
3453
3464
  webgpu: ["fp16", "fp32"],
3454
3465
  wasm: ["fp32"]
@@ -3462,6 +3473,9 @@ var HackbuildVision = (function(exports) {
3462
3473
  {
3463
3474
  id: "smolvlm-256m-instruct",
3464
3475
  label: "smolvlm 256m",
3476
+ speed: "fast",
3477
+ verdict: "fastest, short answers",
3478
+ group: "start here",
3465
3479
  provides: ["vision.caption", "vision.ask"],
3466
3480
  provider: "tjs",
3467
3481
  source: { modelId: "HuggingFaceTB/SmolVLM-256M-Instruct" },
@@ -3480,6 +3494,9 @@ var HackbuildVision = (function(exports) {
3480
3494
  {
3481
3495
  id: "lfm2-vl-450m",
3482
3496
  label: "lfm2-vl 450m",
3497
+ speed: "fast",
3498
+ verdict: "faster, sharper",
3499
+ group: "tiny",
3483
3500
  provides: ["vision.caption", "vision.ask"],
3484
3501
  provider: "tjs",
3485
3502
  source: { modelId: "onnx-community/LFM2-VL-450M-ONNX" },
@@ -3497,11 +3514,257 @@ var HackbuildVision = (function(exports) {
3497
3514
  notes: ["earlier builds: q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
3498
3515
  }
3499
3516
  ];
3517
+ /**
3518
+ * Records listed for pickers and never registered by default, so a hub's
3519
+ * routing by capability keeps its small defaults: larger alternates the
3520
+ * earlier tools offered (smolvlm 500m and 2 video, gemma 4 e2b, two more
3521
+ * depth models), and records under licences that limit use (YOLOv10 and
3522
+ * FastSAM are AGPL-3.0 upstream, Ultralytics; the face swap set is
3523
+ * InsightFace, non-commercial). A hub that runs one adds it itself. Sizes
3524
+ * are the hub listings' files (vendor, 2026-11-25), in MiB.
3525
+ */
3526
+ const yolo10 = (size, mb, speed, verdict) => ({
3527
+ id: `yolov10${size}`,
3528
+ label: `yolov10 ${{
3529
+ n: "nano",
3530
+ s: "small",
3531
+ m: "medium"
3532
+ }[size]}`,
3533
+ group: size === "n" ? "tiny" : "good",
3534
+ speed,
3535
+ verdict,
3536
+ provides: ["detect"],
3537
+ provider: "ort",
3538
+ source: {
3539
+ repo: `onnx-community/yolov10${size}`,
3540
+ file: "onnx/model.onnx"
3541
+ },
3542
+ sizeMB: mb,
3543
+ sizeSource: "vendor",
3544
+ ladder: [{
3545
+ device: "webgpu",
3546
+ ort: { executionProviders: ["webgpu", "wasm"] }
3547
+ }, {
3548
+ device: "wasm",
3549
+ ort: { executionProviders: ["wasm"] }
3550
+ }],
3551
+ licence: "AGPL-3.0 (Ultralytics weights, the model card's licence field)",
3552
+ commercial: false,
3553
+ place: "gpu",
3554
+ notes: ["output [1, 300, 6] after the model's own selection, so no nms pass (vendor, the yolov10 paper)", "an earlier room offered nano, small and medium"]
3555
+ });
3556
+ const PICKER_RECORDS = [
3557
+ {
3558
+ id: "smolvlm-500m-instruct",
3559
+ label: "smolvlm 500m",
3560
+ speed: "steady",
3561
+ verdict: "better captions, slower",
3562
+ group: "good",
3563
+ provides: ["vision.caption", "vision.ask"],
3564
+ provider: "tjs",
3565
+ source: { modelId: "HuggingFaceTB/SmolVLM-500M-Instruct" },
3566
+ sizeMB: 463,
3567
+ sizeSource: "vendor",
3568
+ ladder: LADDERS.smolvlm(),
3569
+ quirks: {
3570
+ repetitionPenalty: 1.3,
3571
+ maxTokensAction: 64
3572
+ },
3573
+ licence: "Apache-2.0",
3574
+ commercial: true,
3575
+ place: "cpu-worker",
3576
+ runtime: "@huggingface/transformers@4.3.2"
3577
+ },
3578
+ {
3579
+ id: "smolvlm2-256m-video-instruct",
3580
+ label: "smolvlm2 256m video",
3581
+ speed: "fast",
3582
+ verdict: "watches short clips",
3583
+ group: "tiny",
3584
+ provides: ["vision.caption", "vision.ask"],
3585
+ provider: "tjs",
3586
+ source: { modelId: "HuggingFaceTB/SmolVLM2-256M-Video-Instruct" },
3587
+ sizeMB: 252,
3588
+ sizeSource: "vendor",
3589
+ ladder: LADDERS.smolvlm(),
3590
+ quirks: {
3591
+ repetitionPenalty: 1.3,
3592
+ maxTokensAction: 64
3593
+ },
3594
+ licence: "Apache-2.0",
3595
+ commercial: true,
3596
+ place: "cpu-worker",
3597
+ runtime: "@huggingface/transformers@4.3.2",
3598
+ notes: ["an earlier room offered it beside smolvlm 256m and 500m"]
3599
+ },
3600
+ {
3601
+ id: "depth-anything-v2-base",
3602
+ label: "depth anything v2 base",
3603
+ speed: "steady",
3604
+ verdict: "finer depth, non commercial",
3605
+ group: "good",
3606
+ provides: ["depth"],
3607
+ provider: "tjs",
3608
+ source: { modelId: "onnx-community/depth-anything-v2-base" },
3609
+ sizeMB: 186,
3610
+ sizeSource: "vendor",
3611
+ ladder: LADDERS.depth(),
3612
+ licence: "CC-BY-NC-4.0 (the model card's licence field)",
3613
+ commercial: false,
3614
+ place: "cpu-worker",
3615
+ runtime: "@huggingface/transformers@4.3.2"
3616
+ },
3617
+ {
3618
+ id: "depth-anything-small-v1",
3619
+ label: "depth anything v1 small",
3620
+ speed: "fast",
3621
+ verdict: "the first version",
3622
+ group: "tiny",
3623
+ provides: ["depth"],
3624
+ provider: "tjs",
3625
+ source: { modelId: "Xenova/depth-anything-small-hf" },
3626
+ sizeMB: 48,
3627
+ sizeSource: "vendor",
3628
+ ladder: LADDERS.depth(),
3629
+ licence: "Apache-2.0 (the upstream card; this export's card has no licence field)",
3630
+ commercial: "unknown",
3631
+ place: "cpu-worker",
3632
+ runtime: "@huggingface/transformers@4.3.2"
3633
+ },
3634
+ {
3635
+ id: "gemma-4-e2b-vision",
3636
+ label: "gemma 4 e2b",
3637
+ speed: "slow",
3638
+ verdict: "sees most, heavy",
3639
+ group: "good",
3640
+ provides: ["vision.caption", "vision.ask"],
3641
+ provider: "tjs",
3642
+ source: { modelId: "onnx-community/gemma-4-E2B-it-ONNX" },
3643
+ sizeMB: 3566,
3644
+ sizeSource: "vendor",
3645
+ ladder: LADDERS.vlmGpuOnly(),
3646
+ quirks: {
3647
+ systemRole: false,
3648
+ strictAlternation: true,
3649
+ maxTokensAction: 96
3650
+ },
3651
+ licence: "Apache-2.0 (the model card's licence field)",
3652
+ commercial: true,
3653
+ place: "gpu",
3654
+ runtime: "@huggingface/transformers@4.3.2",
3655
+ notes: ["an earlier dog sim used it as the cortex at about 3.3 GB (vendor there)"]
3656
+ },
3657
+ yolo10("n", 9, "instant", "nano, quick"),
3658
+ yolo10("s", 28, "fast", "small, sharper"),
3659
+ yolo10("m", 59, "steady", "medium, best boxes"),
3660
+ {
3661
+ id: "fastsam-s",
3662
+ label: "fastsam s",
3663
+ speed: "fast",
3664
+ verdict: "finds everything, cpu ok",
3665
+ group: "good",
3666
+ provides: ["segment.everything"],
3667
+ provider: "ort",
3668
+ source: {
3669
+ repo: "anakhiu/fastsam-onnx",
3670
+ file: "fastsam_s.onnx"
3671
+ },
3672
+ sizeMB: 45,
3673
+ sizeSource: "vendor",
3674
+ ladder: [{
3675
+ device: "webgpu",
3676
+ ort: { executionProviders: ["webgpu", "wasm"] }
3677
+ }, {
3678
+ device: "wasm",
3679
+ ort: { executionProviders: ["wasm"] }
3680
+ }],
3681
+ licence: "AGPL-3.0 upstream (Ultralytics FastSAM); the export's card says apache-2.0",
3682
+ commercial: false,
3683
+ place: "cpu-worker",
3684
+ notes: ["an earlier mask tool found every mask in one pass on onnxruntime-web (93 MB there, vendor)", "segment everything: prototype masks, nms, then a pick by click"]
3685
+ },
3686
+ {
3687
+ id: "scrfd-10g",
3688
+ label: "face finder (scrfd 10g)",
3689
+ speed: "fast",
3690
+ verdict: "finds faces",
3691
+ group: "start here",
3692
+ provides: ["face.detect"],
3693
+ provider: "ort",
3694
+ source: {
3695
+ repo: "immich-app/buffalo_l",
3696
+ file: "detection/model.onnx"
3697
+ },
3698
+ sizeMB: 16,
3699
+ sizeSource: "vendor",
3700
+ ladder: [{
3701
+ device: "wasm",
3702
+ ort: { executionProviders: ["wasm"] }
3703
+ }],
3704
+ licence: "InsightFace model pack: non-commercial research only (the buffalo_l pack terms)",
3705
+ commercial: false,
3706
+ place: "cpu-worker"
3707
+ },
3708
+ {
3709
+ id: "arcface-w600k-r50",
3710
+ label: "face id (arcface r50)",
3711
+ speed: "steady",
3712
+ verdict: "who is who",
3713
+ group: "start here",
3714
+ provides: ["face.embed"],
3715
+ provider: "ort",
3716
+ source: {
3717
+ repo: "immich-app/buffalo_l",
3718
+ file: "recognition/model.onnx"
3719
+ },
3720
+ sizeMB: 166,
3721
+ sizeSource: "vendor",
3722
+ ladder: [{
3723
+ device: "webgpu",
3724
+ ort: { executionProviders: ["webgpu", "wasm"] }
3725
+ }, {
3726
+ device: "wasm",
3727
+ ort: { executionProviders: ["wasm"] }
3728
+ }],
3729
+ licence: "InsightFace model pack: non-commercial research only (the buffalo_l pack terms)",
3730
+ commercial: false,
3731
+ place: "cpu-worker"
3732
+ },
3733
+ {
3734
+ id: "inswapper-128",
3735
+ label: "face swap (inswapper 128)",
3736
+ speed: "slow",
3737
+ verdict: "the swap itself",
3738
+ group: "start here",
3739
+ provides: ["face.swap"],
3740
+ provider: "ort",
3741
+ source: {
3742
+ repo: "hacksider/inswapper_128",
3743
+ file: "inswapper_128.onnx"
3744
+ },
3745
+ sizeMB: 529,
3746
+ sizeSource: "vendor",
3747
+ ladder: [{
3748
+ device: "webgpu",
3749
+ ort: { executionProviders: ["webgpu", "wasm"] }
3750
+ }, {
3751
+ device: "wasm",
3752
+ ort: { executionProviders: ["wasm"] }
3753
+ }],
3754
+ licence: "InsightFace: non-commercial research only; the mirror's card says gpl-3.0",
3755
+ commercial: false,
3756
+ place: "gpu",
3757
+ notes: ["128 px faces; an earlier face swap tool pasted the result back with a feathered mask"]
3758
+ }
3759
+ ];
3500
3760
  /** A face landmark fallback record over face-api.js tiny nets (code MIT; weights MIT from @vladmandic/face-api). */
3501
3761
  function faceApiRecord(baseUrl) {
3502
3762
  return {
3503
3763
  id: "face-api-tiny",
3504
3764
  label: "face-api tiny landmarks (68 points)",
3765
+ speed: "instant",
3766
+ verdict: "68 points, cpu",
3767
+ group: "cpu",
3505
3768
  provides: ["landmarks.face"],
3506
3769
  provider: "faceapi",
3507
3770
  source: { url: baseUrl },
@@ -3518,6 +3781,9 @@ var HackbuildVision = (function(exports) {
3518
3781
  return {
3519
3782
  id: o.id ?? "yolov8n",
3520
3783
  label: "yolov8n (external)",
3784
+ group: "tiny",
3785
+ speed: "instant",
3786
+ verdict: "nano, your file",
3521
3787
  provides: ["detect"],
3522
3788
  provider: "ort",
3523
3789
  source: {
@@ -5242,6 +5508,7 @@ self.onmessage = async (ev) => {
5242
5508
  exports.EmbeddingCache = EmbeddingCache;
5243
5509
  exports.LOOK_PATTERN = LOOK_PATTERN;
5244
5510
  exports.MP_MODELS = MP_MODELS;
5511
+ exports.PICKER_RECORDS = PICKER_RECORDS;
5245
5512
  exports.ResultCache = ResultCache;
5246
5513
  exports.SeenNotes = SeenNotes;
5247
5514
  exports.SignalTracker = SignalTracker;
@@ -3390,17 +3390,22 @@ async function spawnWorker(source, opts = {}) {
3390
3390
  // packages/vision/src/records.ts
3391
3391
  /**
3392
3392
  * Vision records for the models hub. Licences are the model cards' as of
3393
- * 2026-11-22; sizes are inferred from the builds and parameter counts.
3393
+ * 2026-11-22; sizes are inferred from the builds and parameter counts, except where
3394
+ * a row says vendor: those sum the hub listing's files (no download), in MiB.
3394
3395
  * YOLO weights are AGPL-3.0 (Ultralytics): they are never registered by
3395
- * default, and `yoloRecord` builds a record only for a URL the app
3396
- * supplies.
3396
+ * default. YOLOv8n has no public hub repo, so `yoloRecord` builds a record
3397
+ * only for a URL the app supplies; YOLOv10 n, s and m, FastSAM and the face
3398
+ * swap set sit in PICKER_RECORDS.
3397
3399
  */
3398
3400
  const MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
3399
3401
  /** MediaPipe ladder: GPU delegate (webgl), then the CPU delegate (wasm). */
3400
3402
  const mediapipeLadder = () => [{ device: "webgl" }, { device: "wasm" }];
3401
- const mp = (id, provides, path, sizeMB, label) => ({
3403
+ const mp = (id, provides, path, sizeMB, label, verdict = "light, on the gpu", group = "start here") => ({
3402
3404
  id,
3403
3405
  label,
3406
+ group,
3407
+ speed: "instant",
3408
+ verdict,
3404
3409
  provides: [provides],
3405
3410
  provider: "mediapipe",
3406
3411
  source: { url: MP_MODELS + path },
@@ -3416,6 +3421,9 @@ const VISION_RECORDS = [
3416
3421
  {
3417
3422
  id: "depth-anything-v2-small",
3418
3423
  label: "depth anything v2 small",
3424
+ speed: "fast",
3425
+ verdict: "good edges",
3426
+ group: "start here",
3419
3427
  provides: ["depth"],
3420
3428
  provider: "tjs",
3421
3429
  source: { modelId: "onnx-community/depth-anything-v2-small" },
@@ -3428,7 +3436,7 @@ const VISION_RECORDS = [
3428
3436
  runtime: "@huggingface/transformers@4.3.2",
3429
3437
  notes: ["earlier builds: fp16 on webgpu, fp32 on the same device after a failure"]
3430
3438
  },
3431
- mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)"),
3439
+ mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)", "light, 80 things"),
3432
3440
  mp("selfie-segmenter", "segment.person", "image_segmenter/selfie_segmenter/float16/latest/selfie_segmenter.tflite", 1, "mediapipe selfie segmenter"),
3433
3441
  mp("face-landmarker", "landmarks.face", "face_landmarker/face_landmarker/float16/1/face_landmarker.task", 4, "mediapipe face landmarker with blendshapes"),
3434
3442
  mp("hand-landmarker", "landmarks.hand", "hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task", 8, "mediapipe hand landmarker"),
@@ -3442,11 +3450,14 @@ const VISION_RECORDS = [
3442
3450
  {
3443
3451
  id: "slimsam-77-uniform",
3444
3452
  label: "slimsam 77 uniform (point prompts)",
3453
+ speed: "fast",
3454
+ verdict: "click to cut",
3455
+ group: "start here",
3445
3456
  provides: ["segment"],
3446
3457
  provider: "tjs",
3447
3458
  source: { modelId: "Xenova/slimsam-77-uniform" },
3448
- sizeMB: 40,
3449
- sizeSource: "inferred",
3459
+ sizeMB: 38,
3460
+ sizeSource: "vendor",
3450
3461
  ladder: tjsLadder({
3451
3462
  webgpu: ["fp16", "fp32"],
3452
3463
  wasm: ["fp32"]
@@ -3460,6 +3471,9 @@ const VISION_RECORDS = [
3460
3471
  {
3461
3472
  id: "smolvlm-256m-instruct",
3462
3473
  label: "smolvlm 256m",
3474
+ speed: "fast",
3475
+ verdict: "fastest, short answers",
3476
+ group: "start here",
3463
3477
  provides: ["vision.caption", "vision.ask"],
3464
3478
  provider: "tjs",
3465
3479
  source: { modelId: "HuggingFaceTB/SmolVLM-256M-Instruct" },
@@ -3478,6 +3492,9 @@ const VISION_RECORDS = [
3478
3492
  {
3479
3493
  id: "lfm2-vl-450m",
3480
3494
  label: "lfm2-vl 450m",
3495
+ speed: "fast",
3496
+ verdict: "faster, sharper",
3497
+ group: "tiny",
3481
3498
  provides: ["vision.caption", "vision.ask"],
3482
3499
  provider: "tjs",
3483
3500
  source: { modelId: "onnx-community/LFM2-VL-450M-ONNX" },
@@ -3495,11 +3512,257 @@ const VISION_RECORDS = [
3495
3512
  notes: ["earlier builds: q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
3496
3513
  }
3497
3514
  ];
3515
+ /**
3516
+ * Records listed for pickers and never registered by default, so a hub's
3517
+ * routing by capability keeps its small defaults: larger alternates the
3518
+ * earlier tools offered (smolvlm 500m and 2 video, gemma 4 e2b, two more
3519
+ * depth models), and records under licences that limit use (YOLOv10 and
3520
+ * FastSAM are AGPL-3.0 upstream, Ultralytics; the face swap set is
3521
+ * InsightFace, non-commercial). A hub that runs one adds it itself. Sizes
3522
+ * are the hub listings' files (vendor, 2026-11-25), in MiB.
3523
+ */
3524
+ const yolo10 = (size, mb, speed, verdict) => ({
3525
+ id: `yolov10${size}`,
3526
+ label: `yolov10 ${{
3527
+ n: "nano",
3528
+ s: "small",
3529
+ m: "medium"
3530
+ }[size]}`,
3531
+ group: size === "n" ? "tiny" : "good",
3532
+ speed,
3533
+ verdict,
3534
+ provides: ["detect"],
3535
+ provider: "ort",
3536
+ source: {
3537
+ repo: `onnx-community/yolov10${size}`,
3538
+ file: "onnx/model.onnx"
3539
+ },
3540
+ sizeMB: mb,
3541
+ sizeSource: "vendor",
3542
+ ladder: [{
3543
+ device: "webgpu",
3544
+ ort: { executionProviders: ["webgpu", "wasm"] }
3545
+ }, {
3546
+ device: "wasm",
3547
+ ort: { executionProviders: ["wasm"] }
3548
+ }],
3549
+ licence: "AGPL-3.0 (Ultralytics weights, the model card's licence field)",
3550
+ commercial: false,
3551
+ place: "gpu",
3552
+ notes: ["output [1, 300, 6] after the model's own selection, so no nms pass (vendor, the yolov10 paper)", "an earlier room offered nano, small and medium"]
3553
+ });
3554
+ const PICKER_RECORDS = [
3555
+ {
3556
+ id: "smolvlm-500m-instruct",
3557
+ label: "smolvlm 500m",
3558
+ speed: "steady",
3559
+ verdict: "better captions, slower",
3560
+ group: "good",
3561
+ provides: ["vision.caption", "vision.ask"],
3562
+ provider: "tjs",
3563
+ source: { modelId: "HuggingFaceTB/SmolVLM-500M-Instruct" },
3564
+ sizeMB: 463,
3565
+ sizeSource: "vendor",
3566
+ ladder: LADDERS.smolvlm(),
3567
+ quirks: {
3568
+ repetitionPenalty: 1.3,
3569
+ maxTokensAction: 64
3570
+ },
3571
+ licence: "Apache-2.0",
3572
+ commercial: true,
3573
+ place: "cpu-worker",
3574
+ runtime: "@huggingface/transformers@4.3.2"
3575
+ },
3576
+ {
3577
+ id: "smolvlm2-256m-video-instruct",
3578
+ label: "smolvlm2 256m video",
3579
+ speed: "fast",
3580
+ verdict: "watches short clips",
3581
+ group: "tiny",
3582
+ provides: ["vision.caption", "vision.ask"],
3583
+ provider: "tjs",
3584
+ source: { modelId: "HuggingFaceTB/SmolVLM2-256M-Video-Instruct" },
3585
+ sizeMB: 252,
3586
+ sizeSource: "vendor",
3587
+ ladder: LADDERS.smolvlm(),
3588
+ quirks: {
3589
+ repetitionPenalty: 1.3,
3590
+ maxTokensAction: 64
3591
+ },
3592
+ licence: "Apache-2.0",
3593
+ commercial: true,
3594
+ place: "cpu-worker",
3595
+ runtime: "@huggingface/transformers@4.3.2",
3596
+ notes: ["an earlier room offered it beside smolvlm 256m and 500m"]
3597
+ },
3598
+ {
3599
+ id: "depth-anything-v2-base",
3600
+ label: "depth anything v2 base",
3601
+ speed: "steady",
3602
+ verdict: "finer depth, non commercial",
3603
+ group: "good",
3604
+ provides: ["depth"],
3605
+ provider: "tjs",
3606
+ source: { modelId: "onnx-community/depth-anything-v2-base" },
3607
+ sizeMB: 186,
3608
+ sizeSource: "vendor",
3609
+ ladder: LADDERS.depth(),
3610
+ licence: "CC-BY-NC-4.0 (the model card's licence field)",
3611
+ commercial: false,
3612
+ place: "cpu-worker",
3613
+ runtime: "@huggingface/transformers@4.3.2"
3614
+ },
3615
+ {
3616
+ id: "depth-anything-small-v1",
3617
+ label: "depth anything v1 small",
3618
+ speed: "fast",
3619
+ verdict: "the first version",
3620
+ group: "tiny",
3621
+ provides: ["depth"],
3622
+ provider: "tjs",
3623
+ source: { modelId: "Xenova/depth-anything-small-hf" },
3624
+ sizeMB: 48,
3625
+ sizeSource: "vendor",
3626
+ ladder: LADDERS.depth(),
3627
+ licence: "Apache-2.0 (the upstream card; this export's card has no licence field)",
3628
+ commercial: "unknown",
3629
+ place: "cpu-worker",
3630
+ runtime: "@huggingface/transformers@4.3.2"
3631
+ },
3632
+ {
3633
+ id: "gemma-4-e2b-vision",
3634
+ label: "gemma 4 e2b",
3635
+ speed: "slow",
3636
+ verdict: "sees most, heavy",
3637
+ group: "good",
3638
+ provides: ["vision.caption", "vision.ask"],
3639
+ provider: "tjs",
3640
+ source: { modelId: "onnx-community/gemma-4-E2B-it-ONNX" },
3641
+ sizeMB: 3566,
3642
+ sizeSource: "vendor",
3643
+ ladder: LADDERS.vlmGpuOnly(),
3644
+ quirks: {
3645
+ systemRole: false,
3646
+ strictAlternation: true,
3647
+ maxTokensAction: 96
3648
+ },
3649
+ licence: "Apache-2.0 (the model card's licence field)",
3650
+ commercial: true,
3651
+ place: "gpu",
3652
+ runtime: "@huggingface/transformers@4.3.2",
3653
+ notes: ["an earlier dog sim used it as the cortex at about 3.3 GB (vendor there)"]
3654
+ },
3655
+ yolo10("n", 9, "instant", "nano, quick"),
3656
+ yolo10("s", 28, "fast", "small, sharper"),
3657
+ yolo10("m", 59, "steady", "medium, best boxes"),
3658
+ {
3659
+ id: "fastsam-s",
3660
+ label: "fastsam s",
3661
+ speed: "fast",
3662
+ verdict: "finds everything, cpu ok",
3663
+ group: "good",
3664
+ provides: ["segment.everything"],
3665
+ provider: "ort",
3666
+ source: {
3667
+ repo: "anakhiu/fastsam-onnx",
3668
+ file: "fastsam_s.onnx"
3669
+ },
3670
+ sizeMB: 45,
3671
+ sizeSource: "vendor",
3672
+ ladder: [{
3673
+ device: "webgpu",
3674
+ ort: { executionProviders: ["webgpu", "wasm"] }
3675
+ }, {
3676
+ device: "wasm",
3677
+ ort: { executionProviders: ["wasm"] }
3678
+ }],
3679
+ licence: "AGPL-3.0 upstream (Ultralytics FastSAM); the export's card says apache-2.0",
3680
+ commercial: false,
3681
+ place: "cpu-worker",
3682
+ notes: ["an earlier mask tool found every mask in one pass on onnxruntime-web (93 MB there, vendor)", "segment everything: prototype masks, nms, then a pick by click"]
3683
+ },
3684
+ {
3685
+ id: "scrfd-10g",
3686
+ label: "face finder (scrfd 10g)",
3687
+ speed: "fast",
3688
+ verdict: "finds faces",
3689
+ group: "start here",
3690
+ provides: ["face.detect"],
3691
+ provider: "ort",
3692
+ source: {
3693
+ repo: "immich-app/buffalo_l",
3694
+ file: "detection/model.onnx"
3695
+ },
3696
+ sizeMB: 16,
3697
+ sizeSource: "vendor",
3698
+ ladder: [{
3699
+ device: "wasm",
3700
+ ort: { executionProviders: ["wasm"] }
3701
+ }],
3702
+ licence: "InsightFace model pack: non-commercial research only (the buffalo_l pack terms)",
3703
+ commercial: false,
3704
+ place: "cpu-worker"
3705
+ },
3706
+ {
3707
+ id: "arcface-w600k-r50",
3708
+ label: "face id (arcface r50)",
3709
+ speed: "steady",
3710
+ verdict: "who is who",
3711
+ group: "start here",
3712
+ provides: ["face.embed"],
3713
+ provider: "ort",
3714
+ source: {
3715
+ repo: "immich-app/buffalo_l",
3716
+ file: "recognition/model.onnx"
3717
+ },
3718
+ sizeMB: 166,
3719
+ sizeSource: "vendor",
3720
+ ladder: [{
3721
+ device: "webgpu",
3722
+ ort: { executionProviders: ["webgpu", "wasm"] }
3723
+ }, {
3724
+ device: "wasm",
3725
+ ort: { executionProviders: ["wasm"] }
3726
+ }],
3727
+ licence: "InsightFace model pack: non-commercial research only (the buffalo_l pack terms)",
3728
+ commercial: false,
3729
+ place: "cpu-worker"
3730
+ },
3731
+ {
3732
+ id: "inswapper-128",
3733
+ label: "face swap (inswapper 128)",
3734
+ speed: "slow",
3735
+ verdict: "the swap itself",
3736
+ group: "start here",
3737
+ provides: ["face.swap"],
3738
+ provider: "ort",
3739
+ source: {
3740
+ repo: "hacksider/inswapper_128",
3741
+ file: "inswapper_128.onnx"
3742
+ },
3743
+ sizeMB: 529,
3744
+ sizeSource: "vendor",
3745
+ ladder: [{
3746
+ device: "webgpu",
3747
+ ort: { executionProviders: ["webgpu", "wasm"] }
3748
+ }, {
3749
+ device: "wasm",
3750
+ ort: { executionProviders: ["wasm"] }
3751
+ }],
3752
+ licence: "InsightFace: non-commercial research only; the mirror's card says gpl-3.0",
3753
+ commercial: false,
3754
+ place: "gpu",
3755
+ notes: ["128 px faces; an earlier face swap tool pasted the result back with a feathered mask"]
3756
+ }
3757
+ ];
3498
3758
  /** A face landmark fallback record over face-api.js tiny nets (code MIT; weights MIT from @vladmandic/face-api). */
3499
3759
  function faceApiRecord(baseUrl) {
3500
3760
  return {
3501
3761
  id: "face-api-tiny",
3502
3762
  label: "face-api tiny landmarks (68 points)",
3763
+ speed: "instant",
3764
+ verdict: "68 points, cpu",
3765
+ group: "cpu",
3503
3766
  provides: ["landmarks.face"],
3504
3767
  provider: "faceapi",
3505
3768
  source: { url: baseUrl },
@@ -3516,6 +3779,9 @@ function yoloRecord(o) {
3516
3779
  return {
3517
3780
  id: o.id ?? "yolov8n",
3518
3781
  label: "yolov8n (external)",
3782
+ group: "tiny",
3783
+ speed: "instant",
3784
+ verdict: "nano, your file",
3519
3785
  provides: ["detect"],
3520
3786
  provider: "ort",
3521
3787
  source: {
@@ -5233,4 +5499,4 @@ function gazeTarget(p, gain = 1.3) {
5233
5499
  y: clamp(p.face.y * gain)
5234
5500
  } : null;
5235
5501
  }
5236
- export { CANNED_GESTURES, COCO_LABELS, DEFAULT_REACTIONS, DEPTH_WORKER_SOURCE, EmbeddingCache, LOOK_PATTERN, MP_MODELS, ResultCache, SeenNotes, SignalTracker, TASKS_VISION, VISION_RECORDS, ask, attachVision, caption, centreDetector, cutoutPng, cutoutRgba, decodeYolo, depth, depthFromOutput, depthLoader, depthToRgba, depthWorker, describePerception, detect, detectCadenceMs, discSegmenter, emptyMask, encodePng, faceApiProvider, faceApiRecord, fitSize, fixedLandmarker, fixedVlm, gazeTarget, hasPrompt, iou, landmarkChain, landmarks, letterboxParams, letterboxTensor, loadTasksVision, maskArea, maskDilate, maskErode, maskFeather, maskFromRle, maskIntersect, maskInvert, maskLargestComponent, maskOutline, maskSubtract, maskThreshold, maskToPng, maskToRgba, maskToRle, maskToSvg, maskUnion, mediapipeLadder, mediapipeProvider, nms, perceptionLoop, promptSegmenter, rampDepth, rawFace, rawFromLandmarks, rawHands, reactionsFor, readbackLoop, samLoader, segment, tasksVisionUrls, tasksVisionWasm, visionStubs, vlmLoader, wantsLook, yoloDetector, yoloRecord };
5502
+ export { CANNED_GESTURES, COCO_LABELS, DEFAULT_REACTIONS, DEPTH_WORKER_SOURCE, EmbeddingCache, LOOK_PATTERN, MP_MODELS, PICKER_RECORDS, ResultCache, SeenNotes, SignalTracker, TASKS_VISION, VISION_RECORDS, ask, attachVision, caption, centreDetector, cutoutPng, cutoutRgba, decodeYolo, depth, depthFromOutput, depthLoader, depthToRgba, depthWorker, describePerception, detect, detectCadenceMs, discSegmenter, emptyMask, encodePng, faceApiProvider, faceApiRecord, fitSize, fixedLandmarker, fixedVlm, gazeTarget, hasPrompt, iou, landmarkChain, landmarks, letterboxParams, letterboxTensor, loadTasksVision, maskArea, maskDilate, maskErode, maskFeather, maskFromRle, maskIntersect, maskInvert, maskLargestComponent, maskOutline, maskSubtract, maskThreshold, maskToPng, maskToRgba, maskToRle, maskToSvg, maskUnion, mediapipeLadder, mediapipeProvider, nms, perceptionLoop, promptSegmenter, rampDepth, rawFace, rawFromLandmarks, rawHands, reactionsFor, readbackLoop, samLoader, segment, tasksVisionUrls, tasksVisionWasm, visionStubs, vlmLoader, wantsLook, yoloDetector, yoloRecord };
package/how.ts ADDED
@@ -0,0 +1,32 @@
1
+ // how this works: the fold of the package page and of the suite tool. Plain data, no imports;
2
+ // checked by tsconfig.how.json, shipped in the tarball, never imported by the runtime entry.
3
+ const how: HowDoc = {
4
+ packages: ["@hackbuild/vision"],
5
+ what: `perception through the \`@hackbuild/models\` hub: depth, detection, segmentation, face, hand and pose landmarks with a fallback chain, and captions and questions through small vlms, plus a webcam loop helper and a result cache.`,
6
+ how: [
7
+ `every task is a capability on the \`@hackbuild/models\` hub with a fallback chain of records, so a call names what it wants (depth, detect, segment, face, hand, pose, caption) and the hub picks a model this device can run.`,
8
+ `every call takes \`schedule\` (passed to \`hub.run\`: \`minIntervalMs\`, \`idleOnly\`, \`frameBudgetMs\`) and \`size\` or \`maxMB\` to route to a smaller model, so a rendering page keeps its frames.`,
9
+ `\`depthWorker\` runs depth anything v2 small (apache-2.0) in a dedicated worker, so pre and post processing and the readback leave the page thread. the yolo decoder is written from the published output layout and is never registered by default.`,
10
+ ],
11
+ install: "npm install @hackbuild/vision",
12
+ today: `git clone https://github.com/hackbuild/hackbuild-browser-ai
13
+ cd hackbuild-browser-ai && npm ci && npm run build
14
+ npm pack -w @hackbuild/vision`,
15
+ code: `import { createHub, stubFactory } from "@hackbuild/models";
16
+ import { tjsProvider, loadTransformers } from "@hackbuild/devices";
17
+ import { attachVision, mediapipeProvider, loadTasksVision, visionStubs, depth, detect, landmarks, caption } from "@hackbuild/vision";
18
+
19
+ const tjs = tjsProvider({ runtime: loadTransformers() });
20
+ const hub = createHub({ env, stub: new URLSearchParams(location.search).has("stub") });
21
+ attachVision(hub, tjs); // records plus transformers.js loaders
22
+ hub.provide("tjs", tjs.factory);
23
+ hub.provide("mediapipe", mediapipeProvider({ runtime: loadTasksVision() }));
24
+ hub.provide("stub", stubFactory(visionStubs()));
25
+
26
+ const map = await depth(hub, imageOrCanvas); // 0 to 1, larger is nearer, plus the raw range
27
+ const boxes = await detect(hub, video, { scoreThreshold: 0.4 });
28
+ const face = await landmarks(hub, "face", video); // falls through the chain, face.failures says what failed
29
+ const line = await caption(hub, frame); // serialized on the vlm chain`,
30
+ links: { page: "https://hackbuild.github.io/hackbuild-browser-ai/vision/", source: "https://github.com/hackbuild/hackbuild-browser-ai/tree/main/packages/vision" },
31
+ };
32
+ export default how;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackbuild/vision",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Perception through the models hub: depth (Depth Anything V2 small), detection (MediaPipe EfficientDet, YOLO as an optional external model), segmentation, face, hand and pose landmarks with a fallback chain, captions and questions through small VLMs, a webcam loop helper and a result cache.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "files": [
24
24
  "dist",
25
+ "how.ts",
25
26
  "README.md",
26
27
  "LICENSE"
27
28
  ],
@@ -31,9 +32,9 @@
31
32
  "build": "tsc -b"
32
33
  },
33
34
  "dependencies": {
34
- "@hackbuild/ai-env": "0.1.0",
35
- "@hackbuild/models": "0.1.0",
36
- "@hackbuild/devices": "0.1.0",
37
- "@hackbuild/weights": "0.1.0"
35
+ "@hackbuild/ai-env": "0.1.1",
36
+ "@hackbuild/models": "0.2.0",
37
+ "@hackbuild/devices": "0.1.2",
38
+ "@hackbuild/weights": "0.1.1"
38
39
  }
39
40
  }