Add metadata writer for image segmentation.

PiperOrigin-RevId: 516671364
This commit is contained in:
Yuqi Li
2023-03-14 17:00:30 -07:00
committed by Copybara-Service
parent 9a89b47572
commit 51d9640d88
17 changed files with 805 additions and 4 deletions
+12
View File
@@ -28,6 +28,10 @@ mediapipe_files(srcs = [
"category_tensor_float_meta.json",
"coco_ssd_mobilenet_v1_1.0_quant_2018_06_29_no_metadata.tflite",
"coco_ssd_mobilenet_v1_score_calibration.json",
"deeplabv3.json",
"deeplabv3_with_activation.json",
"deeplabv3_without_labels.json",
"deeplabv3_without_metadata.tflite",
"efficientdet_lite0_v1.json",
"efficientdet_lite0_v1.tflite",
"labelmap.txt",
@@ -44,6 +48,8 @@ mediapipe_files(srcs = [
"mobilenet_v2_1.0_224_without_metadata.tflite",
"movie_review.tflite",
"score_calibration.csv",
"segmentation_mask_meta.json",
"segmenter_labelmap.txt",
"ssd_mobilenet_v1_no_metadata.json",
"ssd_mobilenet_v1_no_metadata.tflite",
"tensor_group_meta.json",
@@ -87,6 +93,7 @@ filegroup(
"30k-clean.model",
"bert_text_classifier_no_metadata.tflite",
"coco_ssd_mobilenet_v1_1.0_quant_2018_06_29_no_metadata.tflite",
"deeplabv3_without_metadata.tflite",
"efficientdet_lite0_v1.tflite",
"mobile_ica_8bit-with-custom-metadata.tflite",
"mobile_ica_8bit-with-large-min-parser-version.tflite",
@@ -116,6 +123,9 @@ filegroup(
"classification_tensor_uint8_meta.json",
"classification_tensor_unsupported_meta.json",
"coco_ssd_mobilenet_v1_score_calibration.json",
"deeplabv3.json",
"deeplabv3_with_activation.json",
"deeplabv3_without_labels.json",
"efficientdet_lite0_v1.json",
"external_file",
"feature_tensor_meta.json",
@@ -140,6 +150,8 @@ filegroup(
"score_calibration_file_meta.json",
"score_calibration_tensor_meta.json",
"score_thresholding_meta.json",
"segmentation_mask_meta.json",
"segmenter_labelmap.txt",
"sentence_piece_tokenizer_meta.json",
"ssd_mobilenet_v1_no_metadata.json",
"tensor_group_meta.json",
+66
View File
@@ -0,0 +1,66 @@
{
"name": "ImageSegmenter",
"description": "Semantic image segmentation predicts whether each pixel of an image is associated with a certain class.",
"subgraph_metadata": [
{
"input_tensor_metadata": [
{
"name": "image",
"description": "Input image to be processed.",
"content": {
"content_properties_type": "ImageProperties",
"content_properties": {
"color_space": "RGB"
}
},
"process_units": [
{
"options_type": "NormalizationOptions",
"options": {
"mean": [
127.5
],
"std": [
127.5
]
}
}
],
"stats": {
"max": [
1.0
],
"min": [
-1.0
]
}
}
],
"output_tensor_metadata": [
{
"name": "segmentation_masks",
"description": "Masks over the target objects with high accuracy.",
"content": {
"content_properties_type": "ImageProperties",
"content_properties": {
"color_space": "GRAYSCALE"
},
"range": {
"min": 1,
"max": 2
}
},
"stats": {},
"associated_files": [
{
"name": "labels.txt",
"description": "Labels for categories that the model can recognize.",
"type": "TENSOR_AXIS_LABELS"
}
]
}
]
}
],
"min_parser_version": "1.0.0"
}
@@ -0,0 +1,67 @@
{
"name": "ImageSegmenter",
"description": "Semantic image segmentation predicts whether each pixel of an image is associated with a certain class.",
"subgraph_metadata": [
{
"input_tensor_metadata": [
{
"name": "image",
"description": "Input image to be processed.",
"content": {
"content_properties_type": "ImageProperties",
"content_properties": {
"color_space": "RGB"
}
},
"process_units": [
{
"options_type": "NormalizationOptions",
"options": {
"mean": [
127.5
],
"std": [
127.5
]
}
}
],
"stats": {
"max": [
1.0
],
"min": [
-1.0
]
}
}
],
"output_tensor_metadata": [
{
"name": "segmentation_masks",
"description": "Masks over the target objects with high accuracy.",
"content": {
"content_properties_type": "ImageProperties",
"content_properties": {
"color_space": "GRAYSCALE"
},
"range": {
"min": 1,
"max": 2
}
},
"stats": {}
}
],
"custom_metadata": [
{
"name": "SEGMENTER_METADATA",
"data": {
"activation": "SIGMOID"
}
}
]
}
],
"min_parser_version": "1.5.0"
}
@@ -0,0 +1,59 @@
{
"name": "ImageSegmenter",
"description": "Semantic image segmentation predicts whether each pixel of an image is associated with a certain class.",
"subgraph_metadata": [
{
"input_tensor_metadata": [
{
"name": "image",
"description": "Input image to be processed.",
"content": {
"content_properties_type": "ImageProperties",
"content_properties": {
"color_space": "RGB"
}
},
"process_units": [
{
"options_type": "NormalizationOptions",
"options": {
"mean": [
127.5
],
"std": [
127.5
]
}
}
],
"stats": {
"max": [
1.0
],
"min": [
-1.0
]
}
}
],
"output_tensor_metadata": [
{
"name": "segmentation_masks",
"description": "Masks over the target objects with high accuracy.",
"content": {
"content_properties_type": "ImageProperties",
"content_properties": {
"color_space": "GRAYSCALE"
},
"range": {
"min": 1,
"max": 2
}
},
"stats": {}
}
]
}
],
"min_parser_version": "1.0.0"
}
@@ -0,0 +1,24 @@
{
"subgraph_metadata": [
{
"input_tensor_metadata": [
{
"name": "segmentation_masks",
"description": "Masks over the target objects.",
"content": {
"content_properties_type": "ImageProperties",
"content_properties": {
"color_space": "GRAYSCALE"
},
"range": {
"min": 1,
"max": 2
}
},
"stats": {
}
}
]
}
]
}
@@ -0,0 +1,21 @@
background
aeroplane
bicycle
bird
boat
bottle
bus
car
cat
chair
cow
dining table
dog
horse
motorbike
person
potted plant
sheep
sofa
train
tv