mediapipe
mediapipe copied to clipboard
Output shape of the Hair segmentation model
Hello,
How many channels has the output of the Hair segmentation model ?
In the TfLiteTensorsToSegmentationCalculator from the graph, there is
tensor_channels: 2
does that mean the output have 2 channels ?
In the model paper (https://arxiv.org/pdf/1907.06740.pdf), the output of the model only has one channel.
I want to use this graph with my own segmentation model, but its output has 1 channel. Also, my model does not use the output of the previous frame, can I still use this graph for my own segmentation model ?
Hi @charlottejuston, Could you please point out the output channel you are referring in the both of cases. Thank you!
Hello, thank you for your reply!
From what I understood of the paper, the hair segmentation model takes as input a tensor of shape (4x512x512) and has as output a tensor of shape (1x512x512) so with only one channel.
Now, I wanted to know what does the tensor_channels: 2 refer to in this part of the graph ?
node {
calculator: "TfLiteTensorsToSegmentationCalculator"
input_stream: "TENSORS:segmentation_tensor"
input_stream: "PREV_MASK:previous_hair_mask"
output_stream: "MASK:hair_mask"
node_options: {
[type.googleapis.com/mediapipe.TfLiteTensorsToSegmentationCalculatorOptions] {
tensor_width: 512
tensor_height: 512
tensor_channels: 2
combine_with_previous_ratio: 0.9
output_layer_index: 0
}
}
}
I want to use this graph for my own model, which takes as input a tensor of shape (3x512x512) and has as output a tensor of shape (1x512x512). Is it possible to use the graph of the Hair Segmentation with my own model ?
TfLiteTensorsToSegmentationCalculator only processes output tensor of dim 1x512x512x2, so you may need to customize a new calculator for your model. moreover, the hair segmentation model actually takes input tensor of dim 512x512x4. https://github.com/google/mediapipe/blob/6cdc6443b6a7ed662744e2a2ce2d58d9c83e6d6f/mediapipe/calculators/tflite/tflite_tensors_to_segmentation_calculator.cc#L530
Hello @charlottejuston Did the insights provided above helped you in resolving the issue? Are you still looking for a resolution?
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.
This issue was closed due to lack of activity after being marked stale for past 7 days.