├── README.md ├── dist ├── face-api.js ├── face-api.js.map └── face-api.min.js ├── docs ├── assets │ ├── css │ │ ├── main.css │ │ └── main.css.map │ ├── images │ │ ├── icons.png │ │ ├── icons@2x.png │ │ ├── widgets.png │ │ └── widgets@2x.png │ └── js │ │ ├── main.js │ │ └── search.js ├── classes │ ├── boundingbox.html │ ├── box.html │ ├── boxwithtext.html │ ├── composabletask.html │ ├── computeallfacedescriptorstask.html │ ├── computefacedescriptorstaskbase.html │ ├── computesinglefacedescriptortask.html │ ├── detectallfacelandmarkstask.html │ ├── detectallfacestask.html │ ├── detectfacelandmarkstaskbase.html │ ├── detectfacestaskbase.html │ ├── detectsinglefacelandmarkstask.html │ ├── detectsinglefacetask.html │ ├── dimensions.html │ ├── facedetection.html │ ├── facedetectionnet.html │ ├── facedetectionwithlandmarks.html │ ├── facelandmark68net.html │ ├── facelandmark68tinynet.html │ ├── facelandmarknet.html │ ├── facelandmarks.html │ ├── facelandmarks5.html │ ├── facelandmarks68.html │ ├── facematch.html │ ├── facematcher.html │ ├── facerecognitionnet.html │ ├── fullfacedescription.html │ ├── labeledbox.html │ ├── labeledfacedescriptors.html │ ├── mtcnn.html │ ├── mtcnnoptions.html │ ├── netinput.html │ ├── neuralnetwork.html │ ├── objectdetection.html │ ├── point.html │ ├── predictedbox.html │ ├── rect.html │ ├── ssdmobilenetv1.html │ ├── ssdmobilenetv1options.html │ ├── tinyfacedetector.html │ ├── tinyfacedetectoroptions.html │ ├── tinyyolov2.html │ └── tinyyolov2options.html ├── enums │ └── tinyyolov2sizetype.html ├── globals.html └── interfaces │ ├── iboundingbox.html │ ├── idimensions.html │ ├── ifacedetecion.html │ ├── ifacedetectionwithlandmarks.html │ ├── ifacelandmarks.html │ ├── ifacematch.html │ ├── ifullfacedescription.html │ ├── imtcnnoptions.html │ ├── ipoint.html │ ├── irect.html │ ├── issdmobilenetv1options.html │ ├── itinyfacedetectoroptions.html │ └── itinyyolov2options.html ├── models ├── face_landmark_68_model-shard1 ├── face_landmark_68_model-weights_manifest.json ├── face_landmark_68_tiny_model-shard1 ├── face_landmark_68_tiny_model-weights_manifest.json ├── face_recognition_model-shard1 ├── face_recognition_model-shard2 ├── face_recognition_model-weights_manifest.json ├── mtcnn_model-shard1 ├── mtcnn_model-weights_manifest.json ├── ssd_mobilenetv1_model-shard1 ├── ssd_mobilenetv1_model-shard2 ├── ssd_mobilenetv1_model-weights_manifest.json ├── tiny_face_detector_model-shard1 └── tiny_face_detector_model-weights_manifest.json ├── package-lock.json ├── package.json ├── public ├── github_link_icon.png ├── images │ ├── amy │ │ ├── amy1.png │ │ ├── amy2.png │ │ ├── amy3.png │ │ ├── amy4.png │ │ └── amy5.png │ ├── bbt1.jpg │ ├── bbt2.jpg │ ├── bbt3.jpg │ ├── bbt4.jpg │ ├── bbt5.jpg │ ├── bernadette │ │ ├── bernadette1.png │ │ ├── bernadette2.png │ │ ├── bernadette3.png │ │ ├── bernadette4.png │ │ └── bernadette5.png │ ├── howard │ │ ├── howard1.png │ │ ├── howard2.png │ │ ├── howard3.png │ │ ├── howard4.png │ │ └── howard5.png │ ├── leonard │ │ ├── leonard1.png │ │ ├── leonard2.png │ │ ├── leonard3.png │ │ ├── leonard4.png │ │ └── leonard5.png │ ├── penny │ │ ├── penny1.png │ │ ├── penny2.png │ │ ├── penny3.png │ │ ├── penny4.png │ │ └── penny5.png │ ├── raj │ │ ├── raj1.png │ │ ├── raj2.png │ │ ├── raj3.png │ │ ├── raj4.png │ │ └── raj5.png │ ├── sheldon │ │ ├── sheldon1.png │ │ ├── sheldon2.png │ │ ├── sheldon3.png │ │ ├── sheldon4.png │ │ └── sheldon5.png │ ├── stuart │ │ ├── stuart1.png │ │ ├── stuart2.png │ │ ├── stuart3.png │ │ ├── stuart4.png │ │ └── stuart5.png │ ├── 安悦溪1.jpg │ ├── 安悦溪2.jpg │ ├── 张杰1.jpg │ ├── 张杰2.jpg │ ├── 张杰3.jpg │ └── 张杰4.jpg ├── js │ ├── bbt.js │ ├── commons.js │ ├── drawing.js │ ├── faceDetectionControls.js │ ├── imageSelectionControls.js │ ├── jquery-2.1.1.min.js │ └── materialize.min.js ├── materialize.css ├── media │ └── bbt.mp4 ├── menu_icon.png └── styles.css ├── server.js └── views ├── batchFaceLandmarks.html ├── batchFaceRecognition.html ├── bbtFaceLandmarkDetection.html ├── bbtFaceMatching.html ├── bbtFaceRecognition.html ├── bbtFaceSimilarity.html ├── faceAndLandmarkDetection.html ├── faceExtraction.html ├── faceRecognition.html ├── simplifyFaceComparison.html ├── simplifyFaceComparisonMany.html ├── simplifyWebRTCFaceTracking.html ├── videoFaceTracking.html └── webcamFaceTracking.html /README.md: -------------------------------------------------------------------------------- 1 | # Face-api 使用案例 face-api-demo-browser 2 | 3 | ## 项目安装 Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### 项目启动 Compiles and hot-reloads for development 9 | ``` 10 | node server.js 11 | ``` 12 | -------------------------------------------------------------------------------- /docs/assets/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/docs/assets/images/icons.png -------------------------------------------------------------------------------- /docs/assets/images/icons@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/docs/assets/images/icons@2x.png -------------------------------------------------------------------------------- /docs/assets/images/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/docs/assets/images/widgets.png -------------------------------------------------------------------------------- /docs/assets/images/widgets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/docs/assets/images/widgets@2x.png -------------------------------------------------------------------------------- /docs/interfaces/idimensions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IDimensions | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface IDimensions

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Hierarchy

67 |
    68 |
  • 69 | IDimensions 70 |
  • 71 |
72 |
73 |
74 |

Implemented by

75 | 78 |
79 |
80 |

Index

81 |
82 |
83 |
84 |

Properties

85 | 89 |
90 |
91 |
92 |
93 |
94 |

Properties

95 |
96 | 97 |

height

98 |
height: number
99 | 104 |
105 |
106 | 107 |

width

108 |
width: number
109 | 114 |
115 |
116 |
117 | 145 |
146 |
147 | 206 |
207 |

Generated using TypeDoc

208 |
209 |
210 | 211 | 212 | 213 | -------------------------------------------------------------------------------- /docs/interfaces/ifacedetecion.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IFaceDetecion | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface IFaceDetecion

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Hierarchy

67 |
    68 |
  • 69 | IFaceDetecion 70 |
  • 71 |
72 |
73 |
74 |

Implemented by

75 | 78 |
79 |
80 |

Index

81 |
82 |
83 |
84 |

Properties

85 | 89 |
90 |
91 |
92 |
93 |
94 |

Properties

95 |
96 | 97 |

box

98 |
box: Box
99 | 104 |
105 |
106 | 107 |

score

