@monitordog/detector 1.0.0 → 1.0.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 +17 -25
- package/dist/assets/{inference-worker-BqvxPw8S.js → inference-worker-C-n1YxCo.js} +1 -1
- package/dist/constants.d.ts +6 -11
- package/dist/detect/model-loader.d.ts +4 -4
- package/dist/monitordog-detector.js +3470 -3531
- package/dist/monitordog-detector.umd.cjs +16 -16
- package/dist/service/container.d.ts +0 -2
- package/dist/types.d.ts +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,12 @@ npm install @monitordog/detector
|
|
|
16
16
|
login({ email }) -> sessionTokenProvider({ email }) -> customer backend -> POST /v1/sdk/sessions -> browser SDK
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
Before using the browser SDK, MonitorDog must enable SDK integration for your
|
|
20
|
+
organization. In the MonitorDog admin, create an SDK client and register every
|
|
21
|
+
browser origin that will call MonitorDog runtime APIs, for example
|
|
22
|
+
`https://app.example.com` or `http://localhost:8080`. Paths, query strings,
|
|
23
|
+
fragments, and wildcards are not accepted.
|
|
24
|
+
|
|
19
25
|
Do not put a MonitorDog partner API key in browser code, browser environment variables, local storage, or a frontend-only proxy. The customer backend owns the partner API key and returns only a short-lived SDK access token to the browser.
|
|
20
26
|
|
|
21
27
|
Browser integration:
|
|
@@ -80,45 +86,31 @@ export async function POST(request: Request) {
|
|
|
80
86
|
}
|
|
81
87
|
```
|
|
82
88
|
|
|
83
|
-
##
|
|
89
|
+
## Network Access
|
|
84
90
|
|
|
85
|
-
|
|
91
|
+
Your backend issues short-lived SDK tokens through `POST /v1/sdk/sessions`.
|
|
92
|
+
The browser SDK uses `apiBaseUrl` to load MonitorDog runtime resources, fetch
|
|
93
|
+
account policy, upload evidence images, and send detection events.
|
|
86
94
|
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
- `POST /file/image`
|
|
91
|
-
- `POST /event`
|
|
95
|
+
Model, ORT, and MediaPipe assets are selected by the MonitorDog API from the
|
|
96
|
+
current server-side asset for the runtime and input size. Customer integrations
|
|
97
|
+
do not configure model build versions or build numbers.
|
|
92
98
|
|
|
93
|
-
|
|
99
|
+
`/v1/sdk/sessions` is a backend-only token broker API. Do not call it directly
|
|
100
|
+
from browser code because it requires your MonitorDog partner API key.
|
|
94
101
|
|
|
95
102
|
## Public API
|
|
96
103
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
Official customer entrypoint:
|
|
100
|
-
|
|
101
|
-
- `MonitorDogDetector.init(options)`
|
|
102
|
-
|
|
103
|
-
Compatibility exports for older integrations:
|
|
104
|
-
|
|
105
|
-
- `configureMonitorDogDetector(options)`
|
|
106
|
-
- `createMonitorDogDetector(options)`
|
|
107
|
-
- `getDetector()`
|
|
104
|
+
Use `MonitorDogDetector.init(options)` to create the detector.
|
|
108
105
|
|
|
109
|
-
|
|
106
|
+
Common detector methods:
|
|
110
107
|
|
|
111
108
|
- `login({ email })`
|
|
112
|
-
- `load()`
|
|
113
109
|
- `start()`
|
|
114
110
|
- `stop()`
|
|
115
111
|
- `logout()`
|
|
116
112
|
- `dispose()`
|
|
117
113
|
- `getState()`
|
|
118
|
-
- `setRunInBackground(runInBackground)`
|
|
119
|
-
- `getUserPreferences()`
|
|
120
|
-
- `isMainUserTrackingEnabled()`
|
|
121
|
-
- `setMainUserTrackingEnabled(enabled)`
|
|
122
114
|
|
|
123
115
|
Default lifecycle:
|
|
124
116
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){let e=[`phone_back`,`phone_front`,`phone_back_cam`,`cup`,`hand`,`face`];function t(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t.getUint32(0,!0),a=t.getUint32(4,!0),o=r(e.byteLength,i+a),s=Uint32Array.BYTES_PER_ELEMENT*2,c=n(t,s,i,{classId:5,label:`face`,recordFloatCount:o});s+=i*o*Float32Array.BYTES_PER_ELEMENT;let l=n(t,s,a,{classId:0,label:`phone`,recordFloatCount:o});return{faceDetected:i>0,phoneDetected:a>0,faceCount:i,phoneCount:a,faceDetections:c,phoneDetections:l}}function n(e,t,n,r){let a=[],o=t;for(let t=0;t<n;t+=1){let t=r.recordFloatCount===7,n=t?e.getFloat32(o,!0):r.classId,s=t?o+Float32Array.BYTES_PER_ELEMENT:o;a.push({classId:n,label:t?i(n):r.label,score:e.getFloat32(s,!0),confidence:e.getFloat32(s+4,!0),x:e.getFloat32(s+8,!0),y:e.getFloat32(s+12,!0),width:e.getFloat32(s+16,!0),height:e.getFloat32(s+20,!0)}),o+=r.recordFloatCount*Float32Array.BYTES_PER_ELEMENT}return a}function r(e,t){return t===0||e-Uint32Array.BYTES_PER_ELEMENT*2==t*7*Float32Array.BYTES_PER_ELEMENT?7:6}function i(t){return e[t]??`unknown`}async function a(e){return c({...e,
|
|
1
|
+
(function(){let e=[`phone_back`,`phone_front`,`phone_back_cam`,`cup`,`hand`,`face`];function t(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t.getUint32(0,!0),a=t.getUint32(4,!0),o=r(e.byteLength,i+a),s=Uint32Array.BYTES_PER_ELEMENT*2,c=n(t,s,i,{classId:5,label:`face`,recordFloatCount:o});s+=i*o*Float32Array.BYTES_PER_ELEMENT;let l=n(t,s,a,{classId:0,label:`phone`,recordFloatCount:o});return{faceDetected:i>0,phoneDetected:a>0,faceCount:i,phoneCount:a,faceDetections:c,phoneDetections:l}}function n(e,t,n,r){let a=[],o=t;for(let t=0;t<n;t+=1){let t=r.recordFloatCount===7,n=t?e.getFloat32(o,!0):r.classId,s=t?o+Float32Array.BYTES_PER_ELEMENT:o;a.push({classId:n,label:t?i(n):r.label,score:e.getFloat32(s,!0),confidence:e.getFloat32(s+4,!0),x:e.getFloat32(s+8,!0),y:e.getFloat32(s+12,!0),width:e.getFloat32(s+16,!0),height:e.getFloat32(s+20,!0)}),o+=r.recordFloatCount*Float32Array.BYTES_PER_ELEMENT}return a}function r(e,t){return t===0||e-Uint32Array.BYTES_PER_ELEMENT*2==t*7*Float32Array.BYTES_PER_ELEMENT?7:6}function i(t){return e[t]??`unknown`}async function a(e){return c({...e,asset:`detector`,inputSize:e.inputSize,errorContext:`model`})}async function o(e){let t=await c({apiBaseUrl:e.apiBaseUrl,accessToken:e.accessToken,asset:`ort-js`,errorContext:`ORT JS runtime`});try{return new TextDecoder().decode(t)}finally{t.fill(0)}}async function s(e){return c({apiBaseUrl:e.apiBaseUrl,accessToken:e.accessToken,asset:`ort-wasm`,errorContext:`ORT WASM runtime`})}async function c(e){x();let t=await crypto.subtle.generateKey({name:`RSA-OAEP`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`},!0,[`decrypt`]),n=m(await f(t.publicKey)),r=await l({apiBaseUrl:e.apiBaseUrl,accessToken:e.accessToken,asset:e.asset,inputSize:e.inputSize,errorContext:e.errorContext},n),i=await u(r.asset_download_url),a=new Uint8Array(await crypto.subtle.decrypt({name:`RSA-OAEP`},t.privateKey,b(h(r.encrypted_dek)))),o=g(a);try{return await d(i,o)}finally{i.fill(0),a.fill(0),o.fill(0)}}async function l(e,t){let n=new URLSearchParams({asset:e.asset,public_key:t});e.inputSize!==void 0&&n.set(`input_size`,String(e.inputSize));let r=await fetch(`${e.apiBaseUrl}/auth/sdk-assets?${n}`,{method:`GET`,headers:{accept:`application/json`,authorization:`Bearer ${e.accessToken}`,"Device-Access-Token":e.accessToken}});if(!r.ok)throw Error(`MonitorDog SDK ${e.errorContext} request failed: ${r.status}`);let i=await r.json();if(!i.encrypted_dek||!i.asset_download_url)throw Error(`MonitorDog SDK ${e.errorContext} response is incomplete.`);return{encrypted_dek:i.encrypted_dek,asset_download_url:i.asset_download_url,asset:i.asset??e.asset,input_size:i.input_size??null,version:i.version??``}}async function u(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to download MonitorDog model: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())}async function d(e,t){if(e.byteLength<=12)throw Error(`MonitorDog encrypted model data is too short.`);let n=await crypto.subtle.importKey(`raw`,b(t),{name:`AES-GCM`},!1,[`decrypt`]),r=e.slice(0,12),i=e.slice(12);return new Uint8Array(await crypto.subtle.decrypt({name:`AES-GCM`,iv:b(r)},n,b(i)))}async function f(e){let t=await crypto.subtle.exportKey(`spki`,e);return[`-----BEGIN PUBLIC KEY-----`,...p(new Uint8Array(t)).match(/.{1,64}/g)??[],`-----END PUBLIC KEY-----`].join(`
|
|
2
2
|
`)}function p(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function m(e){return p(new TextEncoder().encode(e))}function h(e){let t=e.replace(/-----BEGIN [^-]+-----/g,``).replace(/-----END [^-]+-----/g,``).replace(/\s/g,``).replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t+`=`.repeat(n),i=atob(r),a=new Uint8Array(i.length);for(let e=0;e<i.length;e+=1)a[e]=i.charCodeAt(e);return a}function g(e){if(y(e.byteLength))return new Uint8Array(e);let t=new TextDecoder().decode(e).trim(),n=_(t.startsWith(`"`)&&t.endsWith(`"`)?t.slice(1,-1):t);if(n&&y(n.byteLength))return n;throw Error(`MonitorDog SDK model DEK must decode to a 128-bit or 256-bit AES key. Received ${e.byteLength} bytes.`)}function _(e){if(/^[0-9a-f]+$/i.test(e)&&e.length%2==0)return v(e);try{return h(e)}catch{return}}function v(e){let t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n+=1)t[n]=Number.parseInt(e.slice(n*2,n*2+2),16);return t}function y(e){return e===16||e===32}function b(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}function x(){if(!globalThis.crypto?.subtle)throw Error(`MonitorDog SDK model decryption requires Web Crypto API.`)}var S=class{loadOptions;module;loadPromise;wasmBlobUrl;detectorInputPointer=0;detectorInputByteLength=0;detectorDimsPointer=0;detectorDimsByteLength=0;detectorOutputDataPointerPointer=0;detectorOutputByteLengthPointer=0;constructor(e){this.loadOptions=e}async load(e){this.loadPromise||=this.loadModel(e),await this.loadPromise}async run(e){let t=await this.getModule();if(e.input.type!==`float32`)throw Error(`ort-detector PoC only supports float32 input tensors.`);if(!(e.input.data instanceof Float32Array))throw Error(`ort-detector PoC expected Float32Array input data.`);let n=e.input.data,r=t._malloc(n.byteLength),i=t._malloc(e.input.dims.length*8),a=t._malloc(4),o=t._malloc(4),s=t._malloc(4),c=t._malloc(4);try{t.HEAPF32.set(n,r/Float32Array.BYTES_PER_ELEMENT),C(t,i,e.input.dims),T(t,t._md_ort_run_float32_nchw(r,n.length,i,e.input.dims.length,a,o,s,c),`ort-detector inference failed`);let l=t.getValue(a,`*`),u=t.getValue(o,`i32`),d=t.getValue(s,`*`),f=t.getValue(c,`i32`);try{let n=new Float32Array(u);return n.set(t.HEAPF32.subarray(l/Float32Array.BYTES_PER_ELEMENT,l/Float32Array.BYTES_PER_ELEMENT+u)),{output:{type:`float32`,data:n,dims:w(t,d,f)},input:e.metadata}}finally{t._md_ort_free(l),t._md_ort_free(d)}}finally{t.HEAPU8.fill(0,r,r+n.byteLength),t._free(r),t._free(i),t._free(a),t._free(o),t._free(s),t._free(c)}}async runDetector(e){let n=await this.getModule();if(e.input.type!==`float32`)throw Error(`ort-detector only supports float32 input tensors.`);if(!(e.input.data instanceof Float32Array))throw Error(`ort-detector expected Float32Array input data.`);let r=e.input.data,i=this.ensureDetectorBuffers(n,r.byteLength,e.input.dims.length*BigInt64Array.BYTES_PER_ELEMENT);n.HEAPF32.set(r,i.inputPointer/Float32Array.BYTES_PER_ELEMENT),C(n,i.dimsPointer,e.input.dims),T(n,n._md_ort_run_detector_float32_nchw(i.inputPointer,r.length,i.dimsPointer,e.input.dims.length,e.metadata.sourceWidth,e.metadata.sourceHeight,e.metadata.ratio,e.metadata.padX,e.metadata.padY,e.confidenceThreshold,e.faceConfidenceThreshold,e.iouThreshold,e.maxDetections,i.outputDataPointerPointer,i.outputByteLengthPointer),`ort-detector run failed`);let a=n.getValue(i.outputDataPointerPointer,`*`),o=n.getValue(i.outputByteLengthPointer,`i32`);try{return t(n.HEAPU8.subarray(a,a+o))}finally{n._md_ort_free(a)}}dispose(){this.releaseDetectorBuffers(),this.module?._md_ort_dispose(),this.module=void 0,this.loadPromise=void 0,this.revokeWasmBlobUrl()}async loadModel(e){let t=await this.getModule();try{let n=t._malloc(e.byteLength);try{t.HEAPU8.set(e,n),T(t,t._md_ort_load_model(n,e.byteLength),`ort-detector model load failed`)}finally{t.HEAPU8.fill(0,n,n+e.byteLength),t._free(n)}}finally{e.fill(0)}}async getModule(){if(!this.module){let[e,t]=await Promise.all([o(this.loadOptions),s(this.loadOptions)]),n=new Blob([e],{type:`text/javascript`}),r=URL.createObjectURL(n),i=URL.createObjectURL(new Blob([E(t)],{type:`application/wasm`})),a;try{a=(await import(r)).default}finally{t.fill(0),URL.revokeObjectURL(r)}this.revokeWasmBlobUrl(),this.wasmBlobUrl=i,this.module=await a({locateFile:e=>e.endsWith(`.wasm`)?i:e});let c=this.module._md_ort_init();T(this.module,c,`ort-detector initialization failed`)}return this.module}ensureDetectorBuffers(e,t,n){return this.detectorInputByteLength<t&&(this.detectorInputPointer&&(e.HEAPU8.fill(0,this.detectorInputPointer,this.detectorInputPointer+this.detectorInputByteLength),e._free(this.detectorInputPointer)),this.detectorInputPointer=e._malloc(t),this.detectorInputByteLength=t),this.detectorDimsByteLength<n&&(this.detectorDimsPointer&&e._free(this.detectorDimsPointer),this.detectorDimsPointer=e._malloc(n),this.detectorDimsByteLength=n),this.detectorOutputDataPointerPointer||=e._malloc(4),this.detectorOutputByteLengthPointer||=e._malloc(4),{inputPointer:this.detectorInputPointer,dimsPointer:this.detectorDimsPointer,outputDataPointerPointer:this.detectorOutputDataPointerPointer,outputByteLengthPointer:this.detectorOutputByteLengthPointer}}releaseDetectorBuffers(){let e=this.module;if(!e){this.resetDetectorBuffers();return}this.detectorInputPointer&&(e.HEAPU8.fill(0,this.detectorInputPointer,this.detectorInputPointer+this.detectorInputByteLength),e._free(this.detectorInputPointer)),this.detectorDimsPointer&&e._free(this.detectorDimsPointer),this.detectorOutputDataPointerPointer&&e._free(this.detectorOutputDataPointerPointer),this.detectorOutputByteLengthPointer&&e._free(this.detectorOutputByteLengthPointer),this.resetDetectorBuffers()}resetDetectorBuffers(){this.detectorInputPointer=0,this.detectorInputByteLength=0,this.detectorDimsPointer=0,this.detectorDimsByteLength=0,this.detectorOutputDataPointerPointer=0,this.detectorOutputByteLengthPointer=0}revokeWasmBlobUrl(){this.wasmBlobUrl&&=(URL.revokeObjectURL(this.wasmBlobUrl),void 0)}};function C(e,t,n){let r=t/BigInt64Array.BYTES_PER_ELEMENT;for(let t=0;t<n.length;t+=1)e.HEAP64[r+t]=BigInt(n[t])}function w(e,t,n){let r=t/BigInt64Array.BYTES_PER_ELEMENT,i=[];for(let t=0;t<n;t+=1)i.push(Number(e.HEAP64[r+t]));return i}function T(e,t,n){if(t===0)return;let r=e._md_ort_get_last_error(),i=r?e.UTF8ToString(r):``;throw Error(i||n)}function E(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}let D=self,O,k=Promise.resolve();D.addEventListener(`message`,e=>{A(e.data)});async function A(e){try{if(e.type===`load`){O?.dispose(),O=new S(e.model),await O.load(await a(e.model)),z({id:e.id,ok:!0});return}let t=await j(e);z({id:e.id,ok:!0,result:t})}catch(t){z({id:e.id,ok:!1,error:t instanceof Error?t.message:String(t)})}}function j(e){let t=k.then(()=>M(e));return k=t.then(()=>void 0,()=>void 0),t}async function M(e){return N(e)}async function N(e){if(!O)throw Error(`ort-detector runtime is not loaded.`);let t=e.debug?performance.now():0,n=e.debug?performance.now():0,{input:r,metadata:i}=e.source.kind===`bitmap`?P(e.source,e.inputSize,e.inputType):F(e.source,e.inputSize,e.inputType),a=e.debug?performance.now():0,o=await O.runDetector({input:r,metadata:i,confidenceThreshold:e.confidenceThreshold,faceConfidenceThreshold:e.faceConfidenceThreshold,iouThreshold:e.iouThreshold,maxDetections:e.maxDetections});if(e.debug){let r=performance.now();console.info(`[MonitorDog] worker inference`,{source:e.source.kind,inputSize:e.inputSize,preprocessMs:B(a-n),ortMs:B(r-a),totalMs:B(r-t)})}return o}function P(e,t,n){try{if(typeof OffscreenCanvas>`u`)throw Error(`OffscreenCanvas is not available.`);let r=I(e.sourceWidth,e.sourceHeight,t),i=new OffscreenCanvas(t,t).getContext(`2d`);if(!i)throw Error(`2D canvas context is not available.`);return i.fillStyle=`rgb(114, 114, 114)`,i.fillRect(0,0,t,t),i.drawImage(e.bitmap,r.padX,r.padY,Math.round(e.sourceWidth*r.ratio),Math.round(e.sourceHeight*r.ratio)),{input:R(i.getImageData(0,0,t,t).data,n,t),metadata:r}}finally{e.bitmap.close()}}function F(e,t,n){let r=I(e.sourceWidth,e.sourceHeight,t);return{input:L(e.data,e.sourceWidth,e.sourceHeight,r,t,n),metadata:r}}function I(e,t,n){let r=Math.min(n/e,n/t);return{sourceWidth:e,sourceHeight:t,ratio:r,padX:Math.floor((n-Math.round(e*r))/2),padY:Math.floor((n-Math.round(t*r))/2)}}function L(e,t,n,r,i,a){let o=i*i,s=[1,3,i,i],c=a===`uint8`?new Uint8Array(o*3):new Float32Array(o*3);for(let s=0;s<i;s+=1)for(let l=0;l<i;l+=1){let u=s*i+l,d=Math.floor((l-r.padX)/r.ratio),f=Math.floor((s-r.padY)/r.ratio),p=d>=0&&f>=0&&d<t&&f<n,m=(f*t+d)*4,h=p?e[m]:114,g=p?e[m+1]:114,_=p?e[m+2]:114;a===`uint8`?(c[u]=h,c[u+o]=g,c[u+o*2]=_):(c[u]=h/255,c[u+o]=g/255,c[u+o*2]=_/255)}return{type:a,data:c,dims:s}}function R(e,t,n){let r=n*n,i=[1,3,n,n];if(t===`uint8`){let t=new Uint8Array(r*3);for(let n=0;n<r;n+=1){let i=n*4;t[n]=e[i],t[n+r]=e[i+1],t[n+r*2]=e[i+2]}return{type:`uint8`,data:t,dims:i}}let a=new Float32Array(r*3);for(let t=0;t<r;t+=1){let n=t*4;a[t]=e[n]/255,a[t+r]=e[n+1]/255,a[t+r*2]=e[n+2]/255}return{type:`float32`,data:a,dims:i}}function z(e,t){D.postMessage(e,t??[])}function B(e){return Math.round(e*10)/10}})();
|
package/dist/constants.d.ts
CHANGED
|
@@ -7,15 +7,10 @@ export declare const DEFAULT_MOBILE_INPUT_SIZE = 416;
|
|
|
7
7
|
export declare const DEFAULT_LOW_MEMORY_INPUT_SIZE = 320;
|
|
8
8
|
export declare const DEFAULT_REFRESH_BEFORE_MS = 60000;
|
|
9
9
|
export declare const DEFAULT_PERIODIC_REFRESH_INTERVAL_MS = 30000;
|
|
10
|
-
export declare const DEFAULT_MODEL_BUILD_VERSION = "0.0.2";
|
|
11
10
|
export declare const MAIN_USER_TRACKING_ENABLED_STORAGE_KEY = "monitordog.mainUserTracking.enabled";
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const MEDIAPIPE_VISION_WASM_MODULE_INTERNAL_JS_BUILD_NUMBER = "vision_wasm_module_internal.js";
|
|
19
|
-
export declare const MEDIAPIPE_VISION_WASM_MODULE_INTERNAL_WASM_BUILD_NUMBER = "vision_wasm_module_internal.wasm";
|
|
20
|
-
export declare const MEDIAPIPE_VISION_WASM_NOSIMD_INTERNAL_JS_BUILD_NUMBER = "vision_wasm_nosimd_internal.js";
|
|
21
|
-
export declare const MEDIAPIPE_VISION_WASM_NOSIMD_INTERNAL_WASM_BUILD_NUMBER = "vision_wasm_nosimd_internal.wasm";
|
|
11
|
+
export declare const SDK_MODEL_ASSET_DETECTOR = "detector";
|
|
12
|
+
export declare const SDK_MODEL_ASSET_ORT_JS = "ort-js";
|
|
13
|
+
export declare const SDK_MODEL_ASSET_ORT_WASM = "ort-wasm";
|
|
14
|
+
export declare const SDK_MODEL_ASSET_MEDIAPIPE_VISION_WASM_JS = "mediapipe-vision-wasm-js";
|
|
15
|
+
export declare const SDK_MODEL_ASSET_MEDIAPIPE_VISION_WASM_WASM = "mediapipe-vision-wasm-wasm";
|
|
16
|
+
export declare const SDK_MODEL_ASSET_MEDIAPIPE_POSE_LANDMARKER = "mediapipe-pose-landmarker";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import type { SdkModelAssetName } from "../types";
|
|
1
2
|
export type WorkerModelLoadOptions = {
|
|
2
3
|
apiBaseUrl: string;
|
|
3
4
|
accessToken: string;
|
|
4
|
-
|
|
5
|
-
modelBuildNumber: string | number;
|
|
5
|
+
inputSize: number;
|
|
6
6
|
};
|
|
7
7
|
export type SdkAssetLoadOptions = {
|
|
8
8
|
apiBaseUrl: string;
|
|
9
9
|
accessToken: string;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
asset: SdkModelAssetName;
|
|
11
|
+
inputSize?: number;
|
|
12
12
|
errorContext: string;
|
|
13
13
|
};
|
|
14
14
|
export declare function downloadAndDecryptModel(options: WorkerModelLoadOptions): Promise<Uint8Array>;
|