66 lines
1.7 KiB
Plaintext
66 lines
1.7 KiB
Plaintext
# MediaPipe graph that performs face detection with TensorFlow Lite on CPU.
|
|
# Used in the examples in
|
|
# mediapipe/examples/facial_search.
|
|
type: "FaceEmbeddingsSubgraph"
|
|
|
|
input_stream: "IMAGE:input_frame"
|
|
input_stream: "DETECTIONS:head_detections"
|
|
output_stream: "FLOATS:embeddings"
|
|
|
|
# DetectionsToRectsCalculator takes DETECTIONS in and outputs NORM_RECT of
|
|
# the first detection.
|
|
node {
|
|
calculator: "DetectionsToRectsCalculator"
|
|
input_stream: "DETECTIONS:head_detections"
|
|
output_stream: "NORM_RECT:head_rect"
|
|
node_options: {
|
|
[type.googleapis.com/mediapipe.DetectionsToRectsCalculatorOptions] {
|
|
output_zero_rect_for_empty_detections: true
|
|
}
|
|
}
|
|
}
|
|
|
|
node {
|
|
calculator: "ImageCroppingCalculator"
|
|
input_stream: "IMAGE:input_frame"
|
|
input_stream: "NORM_RECT:head_rect"
|
|
output_stream: "IMAGE:cropped_head"
|
|
}
|
|
|
|
node {
|
|
calculator: "ImageTransformationCalculator"
|
|
input_stream: "IMAGE:cropped_head"
|
|
output_stream: "IMAGE:scaled_head"
|
|
node_options: {
|
|
[type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] {
|
|
output_width: 140
|
|
output_height: 140
|
|
scale_mode: FIT
|
|
}
|
|
}
|
|
}
|
|
|
|
node {
|
|
calculator: "TfLiteConverterCalculator"
|
|
input_stream: "IMAGE:scaled_head"
|
|
output_stream: "TENSORS:scaled_head_tensor"
|
|
}
|
|
|
|
node {
|
|
calculator: "TfLiteInferenceCalculator"
|
|
input_stream: "TENSORS:scaled_head_tensor"
|
|
output_stream: "TENSORS:embeddings_tensors"
|
|
node_options: {
|
|
[type.googleapis.com/mediapipe.TfLiteInferenceCalculatorOptions] {
|
|
use_gpu: false
|
|
model_path: "mediapipe/models/face_embeddings.tflite"
|
|
}
|
|
}
|
|
}
|
|
|
|
node {
|
|
calculator: "TfLiteTensorsToFloatsCalculator"
|
|
input_stream: "TENSORS:embeddings_tensors"
|
|
output_stream: "FLOATS:embeddings"
|
|
}
|