108 |
score: number
109 | 114 |
115 |
116 |
117 | 145 |
146 |
147 | 206 |
207 |

Generated using TypeDoc

208 |
209 |
210 | 211 | 212 | 213 | -------------------------------------------------------------------------------- /docs/interfaces/ifacedetectionwithlandmarks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IFaceDetectionWithLandmarks | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface IFaceDetectionWithLandmarks<TFaceLandmarks>

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Type parameters

67 | 72 |
73 |
74 |

Hierarchy

75 | 85 |
86 |
87 |

Implemented by

88 | 92 |
93 |
94 |

Index

95 |
96 |
97 |
98 |

Properties

99 | 103 |
104 |
105 |
106 |
107 |
108 |

Properties

109 |
110 | 111 |

detection

112 |
detection: FaceDetection
113 | 118 |
119 |
120 | 121 |

landmarks

122 |
landmarks: TFaceLandmarks
123 | 128 |
129 |
130 |
131 | 159 |
160 |
161 | 220 |
221 |

Generated using TypeDoc

222 |
223 |
224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /docs/interfaces/ifacelandmarks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IFaceLandmarks | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface IFaceLandmarks

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Hierarchy

67 |
    68 |
  • 69 | IFaceLandmarks 70 |
  • 71 |
72 |
73 |
74 |

Implemented by

75 | 80 |
81 |
82 |

Index

83 |
84 |
85 |
86 |

Properties

87 | 91 |
92 |
93 |
94 |
95 |
96 |

Properties

97 |
98 | 99 |

positions

100 |
positions: Point[]
101 | 106 |
107 |
108 | 109 |

shift

110 |
shift: Point
111 | 116 |
117 |
118 |
119 | 147 |
148 |
149 | 208 |
209 |

Generated using TypeDoc

210 |
211 |
212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /docs/interfaces/ifacematch.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IFaceMatch | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface IFaceMatch

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Hierarchy

67 |
    68 |
  • 69 | IFaceMatch 70 |
  • 71 |
72 |
73 |
74 |

Implemented by

75 | 78 |
79 |
80 |

Index

81 |
82 |
83 |
84 |

Properties

85 | 89 |
90 |
91 |
92 |
93 |
94 |

Properties

95 |
96 | 97 |

distance

98 |
distance: number
99 | 104 |
105 |
106 | 107 |

label

108 |
label: string
109 | 114 |
115 |
116 |
117 | 145 |
146 |
147 | 206 |
207 |

Generated using TypeDoc

208 |
209 |
210 | 211 | 212 | 213 | -------------------------------------------------------------------------------- /docs/interfaces/ipoint.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | IPoint | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface IPoint

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Hierarchy

67 |
    68 |
  • 69 | IPoint 70 |
  • 71 |
72 |
73 |
74 |

Implemented by

75 | 78 |
79 |
80 |

Index

81 |
82 |
83 |
84 |

Properties

85 |
    86 |
  • x
  • 87 |
  • y
  • 88 |
89 |
90 |
91 |
92 |
93 |
94 |

Properties

95 |
96 | 97 |

x

98 |
x: number
99 | 104 |
105 |
106 | 107 |

y

108 |
y: number
109 | 114 |
115 |
116 |
117 | 145 |
146 |
147 | 206 |
207 |

Generated using TypeDoc

208 |
209 |
210 | 211 | 212 | 213 | -------------------------------------------------------------------------------- /docs/interfaces/issdmobilenetv1options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ISsdMobilenetv1Options | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface ISsdMobilenetv1Options

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Hierarchy

67 |
    68 |
  • 69 | ISsdMobilenetv1Options 70 |
  • 71 |
72 |
73 |
74 |

Index

75 |
76 |
77 |
78 |

Properties

79 | 83 |
84 |
85 |
86 |
87 |
88 |

Properties

89 |
90 | 91 |

Optional maxResults

92 |
maxResults: undefined | number
93 | 98 |
99 |
100 | 101 |

Optional minConfidence

102 |
minConfidence: undefined | number
103 | 108 |
109 |
110 |
111 | 139 |
140 |
141 | 200 |
201 |

Generated using TypeDoc

202 |
203 |
204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /docs/interfaces/itinyfacedetectoroptions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ITinyFaceDetectorOptions | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface ITinyFaceDetectorOptions

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Hierarchy

67 |
    68 |
  • 69 | ITinyYolov2Options 70 |
      71 |
    • 72 | ITinyFaceDetectorOptions 73 |
    • 74 |
    75 |
  • 76 |
77 |
78 |
79 |

Index

80 |
81 |
82 |
83 |

Properties

84 | 88 |
89 |
90 |
91 |
92 |
93 |

Properties

94 |
95 | 96 |

Optional inputSize

97 |
inputSize: undefined | number
98 | 104 |
105 |
106 | 107 |

Optional scoreThreshold

108 |
scoreThreshold: undefined | number
109 | 115 |
116 |
117 |
118 | 146 |
147 |
148 | 207 |
208 |

Generated using TypeDoc

209 |
210 |
211 | 212 | 213 | 214 | -------------------------------------------------------------------------------- /docs/interfaces/itinyyolov2options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ITinyYolov2Options | face-api.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 |
42 |
43 | Menu 44 |
45 |
46 |
47 |
48 |
49 |
50 | 58 |

Interface ITinyYolov2Options

59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |

Hierarchy

67 |
    68 |
  • 69 | ITinyYolov2Options 70 |
  • 71 |
72 |
73 |
74 |

Index

75 |
76 |
77 |
78 |

Properties

79 | 83 |
84 |
85 |
86 |
87 |
88 |

Properties

89 |
90 | 91 |

Optional inputSize

92 |
inputSize: undefined | number
93 | 98 |
99 |
100 | 101 |

Optional scoreThreshold

102 |
scoreThreshold: undefined | number
103 | 108 |
109 |
110 |
111 | 139 |
140 |
141 | 200 |
201 |

Generated using TypeDoc

