64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
|
# MediaPipe graph to load a selected selfie segmentation TF Lite model.
|
||
|
|
||
|
type: "SelfieSegmentationModelLoader"
|
||
|
|
||
|
# An integer 0 or 1. Use 0 to select a general-purpose model (operating on a
|
||
|
# 256x256 tensor), and 1 to select a model (operating on a 256x144 tensor) more
|
||
|
# optimized for landscape images. If unspecified, functions as set to 0. (int)
|
||
|
input_side_packet: "MODEL_SELECTION:model_selection"
|
||
|
|
||
|
# TF Lite model represented as a FlatBuffer.
|
||
|
# (std::unique_ptr<tflite::FlatBufferModel, std::function<void(tflite::FlatBufferModel*)>>)
|
||
|
output_side_packet: "MODEL:model"
|
||
|
|
||
|
# Determines path to the desired pose landmark model file.
|
||
|
node {
|
||
|
calculator: "SwitchContainer"
|
||
|
input_side_packet: "SELECT:model_selection"
|
||
|
output_side_packet: "PACKET:model_path"
|
||
|
options: {
|
||
|
[mediapipe.SwitchContainerOptions.ext] {
|
||
|
select: 0
|
||
|
contained_node: {
|
||
|
calculator: "ConstantSidePacketCalculator"
|
||
|
options: {
|
||
|
[mediapipe.ConstantSidePacketCalculatorOptions.ext]: {
|
||
|
packet {
|
||
|
string_value: "mediapipe/modules/selfie_segmentation/selfie_segmentation.tflite"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
contained_node: {
|
||
|
calculator: "ConstantSidePacketCalculator"
|
||
|
options: {
|
||
|
[mediapipe.ConstantSidePacketCalculatorOptions.ext]: {
|
||
|
packet {
|
||
|
string_value: "mediapipe/modules/selfie_segmentation/selfie_segmentation_landscape.tflite"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# Loads the file in the specified path into a blob.
|
||
|
node {
|
||
|
calculator: "LocalFileContentsCalculator"
|
||
|
input_side_packet: "FILE_PATH:model_path"
|
||
|
output_side_packet: "CONTENTS:model_blob"
|
||
|
options: {
|
||
|
[mediapipe.LocalFileContentsCalculatorOptions.ext]: {
|
||
|
text_mode: false
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# Converts the input blob into a TF Lite model.
|
||
|
node {
|
||
|
calculator: "TfLiteModelCalculator"
|
||
|
input_side_packet: "MODEL_BLOB:model_blob"
|
||
|
output_side_packet: "MODEL:model"
|
||
|
}
|