@hackbuild/vision 0.1.0 → 0.1.1
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/how.ts +32 -0
- package/package.json +6 -5
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.
|
|
3
|
+
"version": "0.1.1",
|
|
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.
|
|
35
|
-
"@hackbuild/models": "0.1.
|
|
36
|
-
"@hackbuild/devices": "0.1.
|
|
37
|
-
"@hackbuild/weights": "0.1.
|
|
35
|
+
"@hackbuild/ai-env": "0.1.1",
|
|
36
|
+
"@hackbuild/models": "0.1.1",
|
|
37
|
+
"@hackbuild/devices": "0.1.1",
|
|
38
|
+
"@hackbuild/weights": "0.1.1"
|
|
38
39
|
}
|
|
39
40
|
}
|