202 |
203 |
204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /models/face_landmark_68_model-shard1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/models/face_landmark_68_model-shard1 -------------------------------------------------------------------------------- /models/face_landmark_68_model-weights_manifest.json: -------------------------------------------------------------------------------- 1 | [{"weights":[{"name":"dense0/conv0/filters","shape":[3,3,3,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004853619781194949,"min":-0.5872879935245888}},{"name":"dense0/conv0/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004396426443960153,"min":-0.7298067896973853}},{"name":"dense0/conv1/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.00635151559231328,"min":-0.5589333721235686}},{"name":"dense0/conv1/pointwise_filter","shape":[1,1,32,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.009354315552057004,"min":-1.2628325995276957}},{"name":"dense0/conv1/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0029380727048013726,"min":-0.5846764682554731}},{"name":"dense0/conv2/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0049374802439820535,"min":-0.6171850304977566}},{"name":"dense0/conv2/pointwise_filter","shape":[1,1,32,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.009941946758943446,"min":-1.3421628124573652}},{"name":"dense0/conv2/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0030300481062309416,"min":-0.5272283704841838}},{"name":"dense0/conv3/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005672684837790097,"min":-0.7431217137505026}},{"name":"dense0/conv3/pointwise_filter","shape":[1,1,32,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.010712201455060173,"min":-1.5639814124387852}},{"name":"dense0/conv3/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0030966934035806097,"min":-0.3839899820439956}},{"name":"dense1/conv0/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0039155554537679636,"min":-0.48161332081345953}},{"name":"dense1/conv0/pointwise_filter","shape":[1,1,32,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.01023082966898002,"min":-1.094698774580862}},{"name":"dense1/conv0/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0027264176630506327,"min":-0.3871513081531898}},{"name":"dense1/conv1/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004583378632863362,"min":-0.5454220573107401}},{"name":"dense1/conv1/pointwise_filter","shape":[1,1,64,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.00915846403907327,"min":-1.117332612766939}},{"name":"dense1/conv1/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003091680419211294,"min":-0.5966943209077797}},{"name":"dense1/conv2/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005407439727409214,"min":-0.708374604290607}},{"name":"dense1/conv2/pointwise_filter","shape":[1,1,64,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.00946493943532308,"min":-1.2399070660273235}},{"name":"dense1/conv2/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004409168514550901,"min":-0.9788354102303}},{"name":"dense1/conv3/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004478132958505668,"min":-0.6493292789833219}},{"name":"dense1/conv3/pointwise_filter","shape":[1,1,64,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.011063695888893277,"min":-1.2501976354449402}},{"name":"dense1/conv3/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003909627596537272,"min":-0.6646366914113363}},{"name":"dense2/conv0/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003213915404151468,"min":-0.3374611174359041}},{"name":"dense2/conv0/pointwise_filter","shape":[1,1,64,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.010917326048308728,"min":-1.4520043644250609}},{"name":"dense2/conv0/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002800439152063108,"min":-0.38085972468058266}},{"name":"dense2/conv1/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0050568851770139206,"min":-0.6927932692509071}},{"name":"dense2/conv1/pointwise_filter","shape":[1,1,128,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.01074961213504567,"min":-1.3222022926106174}},{"name":"dense2/conv1/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0030654204242369708,"min":-0.5487102559384177}},{"name":"dense2/conv2/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.00591809165244009,"min":-0.917304206128214}},{"name":"dense2/conv2/pointwise_filter","shape":[1,1,128,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.01092823346455892,"min":-1.366029183069865}},{"name":"dense2/conv2/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002681120470458386,"min":-0.36463238398234055}},{"name":"dense2/conv3/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0048311497650894465,"min":-0.5797379718107336}},{"name":"dense2/conv3/pointwise_filter","shape":[1,1,128,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.011227761062921263,"min":-1.4483811771168429}},{"name":"dense2/conv3/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0034643323982463162,"min":-0.3360402426298927}},{"name":"dense3/conv0/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003394978887894574,"min":-0.49227193874471326}},{"name":"dense3/conv0/pointwise_filter","shape":[1,1,128,256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.010051267287310432,"min":-1.2765109454884247}},{"name":"dense3/conv0/bias","shape":[256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003142924752889895,"min":-0.4588670139219247}},{"name":"dense3/conv1/depthwise_filter","shape":[3,3,256,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.00448304671867221,"min":-0.5872791201460595}},{"name":"dense3/conv1/pointwise_filter","shape":[1,1,256,256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.016063522357566685,"min":-2.3613377865623026}},{"name":"dense3/conv1/bias","shape":[256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.00287135781026354,"min":-0.47664539650374765}},{"name":"dense3/conv2/depthwise_filter","shape":[3,3,256,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006002906724518421,"min":-0.7923836876364315}},{"name":"dense3/conv2/pointwise_filter","shape":[1,1,256,256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.017087187019048954,"min":-1.6061955797906016}},{"name":"dense3/conv2/bias","shape":[256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003124481205846749,"min":-0.46242321846531886}},{"name":"dense3/conv3/depthwise_filter","shape":[3,3,256,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006576311588287353,"min":-1.0193282961845398}},{"name":"dense3/conv3/pointwise_filter","shape":[1,1,256,256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.015590153955945782,"min":-1.99553970636106}},{"name":"dense3/conv3/bias","shape":[256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004453541601405424,"min":-0.6546706154065973}},{"name":"fc/weights","shape":[256,136],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.010417488509533453,"min":-1.500118345372817}},{"name":"fc/bias","shape":[136],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0025084222648658005,"min":0.07683877646923065}}],"paths":["face_landmark_68_model-shard1"]}] -------------------------------------------------------------------------------- /models/face_landmark_68_tiny_model-shard1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/models/face_landmark_68_tiny_model-shard1 -------------------------------------------------------------------------------- /models/face_landmark_68_tiny_model-weights_manifest.json: -------------------------------------------------------------------------------- 1 | [{"weights":[{"name":"dense0/conv0/filters","shape":[3,3,3,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008194216092427571,"min":-0.9423348506291708}},{"name":"dense0/conv0/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006839508168837603,"min":-0.8412595047670252}},{"name":"dense0/conv1/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.009194007106855804,"min":-1.2779669878529567}},{"name":"dense0/conv1/pointwise_filter","shape":[1,1,32,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0036026100317637128,"min":-0.3170296827952067}},{"name":"dense0/conv1/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.000740380117706224,"min":-0.06367269012273527}},{"name":"dense0/conv2/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":1,"min":0}},{"name":"dense0/conv2/pointwise_filter","shape":[1,1,32,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":1,"min":0}},{"name":"dense0/conv2/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0037702228508743585,"min":-0.6220867703942692}},{"name":"dense1/conv0/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0033707996209462483,"min":-0.421349952618281}},{"name":"dense1/conv0/pointwise_filter","shape":[1,1,32,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.014611541991140328,"min":-1.8556658328748217}},{"name":"dense1/conv0/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002832523046755323,"min":-0.30307996600281956}},{"name":"dense1/conv1/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006593170586754294,"min":-0.6329443763284123}},{"name":"dense1/conv1/pointwise_filter","shape":[1,1,64,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.012215249211180444,"min":-1.6001976466646382}},{"name":"dense1/conv1/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002384825547536214,"min":-0.3028728445370992}},{"name":"dense1/conv2/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005859645441466687,"min":-0.7617539073906693}},{"name":"dense1/conv2/pointwise_filter","shape":[1,1,64,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.013121426806730382,"min":-1.7845140457153321}},{"name":"dense1/conv2/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0032247188044529336,"min":-0.46435950784122243}},{"name":"dense2/conv0/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002659512618008782,"min":-0.32977956463308894}},{"name":"dense2/conv0/pointwise_filter","shape":[1,1,64,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.015499923743453681,"min":-1.9839902391620712}},{"name":"dense2/conv0/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0032450980999890497,"min":-0.522460794098237}},{"name":"dense2/conv1/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005911862382701799,"min":-0.792189559282041}},{"name":"dense2/conv1/pointwise_filter","shape":[1,1,128,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.021025861478319356,"min":-2.2077154552235325}},{"name":"dense2/conv1/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.00349616945958605,"min":-0.46149436866535865}},{"name":"dense2/conv2/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008104994250278847,"min":-1.013124281284856}},{"name":"dense2/conv2/pointwise_filter","shape":[1,1,128,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.029337059282789044,"min":-3.5791212325002633}},{"name":"dense2/conv2/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0038808938334969913,"min":-0.4230174278511721}},{"name":"fc/weights","shape":[128,136],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.014016061670639936,"min":-1.8921683255363912}},{"name":"fc/bias","shape":[136],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0029505149698724935,"min":0.088760145008564}}],"paths":["face_landmark_68_tiny_model-shard1"]}] -------------------------------------------------------------------------------- /models/face_recognition_model-shard1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/models/face_recognition_model-shard1 -------------------------------------------------------------------------------- /models/face_recognition_model-shard2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/models/face_recognition_model-shard2 -------------------------------------------------------------------------------- /models/mtcnn_model-shard1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/models/mtcnn_model-shard1 -------------------------------------------------------------------------------- /models/mtcnn_model-weights_manifest.json: -------------------------------------------------------------------------------- 1 | [{"paths":["mtcnn_model-shard1"],"weights":[{"dtype":"float32","name":"pnet/conv1/weights","shape":[3,3,3,10]},{"dtype":"float32","name":"pnet/conv1/bias","shape":[10]},{"dtype":"float32","name":"pnet/prelu1_alpha","shape":[10]},{"dtype":"float32","name":"pnet/conv2/weights","shape":[3,3,10,16]},{"dtype":"float32","name":"pnet/conv2/bias","shape":[16]},{"dtype":"float32","name":"pnet/prelu2_alpha","shape":[16]},{"dtype":"float32","name":"pnet/conv3/weights","shape":[3,3,16,32]},{"dtype":"float32","name":"pnet/conv3/bias","shape":[32]},{"dtype":"float32","name":"pnet/prelu3_alpha","shape":[32]},{"dtype":"float32","name":"pnet/conv4_1/weights","shape":[1,1,32,2]},{"dtype":"float32","name":"pnet/conv4_1/bias","shape":[2]},{"dtype":"float32","name":"pnet/conv4_2/weights","shape":[1,1,32,4]},{"dtype":"float32","name":"pnet/conv4_2/bias","shape":[4]},{"dtype":"float32","name":"rnet/conv1/weights","shape":[3,3,3,28]},{"dtype":"float32","name":"rnet/conv1/bias","shape":[28]},{"dtype":"float32","name":"rnet/prelu1_alpha","shape":[28]},{"dtype":"float32","name":"rnet/conv2/weights","shape":[3,3,28,48]},{"dtype":"float32","name":"rnet/conv2/bias","shape":[48]},{"dtype":"float32","name":"rnet/prelu2_alpha","shape":[48]},{"dtype":"float32","name":"rnet/conv3/weights","shape":[2,2,48,64]},{"dtype":"float32","name":"rnet/conv3/bias","shape":[64]},{"dtype":"float32","name":"rnet/prelu3_alpha","shape":[64]},{"dtype":"float32","name":"rnet/fc1/weights","shape":[576,128]},{"dtype":"float32","name":"rnet/fc1/bias","shape":[128]},{"dtype":"float32","name":"rnet/prelu4_alpha","shape":[128]},{"dtype":"float32","name":"rnet/fc2_1/weights","shape":[128,2]},{"dtype":"float32","name":"rnet/fc2_1/bias","shape":[2]},{"dtype":"float32","name":"rnet/fc2_2/weights","shape":[128,4]},{"dtype":"float32","name":"rnet/fc2_2/bias","shape":[4]},{"dtype":"float32","name":"onet/conv1/weights","shape":[3,3,3,32]},{"dtype":"float32","name":"onet/conv1/bias","shape":[32]},{"dtype":"float32","name":"onet/prelu1_alpha","shape":[32]},{"dtype":"float32","name":"onet/conv2/weights","shape":[3,3,32,64]},{"dtype":"float32","name":"onet/conv2/bias","shape":[64]},{"dtype":"float32","name":"onet/prelu2_alpha","shape":[64]},{"dtype":"float32","name":"onet/conv3/weights","shape":[3,3,64,64]},{"dtype":"float32","name":"onet/conv3/bias","shape":[64]},{"dtype":"float32","name":"onet/prelu3_alpha","shape":[64]},{"dtype":"float32","name":"onet/conv4/weights","shape":[2,2,64,128]},{"dtype":"float32","name":"onet/conv4/bias","shape":[128]},{"dtype":"float32","name":"onet/prelu4_alpha","shape":[128]},{"dtype":"float32","name":"onet/fc1/weights","shape":[1152,256]},{"dtype":"float32","name":"onet/fc1/bias","shape":[256]},{"dtype":"float32","name":"onet/prelu5_alpha","shape":[256]},{"dtype":"float32","name":"onet/fc2_1/weights","shape":[256,2]},{"dtype":"float32","name":"onet/fc2_1/bias","shape":[2]},{"dtype":"float32","name":"onet/fc2_2/weights","shape":[256,4]},{"dtype":"float32","name":"onet/fc2_2/bias","shape":[4]},{"dtype":"float32","name":"onet/fc2_3/weights","shape":[256,10]},{"dtype":"float32","name":"onet/fc2_3/bias","shape":[10]}]}] -------------------------------------------------------------------------------- /models/ssd_mobilenetv1_model-shard1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/models/ssd_mobilenetv1_model-shard1 -------------------------------------------------------------------------------- /models/ssd_mobilenetv1_model-shard2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/models/ssd_mobilenetv1_model-shard2 -------------------------------------------------------------------------------- /models/tiny_face_detector_model-shard1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/models/tiny_face_detector_model-shard1 -------------------------------------------------------------------------------- /models/tiny_face_detector_model-weights_manifest.json: -------------------------------------------------------------------------------- 1 | [{"weights":[{"name":"conv0/filters","shape":[3,3,3,16],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.009007044399485869,"min":-1.2069439495311063}},{"name":"conv0/bias","shape":[16],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005263455241334205,"min":-0.9211046672334858}},{"name":"conv1/depthwise_filter","shape":[3,3,16,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004001977630690033,"min":-0.5042491814669441}},{"name":"conv1/pointwise_filter","shape":[1,1,16,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.013836609615999109,"min":-1.411334180831909}},{"name":"conv1/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0015159862590771096,"min":-0.30926119685173037}},{"name":"conv2/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002666276225856706,"min":-0.317286870876948}},{"name":"conv2/pointwise_filter","shape":[1,1,32,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.015265831292844286,"min":-1.6792414422128714}},{"name":"conv2/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0020280554598453,"min":-0.37113414915168985}},{"name":"conv3/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006100742489683862,"min":-0.8907084034938438}},{"name":"conv3/pointwise_filter","shape":[1,1,64,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.016276211832083907,"min":-2.0508026908425725}},{"name":"conv3/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003394414279975143,"min":-0.7637432129944072}},{"name":"conv4/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006716050119961009,"min":-0.8059260143953211}},{"name":"conv4/pointwise_filter","shape":[1,1,128,256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.021875603993733724,"min":-2.8875797271728514}},{"name":"conv4/bias","shape":[256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0041141652009066415,"min":-0.8187188749804216}},{"name":"conv5/depthwise_filter","shape":[3,3,256,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008423839597141042,"min":-0.9013508368940915}},{"name":"conv5/pointwise_filter","shape":[1,1,256,512],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.030007277283014035,"min":-3.8709387695088107}},{"name":"conv5/bias","shape":[512],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008402082966823203,"min":-1.4871686851277068}},{"name":"conv8/filters","shape":[1,1,512,25],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.028336129469030042,"min":-4.675461362389957}},{"name":"conv8/bias","shape":[25],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002268134028303857,"min":-0.41053225912299807}}],"paths":["tiny_face_detector_model-shard1"]}] -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "start": "node server.js" 4 | }, 5 | "author": "justadudewhohacks", 6 | "license": "MIT", 7 | "dependencies": { 8 | "express": "^4.16.3", 9 | "request": "^2.87.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /public/github_link_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/github_link_icon.png -------------------------------------------------------------------------------- /public/images/amy/amy1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/amy/amy1.png -------------------------------------------------------------------------------- /public/images/amy/amy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/amy/amy2.png -------------------------------------------------------------------------------- /public/images/amy/amy3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/amy/amy3.png -------------------------------------------------------------------------------- /public/images/amy/amy4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/amy/amy4.png -------------------------------------------------------------------------------- /public/images/amy/amy5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/amy/amy5.png -------------------------------------------------------------------------------- /public/images/bbt1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bbt1.jpg -------------------------------------------------------------------------------- /public/images/bbt2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bbt2.jpg -------------------------------------------------------------------------------- /public/images/bbt3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bbt3.jpg -------------------------------------------------------------------------------- /public/images/bbt4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bbt4.jpg -------------------------------------------------------------------------------- /public/images/bbt5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bbt5.jpg -------------------------------------------------------------------------------- /public/images/bernadette/bernadette1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bernadette/bernadette1.png -------------------------------------------------------------------------------- /public/images/bernadette/bernadette2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bernadette/bernadette2.png -------------------------------------------------------------------------------- /public/images/bernadette/bernadette3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bernadette/bernadette3.png -------------------------------------------------------------------------------- /public/images/bernadette/bernadette4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bernadette/bernadette4.png -------------------------------------------------------------------------------- /public/images/bernadette/bernadette5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/bernadette/bernadette5.png -------------------------------------------------------------------------------- /public/images/howard/howard1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/howard/howard1.png -------------------------------------------------------------------------------- /public/images/howard/howard2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/howard/howard2.png -------------------------------------------------------------------------------- /public/images/howard/howard3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/howard/howard3.png -------------------------------------------------------------------------------- /public/images/howard/howard4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/howard/howard4.png -------------------------------------------------------------------------------- /public/images/howard/howard5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/howard/howard5.png -------------------------------------------------------------------------------- /public/images/leonard/leonard1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/leonard/leonard1.png -------------------------------------------------------------------------------- /public/images/leonard/leonard2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/leonard/leonard2.png -------------------------------------------------------------------------------- /public/images/leonard/leonard3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/leonard/leonard3.png -------------------------------------------------------------------------------- /public/images/leonard/leonard4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/leonard/leonard4.png -------------------------------------------------------------------------------- /public/images/leonard/leonard5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/leonard/leonard5.png -------------------------------------------------------------------------------- /public/images/penny/penny1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/penny/penny1.png -------------------------------------------------------------------------------- /public/images/penny/penny2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/penny/penny2.png -------------------------------------------------------------------------------- /public/images/penny/penny3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/penny/penny3.png -------------------------------------------------------------------------------- /public/images/penny/penny4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/penny/penny4.png -------------------------------------------------------------------------------- /public/images/penny/penny5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/penny/penny5.png -------------------------------------------------------------------------------- /public/images/raj/raj1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/raj/raj1.png -------------------------------------------------------------------------------- /public/images/raj/raj2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/raj/raj2.png -------------------------------------------------------------------------------- /public/images/raj/raj3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/raj/raj3.png -------------------------------------------------------------------------------- /public/images/raj/raj4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/raj/raj4.png -------------------------------------------------------------------------------- /public/images/raj/raj5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/raj/raj5.png -------------------------------------------------------------------------------- /public/images/sheldon/sheldon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/sheldon/sheldon1.png -------------------------------------------------------------------------------- /public/images/sheldon/sheldon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/sheldon/sheldon2.png -------------------------------------------------------------------------------- /public/images/sheldon/sheldon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/sheldon/sheldon3.png -------------------------------------------------------------------------------- /public/images/sheldon/sheldon4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/sheldon/sheldon4.png -------------------------------------------------------------------------------- /public/images/sheldon/sheldon5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/sheldon/sheldon5.png -------------------------------------------------------------------------------- /public/images/stuart/stuart1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/stuart/stuart1.png -------------------------------------------------------------------------------- /public/images/stuart/stuart2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/stuart/stuart2.png -------------------------------------------------------------------------------- /public/images/stuart/stuart3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/stuart/stuart3.png -------------------------------------------------------------------------------- /public/images/stuart/stuart4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/stuart/stuart4.png -------------------------------------------------------------------------------- /public/images/stuart/stuart5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/stuart/stuart5.png -------------------------------------------------------------------------------- /public/images/安悦溪1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/安悦溪1.jpg -------------------------------------------------------------------------------- /public/images/安悦溪2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/安悦溪2.jpg -------------------------------------------------------------------------------- /public/images/张杰1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/张杰1.jpg -------------------------------------------------------------------------------- /public/images/张杰2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/张杰2.jpg -------------------------------------------------------------------------------- /public/images/张杰3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/张杰3.jpg -------------------------------------------------------------------------------- /public/images/张杰4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/images/张杰4.jpg -------------------------------------------------------------------------------- /public/js/bbt.js: -------------------------------------------------------------------------------- 1 | const classes = ['amy', 'bernadette', 'howard', 'leonard', 'penny', 'raj', 'sheldon', 'stuart'] 2 | 3 | function getFaceImageUri(className, idx) { 4 | return `${className}/${className}${idx}.png` 5 | } 6 | 7 | function renderFaceImageSelectList(selectListId, onChange, initialValue) { 8 | const indices = [1, 2, 3, 4, 5] 9 | function renderChildren(select) { 10 | classes.forEach(className => { 11 | const optgroup = document.createElement('optgroup') 12 | optgroup.label = className 13 | select.appendChild(optgroup) 14 | indices.forEach(imageIdx => 15 | renderOption( 16 | optgroup, 17 | `${className} ${imageIdx}`, 18 | getFaceImageUri(className, imageIdx) 19 | ) 20 | ) 21 | }) 22 | } 23 | 24 | renderSelectList( 25 | selectListId, 26 | onChange, 27 | getFaceImageUri(initialValue.className, initialValue.imageIdx), 28 | renderChildren 29 | ) 30 | } 31 | 32 | // fetch first image of each class and compute their descriptors 33 | async function createBbtFaceMatcher(numImagesForTraining = 1) { 34 | const maxAvailableImagesPerClass = 5 35 | numImagesForTraining = Math.min(numImagesForTraining, maxAvailableImagesPerClass) 36 | 37 | const labeledFaceDescriptors = await Promise.all(classes.map( 38 | async className => { 39 | const descriptors = [] 40 | for (let i = 1; i < (numImagesForTraining + 1); i++) { 41 | const img = await faceapi.fetchImage(getFaceImageUri(className, i)) 42 | descriptors.push(await faceapi.computeFaceDescriptor(img)) 43 | } 44 | 45 | return new faceapi.LabeledFaceDescriptors( 46 | className, 47 | descriptors 48 | ) 49 | } 50 | )) 51 | 52 | return new faceapi.FaceMatcher(labeledFaceDescriptors) 53 | } -------------------------------------------------------------------------------- /public/js/commons.js: -------------------------------------------------------------------------------- 1 | async function requestExternalImage(imageUrl) { 2 | const res = await fetch('fetch_external_image', { 3 | method: 'post', 4 | headers: { 5 | 'content-type': 'application/json' 6 | }, 7 | body: JSON.stringify({ imageUrl }) 8 | }) 9 | if (!(res.status < 400)) { 10 | console.error(res.status + ' : ' + await res.text()) 11 | throw new Error('failed to fetch image from url: ' + imageUrl) 12 | } 13 | 14 | let blob 15 | try { 16 | blob = await res.blob() 17 | return await faceapi.bufferToImage(blob) 18 | } catch (e) { 19 | console.error('received blob:', blob) 20 | console.error('error:', e) 21 | throw new Error('failed to load image from url: ' + imageUrl) 22 | } 23 | } 24 | 25 | function renderNavBar(navbarId, exampleUri) { 26 | const examples = [ 27 | { 28 | uri: 'face_and_landmark_detection', 29 | name: 'Face And Landmark Detection' 30 | }, 31 | { 32 | uri: 'face_recognition', 33 | name: 'Face Recognition' 34 | }, 35 | { 36 | uri: 'face_extraction', 37 | name: 'Face Extraction' 38 | }, 39 | { 40 | uri: 'video_face_tracking', 41 | name: 'Video Face Tracking' 42 | }, 43 | { 44 | uri: 'webcam_face_tracking', 45 | name: 'Webcam Face Tracking' 46 | }, 47 | { 48 | uri: 'bbt_face_landmark_detection', 49 | name: 'BBT Face Landmark Detection' 50 | }, 51 | { 52 | uri: 'bbt_face_similarity', 53 | name: 'BBT Face Similarity' 54 | }, 55 | { 56 | uri: 'bbt_face_matching', 57 | name: 'BBT Face Matching' 58 | }, 59 | { 60 | uri: 'bbt_face_recognition', 61 | name: 'BBT Face Recognition' 62 | }, 63 | { 64 | uri: 'batch_face_landmarks', 65 | name: 'Batch Face Landmark Detection' 66 | }, 67 | { 68 | uri: 'batch_face_recognition', 69 | name: 'Batch Face Recognition' 70 | }, 71 | { 72 | uri: 'simplify_face_comparison', 73 | name: '人脸对比两张分离代码' 74 | }, 75 | { 76 | uri: 'simplify_face_comparison_many', 77 | name: '人脸对比多张分离代码' 78 | }, 79 | { 80 | uri: 'simplify_webrtc_face_trackimg', 81 | name: 'WebRTC媒体人脸检测分离代码' 82 | } 83 | ] 84 | 85 | const navbar = $(navbarId).get(0) 86 | const pageContainer = $('.page-container').get(0) 87 | 88 | const header = document.createElement('h3') 89 | header.innerHTML = examples.find(ex => ex.uri === exampleUri).name 90 | pageContainer.insertBefore(header, pageContainer.children[0]) 91 | 92 | const menuContent = document.createElement('ul') 93 | menuContent.id = 'slide-out' 94 | menuContent.classList.add('side-nav', 'fixed') 95 | navbar.appendChild(menuContent) 96 | 97 | const menuButton = document.createElement('a') 98 | menuButton.href='#' 99 | menuButton.classList.add('button-collapse', 'show-on-large') 100 | menuButton.setAttribute('data-activates', 'slide-out') 101 | const menuButtonIcon = document.createElement('img') 102 | menuButtonIcon.src = 'menu_icon.png' 103 | menuButton.appendChild(menuButtonIcon) 104 | navbar.appendChild(menuButton) 105 | 106 | const li = document.createElement('li') 107 | const githubLink = document.createElement('a') 108 | githubLink.classList.add('waves-effect', 'waves-light', 'side-by-side') 109 | githubLink.id = 'github-link' 110 | githubLink.href = 'https://github.com/justadudewhohacks/face-api.js' 111 | const h5 = document.createElement('h5') 112 | h5.innerHTML = 'face-api.js' 113 | githubLink.appendChild(h5) 114 | const githubLinkIcon = document.createElement('img') 115 | githubLinkIcon.src = 'github_link_icon.png' 116 | githubLink.appendChild(githubLinkIcon) 117 | li.appendChild(githubLink) 118 | menuContent.appendChild(li) 119 | 120 | examples 121 | .forEach(ex => { 122 | const li = document.createElement('li') 123 | if (ex.uri === exampleUri) { 124 | li.style.background='#b0b0b0' 125 | } 126 | const a = document.createElement('a') 127 | a.classList.add('waves-effect', 'waves-light') 128 | a.href = ex.uri 129 | const span = document.createElement('span') 130 | span.innerHTML = ex.name 131 | span.style.whiteSpace = 'nowrap' 132 | a.appendChild(span) 133 | li.appendChild(a) 134 | menuContent.appendChild(li) 135 | }) 136 | 137 | $('.button-collapse').sideNav({ 138 | menuWidth: 240 139 | }) 140 | } 141 | 142 | function renderSelectList(selectListId, onChange, initialValue, renderChildren) { 143 | const select = document.createElement('select') 144 | $(selectListId).get(0).appendChild(select) 145 | renderChildren(select) 146 | $(select).val(initialValue) 147 | $(select).on('change', (e) => onChange(e.target.value)) 148 | $(select).material_select() 149 | } 150 | 151 | function renderOption(parent, text, value) { 152 | const option = document.createElement('option') 153 | option.innerHTML = text 154 | option.value = value 155 | parent.appendChild(option) 156 | } -------------------------------------------------------------------------------- /public/js/drawing.js: -------------------------------------------------------------------------------- 1 | function resizeCanvasAndResults(dimensions, canvas, results) { 2 | const { width, height } = dimensions instanceof HTMLVideoElement 3 | ? faceapi.getMediaDimensions(dimensions) 4 | : dimensions 5 | canvas.width = width 6 | canvas.height = height 7 | 8 | // resize detections (and landmarks) in case displayed image is smaller than 9 | // original size 10 | return results.map(res => res.forSize(width, height)) 11 | } 12 | 13 | function drawDetections(dimensions, canvas, detections) { 14 | const resizedDetections = resizeCanvasAndResults(dimensions, canvas, detections) 15 | faceapi.drawDetection(canvas, resizedDetections) 16 | } 17 | 18 | function drawLandmarks(dimensions, canvas, results, withBoxes = true) { 19 | const resizedResults = resizeCanvasAndResults(dimensions, canvas, results) 20 | 21 | if (withBoxes) { 22 | faceapi.drawDetection(canvas, resizedResults.map(det => det.detection)) 23 | } 24 | 25 | const faceLandmarks = resizedResults.map(det => det.landmarks) 26 | const drawLandmarksOptions = { 27 | lineWidth: 2, 28 | drawLines: true, 29 | color: 'green' 30 | } 31 | faceapi.drawLandmarks(canvas, faceLandmarks, drawLandmarksOptions) 32 | } -------------------------------------------------------------------------------- /public/js/faceDetectionControls.js: -------------------------------------------------------------------------------- 1 | const SSD_MOBILENETV1 = 'ssd_mobilenetv1' 2 | const TINY_FACE_DETECTOR = 'tiny_face_detector' 3 | const MTCNN = 'mtcnn' 4 | 5 | 6 | let selectedFaceDetector = SSD_MOBILENETV1 7 | 8 | // ssd_mobilenetv1 options 9 | let minConfidence = 0.5 10 | 11 | // tiny_face_detector options 12 | let inputSize = 512 13 | let scoreThreshold = 0.5 14 | 15 | //mtcnn options 16 | let minFaceSize = 20 17 | 18 | function getFaceDetectorOptions() { 19 | return selectedFaceDetector === SSD_MOBILENETV1 20 | ? new faceapi.SsdMobilenetv1Options({ minConfidence }) 21 | : ( 22 | selectedFaceDetector === TINY_FACE_DETECTOR 23 | ? new faceapi.TinyFaceDetectorOptions({ inputSize, scoreThreshold }) 24 | : new faceapi.MtcnnOptions({ minFaceSize }) 25 | ) 26 | } 27 | 28 | function onIncreaseMinConfidence() { 29 | minConfidence = Math.min(faceapi.round(minConfidence + 0.1), 1.0) 30 | $('#minConfidence').val(minConfidence) 31 | updateResults() 32 | } 33 | 34 | function onDecreaseMinConfidence() { 35 | minConfidence = Math.max(faceapi.round(minConfidence - 0.1), 0.1) 36 | $('#minConfidence').val(minConfidence) 37 | updateResults() 38 | } 39 | 40 | function onInputSizeChanged(e) { 41 | changeInputSize(e.target.value) 42 | updateResults() 43 | } 44 | 45 | function changeInputSize(size) { 46 | inputSize = parseInt(size) 47 | 48 | const inputSizeSelect = $('#inputSize') 49 | inputSizeSelect.val(inputSize) 50 | inputSizeSelect.material_select() 51 | } 52 | 53 | function onIncreaseScoreThreshold() { 54 | scoreThreshold = Math.min(faceapi.round(scoreThreshold + 0.1), 1.0) 55 | $('#scoreThreshold').val(scoreThreshold) 56 | updateResults() 57 | } 58 | 59 | function onDecreaseScoreThreshold() { 60 | scoreThreshold = Math.max(faceapi.round(scoreThreshold - 0.1), 0.1) 61 | $('#scoreThreshold').val(scoreThreshold) 62 | updateResults() 63 | } 64 | 65 | function onIncreaseMinFaceSize() { 66 | minFaceSize = Math.min(faceapi.round(minFaceSize + 20), 300) 67 | $('#minFaceSize').val(minFaceSize) 68 | } 69 | 70 | function onDecreaseMinFaceSize() { 71 | minFaceSize = Math.max(faceapi.round(minFaceSize - 20), 50) 72 | $('#minFaceSize').val(minFaceSize) 73 | } 74 | 75 | function getCurrentFaceDetectionNet() { 76 | if (selectedFaceDetector === SSD_MOBILENETV1) { 77 | return faceapi.nets.ssdMobilenetv1 78 | } 79 | if (selectedFaceDetector === TINY_FACE_DETECTOR) { 80 | return faceapi.nets.tinyFaceDetector 81 | } 82 | if (selectedFaceDetector === MTCNN) { 83 | return faceapi.nets.mtcnn 84 | } 85 | } 86 | 87 | function isFaceDetectionModelLoaded() { 88 | return !!getCurrentFaceDetectionNet().params 89 | } 90 | 91 | async function changeFaceDetector(detector) { 92 | ['#ssd_mobilenetv1_controls', '#tiny_face_detector_controls', '#mtcnn_controls'] 93 | .forEach(id => $(id).hide()) 94 | 95 | selectedFaceDetector = detector 96 | const faceDetectorSelect = $('#selectFaceDetector') 97 | faceDetectorSelect.val(detector) 98 | faceDetectorSelect.material_select() 99 | 100 | $('#loader').show() 101 | if (!isFaceDetectionModelLoaded()) { 102 | await getCurrentFaceDetectionNet().load('/') 103 | } 104 | 105 | $(`#${detector}_controls`).show() 106 | $('#loader').hide() 107 | } 108 | 109 | async function onSelectedFaceDetectorChanged(e) { 110 | selectedFaceDetector = e.target.value 111 | 112 | await changeFaceDetector(e.target.value) 113 | updateResults() 114 | } 115 | 116 | function initFaceDetectionControls() { 117 | const faceDetectorSelect = $('#selectFaceDetector') 118 | faceDetectorSelect.val(selectedFaceDetector) 119 | faceDetectorSelect.on('change', onSelectedFaceDetectorChanged) 120 | faceDetectorSelect.material_select() 121 | 122 | const inputSizeSelect = $('#inputSize') 123 | inputSizeSelect.val(inputSize) 124 | inputSizeSelect.on('change', onInputSizeChanged) 125 | inputSizeSelect.material_select() 126 | } -------------------------------------------------------------------------------- /public/js/imageSelectionControls.js: -------------------------------------------------------------------------------- 1 | async function onSelectedImageChanged(uri) { 2 | const img = await faceapi.fetchImage(uri) 3 | $(`#inputImg`).get(0).src = img.src 4 | updateResults() 5 | } 6 | 7 | async function loadImageFromUrl(url) { 8 | const img = await requestExternalImage($('#imgUrlInput').val()) 9 | $('#inputImg').get(0).src = img.src 10 | updateResults() 11 | } 12 | 13 | function renderImageSelectList(selectListId, onChange, initialValue) { 14 | const images = [1, 2, 3, 4, 5].map(idx => `bbt${idx}.jpg`) 15 | function renderChildren(select) { 16 | images.forEach(imageName => 17 | renderOption( 18 | select, 19 | imageName, 20 | imageName 21 | ) 22 | ) 23 | } 24 | 25 | renderSelectList( 26 | selectListId, 27 | onChange, 28 | initialValue, 29 | renderChildren 30 | ) 31 | } 32 | 33 | function initImageSelectionControls() { 34 | renderImageSelectList( 35 | '#selectList', 36 | async (uri) => { 37 | await onSelectedImageChanged(uri) 38 | }, 39 | 'bbt1.jpg' 40 | ) 41 | onSelectedImageChanged($('#selectList select').val()) 42 | } -------------------------------------------------------------------------------- /public/media/bbt.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/media/bbt.mp4 -------------------------------------------------------------------------------- /public/menu_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TsMask/face-api-demo/7258119748c3efa7a428c5bfe8f254625b4b0c9b/public/menu_icon.png -------------------------------------------------------------------------------- /public/styles.css: -------------------------------------------------------------------------------- 1 | .page-container { 2 | left: 0; 3 | right: 0; 4 | margin: auto; 5 | margin-top: 20px; 6 | padding-left: 260px; 7 | display: inline-flex !important; 8 | } 9 | 10 | @media only screen and (max-width : 992px) { 11 | .page-container { 12 | padding-left: 0; 13 | display: flex !important; 14 | } 15 | } 16 | 17 | #navbar { 18 | position: absolute; 19 | top: 20px; 20 | left: 20px; 21 | } 22 | 23 | .center-content { 24 | display: flex; 25 | flex-direction: column; 26 | justify-content: center; 27 | align-items: center; 28 | flex-wrap: wrap; 29 | } 30 | 31 | .side-by-side { 32 | display: flex; 33 | justify-content: center; 34 | align-items: center; 35 | } 36 | .side-by-side >* { 37 | margin: 0 5px; 38 | } 39 | 40 | .bold { 41 | font-weight: bold; 42 | } 43 | 44 | .margin-sm { 45 | margin: 5px; 46 | } 47 | 48 | .margin { 49 | margin: 20px; 50 | } 51 | 52 | .button-sm { 53 | padding: 0 10px !important; 54 | } 55 | 56 | #github-link { 57 | display: flex !important; 58 | justify-content: center; 59 | align-items: center; 60 | border-bottom: 1px solid; 61 | margin-bottom: 10px; 62 | } 63 | 64 | #overlay, .overlay { 65 | position: absolute; 66 | top: 0; 67 | left: 0; 68 | } 69 | 70 | #facesContainer canvas { 71 | margin: 10px; 72 | } -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const path = require('path') 3 | const { get } = require('request') 4 | 5 | const app = express() 6 | 7 | app.use(express.json()) 8 | app.use(express.urlencoded({ extended: true })) 9 | 10 | const viewsDir = path.join(__dirname, 'views') 11 | app.use(express.static(viewsDir)) 12 | app.use(express.static(path.join(__dirname, './public'))) 13 | app.use(express.static(path.join(__dirname, './public/images'))) 14 | app.use(express.static(path.join(__dirname, './public/media'))) 15 | app.use(express.static(path.join(__dirname, './models'))) 16 | app.use(express.static(path.join(__dirname, './dist'))) 17 | 18 | app.get('/', (req, res) => res.redirect('/face_and_landmark_detection')) 19 | app.get('/face_and_landmark_detection', (req, res) => res.sendFile(path.join(viewsDir, 'faceAndLandmarkDetection.html'))) 20 | app.get('/face_extraction', (req, res) => res.sendFile(path.join(viewsDir, 'faceExtraction.html'))) 21 | app.get('/face_recognition', (req, res) => res.sendFile(path.join(viewsDir, 'faceRecognition.html'))) 22 | app.get('/video_face_tracking', (req, res) => res.sendFile(path.join(viewsDir, 'videoFaceTracking.html'))) 23 | app.get('/webcam_face_tracking', (req, res) => res.sendFile(path.join(viewsDir, 'webcamFaceTracking.html'))) 24 | app.get('/bbt_face_landmark_detection', (req, res) => res.sendFile(path.join(viewsDir, 'bbtFaceLandmarkDetection.html'))) 25 | app.get('/bbt_face_similarity', (req, res) => res.sendFile(path.join(viewsDir, 'bbtFaceSimilarity.html'))) 26 | app.get('/bbt_face_matching', (req, res) => res.sendFile(path.join(viewsDir, 'bbtFaceMatching.html'))) 27 | app.get('/bbt_face_recognition', (req, res) => res.sendFile(path.join(viewsDir, 'bbtFaceRecognition.html'))) 28 | app.get('/batch_face_landmarks', (req, res) => res.sendFile(path.join(viewsDir, 'batchFaceLandmarks.html'))) 29 | app.get('/batch_face_recognition', (req, res) => res.sendFile(path.join(viewsDir, 'batchFaceRecognition.html'))) 30 | app.get('/simplify_face_comparison', (req, res) => res.sendFile(path.join(viewsDir, 'simplifyFaceComparison.html'))) 31 | app.get('/simplify_face_comparison_many', (req, res) => res.sendFile(path.join(viewsDir, 'simplifyFaceComparisonMany.html'))) 32 | app.get('/simplify_webrtc_face_trackimg', (req, res) => res.sendFile(path.join(viewsDir, 'simplifyWebRTCFaceTracking.html'))) 33 | 34 | app.post('/fetch_external_image', async (req, res) => { 35 | const { imageUrl } = req.body 36 | if (!imageUrl) { 37 | return res.status(400).send('imageUrl param required') 38 | } 39 | try { 40 | const externalResponse = await request(imageUrl) 41 | res.set('content-type', externalResponse.headers['content-type']) 42 | return res.status(202).send(Buffer.from(externalResponse.body)) 43 | } catch (err) { 44 | return res.status(404).send(err.toString()) 45 | } 46 | }) 47 | 48 | app.listen(3000, () => console.log('Listening on port 3000!')) 49 | 50 | function request(url, returnBuffer = true, timeout = 10000) { 51 | return new Promise(function(resolve, reject) { 52 | const options = Object.assign( 53 | {}, 54 | { 55 | url, 56 | isBuffer: true, 57 | timeout, 58 | headers: { 59 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36 LBBROWSER' 60 | } 61 | }, 62 | returnBuffer ? { encoding: null } : {} 63 | ) 64 | 65 | get(options, function(err, res) { 66 | if (err) return reject(err) 67 | return resolve(res) 68 | }) 69 | }) 70 | } -------------------------------------------------------------------------------- /views/batchFaceLandmarks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 |
28 |
29 |
30 |
31 | 32 | 33 |
34 | 40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 49 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /views/batchFaceRecognition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 |
28 |
29 |
30 |
31 | 32 | 33 |
34 | 40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 49 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /views/bbtFaceLandmarkDetection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |

26 | 27 | 28 |

29 |
30 |
31 | 32 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /views/bbtFaceMatching.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 | 18 |
19 |
20 |
21 |
22 |
23 | 24 |
25 |
26 | 27 | 28 |
29 |
30 | 31 | 32 |
33 |
34 | 35 | 36 |
37 |
38 | 45 | 51 | 57 |
58 |
59 | 60 | 61 |
62 |
63 |
64 | 65 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /views/bbtFaceRecognition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 |
20 |
21 |
22 |
23 | 24 | 25 |
26 | 27 |
28 | 29 | 30 |
31 | 36 | 37 |
38 | 39 | 40 | 41 |
42 |
43 |
44 | 45 | 46 |
47 | 53 |
54 | 55 | 56 |
57 | 58 | 59 | 60 |
61 |
62 | 63 | 64 |
65 | 71 | 77 |
78 |
79 | 80 | 81 | 82 | 83 |
84 |
85 | 94 | 95 |
96 |
97 | 98 | 99 |
100 | 106 | 112 |
113 |
114 | 115 | 116 | 117 | 118 |
119 |
120 | 121 | 122 |
123 | 129 | 135 |
136 |
137 | 138 | 139 | 140 | 141 | 195 | 196 | -------------------------------------------------------------------------------- /views/bbtFaceSimilarity.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 22 |
23 |
24 |
25 | 26 |
27 |
28 |
29 |
30 | 31 | 32 |
33 | 34 |
35 |
36 | 37 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /views/faceAndLandmarkDetection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 |
19 |
20 |
21 |
22 | 23 | 24 |
25 | 26 |
27 | 28 |
29 |
30 | 31 | 32 |
33 | 39 | 40 |
41 | 42 |
43 | 44 | 45 |
46 | 51 | 52 |
53 | 54 | 55 | 56 |
57 | 58 | 59 | 60 | 61 |
62 | 63 | 64 |
65 | 66 | 67 | 68 |
69 |
70 | 71 | 72 |
73 | 79 | 85 |
86 |
87 | 88 | 89 | 90 | 91 |
92 |
93 | 102 | 103 |
104 |
105 | 106 | 107 |
108 | 114 | 120 |
121 |
122 | 123 | 124 | 125 | 126 |
127 |
128 | 129 | 130 |
131 | 137 | 143 |
144 |
145 | 146 | 147 | 148 | 149 | 200 | 201 | -------------------------------------------------------------------------------- /views/faceExtraction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 |
19 |
20 | 21 | 22 |
23 |
24 | 25 |
26 | 27 |
28 | 33 | 34 |
35 | 36 | 37 | 38 |
39 |
40 | 41 | 42 |
43 | 49 | 50 |
51 | 52 | 53 | 54 |
55 |
56 | 57 | 58 |
59 | 65 | 71 |
72 |
73 | 74 | 75 | 76 | 77 |
78 |
79 | 88 | 89 |
90 |
91 | 92 | 93 |
94 | 100 | 106 |
107 |
108 | 109 | 110 | 111 | 112 |
113 |
114 | 115 | 116 |
117 | 123 | 129 |
130 |
131 | 132 | 133 |
134 | 135 | 176 | 177 | -------------------------------------------------------------------------------- /views/faceRecognition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 |

Reference Image:

18 | 19 |
20 |
21 |
22 |
23 | 24 | 25 |
26 | 27 |
28 | 29 | 30 |
31 | 32 |
33 | 34 |
35 |
36 |
37 | 38 | 39 |
40 | 46 | 47 | 48 |
49 | 50 |

Query Image:

51 | 52 |
53 | 54 | 55 |
56 | 57 | 58 |
59 | 60 | 61 |
62 | 63 |
64 | 65 |
66 |
67 |
68 | 69 | 70 |
71 | 77 | 78 | 79 |
80 | 81 |
82 | 83 |
84 | 89 | 90 |
91 | 92 | 93 | 94 | 95 |
96 |
97 | 98 | 99 |
100 | 106 | 112 |
113 |
114 | 115 | 116 | 117 | 118 |
119 |
120 | 129 | 130 |
131 |
132 | 133 | 134 |
135 | 141 | 147 |
148 |
149 | 150 | 151 | 152 | 153 |
154 |
155 | 156 | 157 |
158 | 164 | 170 |
171 |
172 | 173 | 174 |
175 | 176 | 177 | 178 | 282 | 283 | -------------------------------------------------------------------------------- /views/simplifyFaceComparison.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 图片对比相识度 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 |

F12控制台查看,源码简化

18 | 19 | 48 | 49 | -------------------------------------------------------------------------------- /views/simplifyFaceComparisonMany.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 多图片对比相识度 9 | 10 | 11 | 12 | 13 |

F12控制台查看,源码简化

14 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 105 | 106 | -------------------------------------------------------------------------------- /views/simplifyWebRTCFaceTracking.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | WebRTC媒体人脸检测 9 | 10 | 21 | 22 | 23 | 24 |

F12控制台查看,源码简化

25 |
26 | 27 | 28 |
29 | 30 | 31 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /views/videoFaceTracking.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 |
18 |
19 |
20 |
21 | 22 | 23 |
24 | 25 |
26 | 27 | 28 |
29 | 34 | 35 |
36 | 37 | 38 | 39 |
40 | 41 | 42 | 43 | 44 |
45 | 46 | 47 | 48 |
49 |
50 | 51 | 52 | 53 | 54 |
55 |
56 | 57 | 58 |
59 | 60 | 61 | 62 |
63 |
64 | 65 | 66 |
67 | 73 | 79 |
80 |
81 | 82 | 83 | 84 | 85 |
86 |
87 | 96 | 97 |
98 |
99 | 100 | 101 |
102 | 108 | 114 |
115 |
116 | 117 | 118 | 119 | 120 |
121 |
122 | 123 | 124 |
125 | 131 | 137 |
138 |
139 | 140 | 141 | 142 | 143 | 208 | 209 | -------------------------------------------------------------------------------- /views/webcamFaceTracking.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 |
18 |
19 |
20 |
21 | 22 | 23 |
24 | 25 |
26 | 27 | 28 |
29 | 34 | 35 |
36 | 37 | 38 | 39 |
40 | 41 | 42 | 43 | 44 |
45 | 46 | 47 | 48 |
49 |
50 | 51 | 52 | 53 | 54 |
55 |
56 | 57 | 58 |
59 | 60 | 61 | 62 | 63 |
64 |
65 | 66 | 67 |
68 | 74 | 80 |
81 |
82 | 83 | 84 | 85 | 86 |
87 |
88 | 98 | 99 |
100 |
101 | 102 | 103 |
104 | 110 | 116 |
117 |
118 | 119 | 120 | 121 | 122 |
123 |
124 | 125 | 126 |
127 | 133 | 139 |
140 |
141 | 142 | 143 | 144 | 145 | 217 | 218 | --------------------------------------------------------------------------------