Skip to content

Commit 4cbead3

Browse files
committed
face-dection: allow providing custom locateFile
1 parent 18a7342 commit 4cbead3

File tree

5 files changed

+24
-23
lines changed

5 files changed

+24
-23
lines changed

face-detection/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@tensorflow-models/face-detection",
3-
"version": "1.0.3",
2+
"name": "@turbowarp/tensorflow-models-face-detection",
3+
"version": "1.0.3-tw1",
44
"description": "Pretrained face detection model",
55
"main": "dist/index.js",
66
"jsnext:main": "dist/face-detection.esm.js",
@@ -10,7 +10,7 @@
1010
"types": "dist/index.d.ts",
1111
"repository": {
1212
"type": "git",
13-
"url": "https://github.com/tensorflow/tfjs-models.git"
13+
"url": "https://github.com/TurboWarp/tfjs-models.git"
1414
},
1515
"peerDependencies": {
1616
"@mediapipe/face_detection": "~0.4.0",

face-detection/src/mediapipe/detector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ export class MediaPipeFaceDetectorMediaPipe implements FaceDetector {
4444
// Should not be called outside.
4545
constructor(config: MediaPipeFaceDetectorMediaPipeModelConfig) {
4646
this.faceDetectorSolution = new faceDetection.FaceDetection({
47-
locateFile: (path, base) => {
47+
locateFile: config.locateFile ?? ((path, base) => {
4848
if (config.solutionPath) {
4949
const solutionPath = config.solutionPath.replace(/\/+$/, '');
5050
return `${solutionPath}/${path}`;
5151
}
5252
return `${base}/${path}`;
53-
}
53+
})
5454
});
5555
this.faceDetectorSolution.setOptions(
5656
{selfieMode: this.selfieMode, model: config.modelType});

face-detection/src/mediapipe/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface MediaPipeFaceDetectorMediaPipeModelConfig extends
4848
MediaPipeFaceDetectorModelConfig {
4949
runtime: 'mediapipe';
5050
solutionPath?: string;
51+
locateFile?: (path: string, prefix?: string) => string;
5152
}
5253

5354
/**

face-detection/src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @license See the LICENSE file. */
22

33
// This code is auto-generated, do not modify this file!
4-
const version = '1.0.2';
4+
const version = '1.0.3-tw1';
55
export {version};

face-detection/yarn.lock

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -996,33 +996,33 @@
996996
resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553"
997997
integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==
998998

999-
"@tensorflow/tfjs-backend-cpu@4.21.0", "@tensorflow/tfjs-backend-cpu@^4.21.0":
1000-
version "4.21.0"
1001-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.21.0.tgz#27a489f838b88aa98220da0aaf29f58d16fc9d05"
1002-
integrity sha512-yS9Oisg4L48N7ML6677ilv1eP5Jt59S74skSU1cCsM4yBAtH4DAn9b89/JtqBISh6JadanfX26b4HCWQvMvqFg==
999+
"@tensorflow/tfjs-backend-cpu@4.22.0", "@tensorflow/tfjs-backend-cpu@^4.22.0":
1000+
version "4.22.0"
1001+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.22.0.tgz#72aeaab14f6f16bbd995c9e6751a8d094d5639a9"
1002+
integrity sha512-1u0FmuLGuRAi8D2c3cocHTASGXOmHc/4OvoVDENJayjYkS119fcTcQf4iHrtLthWyDIPy3JiPhRrZQC9EwnhLw==
10031003
dependencies:
10041004
"@types/seedrandom" "^2.4.28"
10051005
seedrandom "^3.0.5"
10061006

1007-
"@tensorflow/tfjs-backend-webgl@^4.21.0":
1008-
version "4.21.0"
1009-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.21.0.tgz#30fba5a0c583d1fdb8b2e94a73b3080f5f7e524d"
1010-
integrity sha512-7k6mb7dd0uF9jI51iunF3rhEXjvR/a613kjWZ0Rj3o1COFrneyku2C7cRMZERWPhbgXZ+dF+j9MdpGIpgtShIQ==
1007+
"@tensorflow/tfjs-backend-webgl@^4.22.0":
1008+
version "4.22.0"
1009+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.22.0.tgz#c6ffb8c5e737b1b1ef7fab8f721328b5b2e658c0"
1010+
integrity sha512-H535XtZWnWgNwSzv538czjVlbJebDl5QTMOth4RXr2p/kJ1qSIXE0vZvEtO+5EC9b00SvhplECny2yDewQb/Yg==
10111011
dependencies:
1012-
"@tensorflow/tfjs-backend-cpu" "4.21.0"
1012+
"@tensorflow/tfjs-backend-cpu" "4.22.0"
10131013
"@types/offscreencanvas" "~2019.3.0"
10141014
"@types/seedrandom" "^2.4.28"
10151015
seedrandom "^3.0.5"
10161016

1017-
"@tensorflow/tfjs-converter@^4.21.0":
1018-
version "4.21.0"
1019-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-4.21.0.tgz#a4d9f36025c9128a57476818eb8bf0c9e2011628"
1020-
integrity sha512-cUhU+F1lGx2qnKk/gRy8odBh0PZlFz0Dl71TG8LVnj0/g352DqiNrKXlKO/po9aWzP8x0KUGC3gNMSMJW+T0DA==
1017+
"@tensorflow/tfjs-converter@^4.22.0":
1018+
version "4.22.0"
1019+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-4.22.0.tgz#a5d727c1d97cf1fafda18b79be278e83b38a1ad3"
1020+
integrity sha512-PT43MGlnzIo+YfbsjM79Lxk9lOq6uUwZuCc8rrp0hfpLjF6Jv8jS84u2jFb+WpUeuF4K33ZDNx8CjiYrGQ2trQ==
10211021

1022-
"@tensorflow/tfjs-core@^4.21.0":
1023-
version "4.21.0"
1024-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-4.21.0.tgz#5f12bd67badf28d65b628bb7c4968dae716a8fba"
1025-
integrity sha512-ZbECwXps5wb9XXcGq4ZXvZDVjr5okc3I0+i/vU6bpQ+nVApyIrMiyEudP8f6vracVTvNmnlN62vUXoEsQb2F8g==
1022+
"@tensorflow/tfjs-core@^4.22.0":
1023+
version "4.22.0"
1024+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-4.22.0.tgz#fc4b45d2377410fa3a42c88ca77d8f23d83cffc3"
1025+
integrity sha512-LEkOyzbknKFoWUwfkr59vSB68DMJ4cjwwHgicXN0DUi3a0Vh1Er3JQqCI1Hl86GGZQvY8ezVrtDIvqR1ZFW55A==
10261026
dependencies:
10271027
"@types/long" "^4.0.1"
10281028
"@types/offscreencanvas" "~2019.7.0"

0 commit comments

Comments
 (0)