@pose-tracker/react-native-pose-estimation-light 0.1.0 → 0.2.0
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 +10 -2
- package/lib/backends/webview/WebViewPoseBackend.d.ts +1 -1
- package/lib/backends/webview/onlineRuntime.d.ts +14 -4
- package/lib/backends/webview/onlineRuntime.js +22 -4
- package/lib/backends/webview/poseHtml.d.ts +12 -4
- package/lib/backends/webview/poseHtml.js +15 -6
- package/lib/backends/webview/poseRuntimeSource.js +2 -2
- package/lib/camera/WebViewPoseView.d.ts +12 -0
- package/lib/camera/WebViewPoseView.js +29 -0
- package/lib/client.d.ts +2 -2
- package/lib/client.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -2
- package/lib/models/poseModels.d.ts +8 -6
- package/lib/models/poseModels.js +9 -8
- package/lib/sdkVersion.d.ts +1 -1
- package/lib/sdkVersion.js +1 -1
- package/lib/types/events.d.ts +1 -1
- package/lib/types/features.d.ts +2 -2
- package/lib/types/features.js +8 -9
- package/package.json +1 -1
- package/src/backends/webview/WebViewPoseBackend.ts +1 -1
- package/src/backends/webview/onlineRuntime.ts +36 -5
- package/src/backends/webview/poseHtml.ts +23 -6
- package/src/camera/WebViewPoseView.tsx +43 -0
- package/src/client.ts +3 -3
- package/src/index.ts +3 -0
- package/src/models/poseModels.ts +14 -11
- package/src/sdkVersion.ts +1 -1
- package/src/types/events.ts +1 -0
- package/src/types/features.ts +8 -9
package/src/models/poseModels.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* MoveNet SinglePose Lightning hosted at app.posetracker.com (same URL as
|
|
6
6
|
* `usePoseDetection` / tracking WebView `modelUrl`).
|
|
7
7
|
*
|
|
8
|
-
* BlazePose
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* BlazePose loads via CDN `@tensorflow-models/pose-detection` inside the
|
|
9
|
+
* WebView (no graph `modelUrl`). Pass a TF.js `modelUrl` for any custom
|
|
10
|
+
* graph model.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/** Production MoveNet SinglePose Lightning topology (Front default). */
|
|
@@ -32,17 +32,20 @@ export interface ResolvePoseModelOptions {
|
|
|
32
32
|
modelUrl?: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export type PoseModelKind = 'movenet-graph' | 'blazepose' | 'custom-graph' | 'unsupported';
|
|
36
|
+
|
|
35
37
|
export interface ResolvedPoseModel {
|
|
36
38
|
/** Stable id reported in diagnostics / track params. */
|
|
37
39
|
modelId: string;
|
|
38
|
-
|
|
40
|
+
kind: PoseModelKind;
|
|
41
|
+
/** TF.js `loadGraphModel` URL when kind is movenet-graph or custom-graph. */
|
|
39
42
|
modelUrl: string | null;
|
|
40
|
-
/** Human-readable reason when
|
|
43
|
+
/** Human-readable reason when kind is unsupported. */
|
|
41
44
|
unsupportedReason?: string;
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
|
-
* Resolve which
|
|
48
|
+
* Resolve which online pose model the light WebView should run.
|
|
46
49
|
* Default: MoveNet SinglePose Lightning (product URL).
|
|
47
50
|
*/
|
|
48
51
|
export function resolvePoseModel(options: ResolvePoseModelOptions = {}): ResolvedPoseModel {
|
|
@@ -55,30 +58,30 @@ export function resolvePoseModel(options: ResolvePoseModelOptions = {}): Resolve
|
|
|
55
58
|
typeof options.model === 'string' && options.model.trim().length > 0
|
|
56
59
|
? options.model.trim()
|
|
57
60
|
: 'custom';
|
|
58
|
-
return { modelId: alias, modelUrl: explicit };
|
|
61
|
+
return { modelId: alias, kind: 'custom-graph', modelUrl: explicit };
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
const key = (options.model ?? 'movenet').trim().toLowerCase();
|
|
62
65
|
if (key === 'movenet' || key === 'movenet-singlepose-lightning' || key === 'lightning') {
|
|
63
66
|
return {
|
|
64
67
|
modelId: 'movenet-singlepose-lightning',
|
|
68
|
+
kind: 'movenet-graph',
|
|
65
69
|
modelUrl: DEFAULT_MOVENET_LIGHTNING_URL,
|
|
66
70
|
};
|
|
67
71
|
}
|
|
68
72
|
if (key === 'blazepose') {
|
|
69
73
|
return {
|
|
70
74
|
modelId: 'blazepose',
|
|
75
|
+
kind: 'blazepose',
|
|
71
76
|
modelUrl: null,
|
|
72
|
-
unsupportedReason:
|
|
73
|
-
'BlazePose is not wired in the light RN WebView yet (needs MediaPipe). ' +
|
|
74
|
-
'Use model="movenet" or pass a TF.js graph modelUrl.',
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
79
|
return {
|
|
78
80
|
modelId: key,
|
|
81
|
+
kind: 'unsupported',
|
|
79
82
|
modelUrl: null,
|
|
80
83
|
unsupportedReason:
|
|
81
|
-
`Unknown model "${options.model}". Use "movenet" (default) or pass modelUrl.`,
|
|
84
|
+
`Unknown model "${options.model}". Use "movenet" (default), "blazepose", or pass modelUrl.`,
|
|
82
85
|
};
|
|
83
86
|
}
|
|
84
87
|
|
package/src/sdkVersion.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** AUTO-GENERATED by scripts/sync-sdk-version.mjs — do not edit. */
|
|
2
|
-
export const SDK_VERSION = '0.
|
|
2
|
+
export const SDK_VERSION = '0.2.0';
|
package/src/types/events.ts
CHANGED
package/src/types/features.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* - `keypoints` DURING an exercise session requires a paid plan too
|
|
12
12
|
* (free may stream keypoints only in pose-only mode, i.e. no exercise).
|
|
13
13
|
* - `blazepose` / `poseEngine` / `mediapipeModel` / `poseBackend` /
|
|
14
|
-
* `runInWorker` are NOT
|
|
15
|
-
*
|
|
14
|
+
* `runInWorker` are NOT feature flags here — select BlazePose with
|
|
15
|
+
* `options.model = 'blazepose'` instead of `{ features: { blazepose: true } }`.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import type { MinGrade } from './events';
|
|
@@ -75,12 +75,12 @@ const KNOWN_FEATURE_KEYS = new Set<string>([
|
|
|
75
75
|
]);
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* WebView params that
|
|
79
|
-
*
|
|
80
|
-
*
|
|
78
|
+
* WebView params that are NOT feature flags in this SDK.
|
|
79
|
+
* Note: `options.model = 'blazepose'` is supported on light; passing
|
|
80
|
+
* `{ blazepose: true }` inside `features` is rejected (WebView query parity).
|
|
81
81
|
*/
|
|
82
82
|
const UNSUPPORTED_FEATURE_HINTS: Record<string, string> = {
|
|
83
|
-
blazepose: 'BlazePose',
|
|
83
|
+
blazepose: 'BlazePose as a features flag (use options.model = "blazepose" instead)',
|
|
84
84
|
poseEngine: 'pose engine selection (MediaPipe/PoseLandmarker)',
|
|
85
85
|
mediapipeModel: 'MediaPipe model selection',
|
|
86
86
|
poseBackend: 'pose backend selection',
|
|
@@ -108,9 +108,8 @@ export const COMBINED_REFERENCE_EXERCISE_MESSAGE =
|
|
|
108
108
|
export function featureNotSupportedMessage(key: string): string {
|
|
109
109
|
const hint = UNSUPPORTED_FEATURE_HINTS[key] ?? `'${key}'`;
|
|
110
110
|
return (
|
|
111
|
-
`The '${key}' option (${hint}) is not available
|
|
112
|
-
'
|
|
113
|
-
'Remove the option, or use the PoseTracker WebView product if you need it. ' +
|
|
111
|
+
`The '${key}' option (${hint}) is not available as a features flag. ` +
|
|
112
|
+
'Remove the option, or use options.model / modelUrl for model selection. ' +
|
|
114
113
|
'(visit: https://posetracker.gitbook.io/posetracker-api/tracking-endpoint)'
|
|
115
114
|
);
|
|
116
115
|
}
|