Skip to content

Commit a1f18f4

Browse files
authored
Change face-landmarks-detection to depend on face-detection package (#970)
* Change dependency of face-landmarks-detection to package instead of local code * Fix model names in link
1 parent ba8f84d commit a1f18f4

20 files changed

+1891
-1679
lines changed

face-detection/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This package provides models for running real-time face detection.
55
Currently, we provide 1 model option:
66

77
#### MediaPipe FaceDetection:
8-
[Demo](https://storage.googleapis.com/tfjs-models/demos/face-detection/index.html?model=mediapipe_face_detection)
8+
[Demo](https://storage.googleapis.com/tfjs-models/demos/face-detection/index.html?model=mediapipe_face_detector)
99

1010
MediaPipe FaceDetection can detect multiple faces, each face contains 6 keypoints.
1111

face-detection/src/tfjs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ In the runtime-backend dropdown, choose 'tfjs-webgl'.
1717
To use MediaPipeFaceDetector, you need to first select a runtime (TensorFlow.js or MediaPipe).
1818
This guide is for TensorFlow.js
1919
runtime. The guide for MediaPipe runtime can be found
20-
[here](https://github.com/tensorflow/tfjs-models/tree/master/face-detection/src/mediapipe_face_detector).
20+
[here](https://github.com/tensorflow/tfjs-models/tree/master/face-detection/src/mediapipe).
2121

2222
Via script tags:
2323

face-landmarks-detection/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This package provides models for running real-time face detection and landmark t
55
Currently, we provide 1 model option:
66

77
#### MediaPipe:
8-
[Demo](https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html?model=mediapipe_facemesh)
8+
[Demo](https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html?model=mediapipe_face_mesh)
99

1010
MediaPipe Facemesh can detect multiple faces, each face contains 468 keypoints.
1111

face-landmarks-detection/karma.conf.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* =============================================================================
1616
*/
1717

18-
const karmaTypescriptConfig = {
18+
const karmaTypescriptConfig = {
1919
tsconfig: 'tsconfig.test.json',
2020
// Disable coverage reports and instrumentation by default for tests
2121
coverageOptions: {instrumentation: false},
@@ -103,8 +103,8 @@ module.exports = function(config) {
103103
username: process.env.BROWSERSTACK_USERNAME,
104104
accessKey: process.env.BROWSERSTACK_KEY,
105105
timeout: 1800,
106-
tunnelIdentifier:
107-
`face_detection_${Date.now()}_${Math.floor(Math.random() * 1000)}`
106+
tunnelIdentifier: `face_landmarks_detection_${Date.now()}_${
107+
Math.floor(Math.random() * 1000)}`
108108
},
109109
captureTimeout: 3e5,
110110
reportSlowerThan: 500,

face-landmarks-detection/package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@
1616
"@mediapipe/face_mesh": "~0.4.0",
1717
"@tensorflow/tfjs-backend-webgl": "^3.12.0",
1818
"@tensorflow/tfjs-converter": "^3.12.0",
19-
"@tensorflow/tfjs-core": "^3.12.0"
19+
"@tensorflow/tfjs-core": "^3.12.0",
20+
"@tensorflow-models/face-detection": "~1.0.0"
2021
},
2122
"devDependencies": {
2223
"@babel/polyfill": "^7.10.4",
24+
"@mediapipe/face_detection": "^0.4.0",
2325
"@mediapipe/face_mesh": "^0.4.0",
24-
"@rollup/plugin-commonjs": "^11.0.2",
26+
"@rollup/plugin-commonjs": "^21.0.2",
2527
"@rollup/plugin-node-resolve": "^7.1.1",
2628
"@rollup/plugin-typescript": "^3.0.0",
2729
"@tensorflow/tfjs-backend-cpu": "^3.12.0",
2830
"@tensorflow/tfjs-backend-webgl": "^3.12.0",
2931
"@tensorflow/tfjs-converter": "^3.12.0",
3032
"@tensorflow/tfjs-core": "^3.12.0",
33+
"@tensorflow-models/face-detection": "^1.0.0",
3134
"@types/jasmine": "~2.8.8",
3235
"babel-core": "~6.26.0",
3336
"babel-plugin-transform-runtime": "~6.23.0",
@@ -40,7 +43,7 @@
4043
"karma-spec-reporter": "~0.0.32",
4144
"karma-typescript": "~5.5.1",
4245
"karma-typescript-es6-transform": "^5.1.0",
43-
"rollup": "~2.3.2",
46+
"rollup": "~2.70.1",
4447
"rollup-plugin-terser": "~7.0.2",
4548
"rollup-plugin-visualizer": "~3.3.2",
4649
"ts-node": "~8.8.2",

face-landmarks-detection/rollup.config.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* =============================================================================
1616
*/
1717

18+
import commonjs from '@rollup/plugin-commonjs';
1819
import resolve from '@rollup/plugin-node-resolve';
1920
import typescript from '@rollup/plugin-typescript';
2021
import {terser} from 'rollup-plugin-terser';
@@ -45,20 +46,25 @@ function config({plugins = [], output = {}, tsCompilerOptions = {}}) {
4546

4647
return {
4748
input: 'src/index.ts',
48-
plugins: [typescript(tsoptions), resolve(), ...plugins],
49+
plugins: [
50+
typescript(tsoptions), resolve(),
51+
commonjs({include: ['node_modules/@mediapipe/face_detection/**']}),
52+
...plugins
53+
],
4954
output: {
5055
banner: PREAMBLE,
5156
globals: {
5257
'@tensorflow/tfjs-core': 'tf',
5358
'@tensorflow/tfjs-converter': 'tf',
59+
'@tensorflow-models/face-detection': 'faceDetection',
5460
// Package is obfuscated so class is directly attached to globalThis.
5561
'@mediapipe/face_mesh': 'globalThis'
5662
},
5763
...output,
5864
},
5965
external: [
6066
'@tensorflow/tfjs-core', '@tensorflow/tfjs-converter',
61-
'@mediapipe/face_mesh'
67+
'tensorflow-models/face-detection', '@mediapipe/face_mesh'
6268
]
6369
};
6470
}

0 commit comments

Comments
 (0)