Commit 47b9dd04 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower Committed by TF Object Detection Team
Browse files

Makes sure relevant fields are converted to float.

PiperOrigin-RevId: 347837387
parent f1789115
...@@ -56,10 +56,9 @@ def _decode_raw_data_into_masks_and_boxes(segments, image_widths, ...@@ -56,10 +56,9 @@ def _decode_raw_data_into_masks_and_boxes(segments, image_widths,
"""Decods binary segmentation masks into np.arrays and boxes. """Decods binary segmentation masks into np.arrays and boxes.
Args: Args:
segments: pandas Series object containing either segments: pandas Series object containing either None entries, or strings
None entries, or strings with with base64, zlib compressed, COCO RLE-encoded binary masks. All masks are
base64, zlib compressed, COCO RLE-encoded binary masks. expected to be the same size.
All masks are expected to be the same size.
image_widths: pandas Series of mask widths. image_widths: pandas Series of mask widths.
image_heights: pandas Series of mask heights. image_heights: pandas Series of mask heights.
...@@ -136,15 +135,15 @@ def build_groundtruth_dictionary(data, class_label_map): ...@@ -136,15 +135,15 @@ def build_groundtruth_dictionary(data, class_label_map):
dictionary = { dictionary = {
standard_fields.InputDataFields.groundtruth_boxes: standard_fields.InputDataFields.groundtruth_boxes:
data_location[['YMin', 'XMin', 'YMax', 'XMax']].to_numpy(), data_location[['YMin', 'XMin', 'YMax',
'XMax']].to_numpy().astype(float),
standard_fields.InputDataFields.groundtruth_classes: standard_fields.InputDataFields.groundtruth_classes:
data_location['LabelName'].map(lambda x: class_label_map[x] data_location['LabelName'].map(lambda x: class_label_map[x]
).to_numpy(), ).to_numpy(),
standard_fields.InputDataFields.groundtruth_group_of: standard_fields.InputDataFields.groundtruth_group_of:
data_location['IsGroupOf'].to_numpy().astype(int), data_location['IsGroupOf'].to_numpy().astype(int),
standard_fields.InputDataFields.groundtruth_image_classes: standard_fields.InputDataFields.groundtruth_image_classes:
data_labels['LabelName'].map(lambda x: class_label_map[x] data_labels['LabelName'].map(lambda x: class_label_map[x]).to_numpy(),
).to_numpy(),
} }
if 'Mask' in data_location: if 'Mask' in data_location:
...@@ -181,7 +180,7 @@ def build_predictions_dictionary(data, class_label_map): ...@@ -181,7 +180,7 @@ def build_predictions_dictionary(data, class_label_map):
standard_fields.DetectionResultFields.detection_classes: standard_fields.DetectionResultFields.detection_classes:
data['LabelName'].map(lambda x: class_label_map[x]).to_numpy(), data['LabelName'].map(lambda x: class_label_map[x]).to_numpy(),
standard_fields.DetectionResultFields.detection_scores: standard_fields.DetectionResultFields.detection_scores:
data['Score'].to_numpy() data['Score'].to_numpy().astype(float)
} }
if 'Mask' in data: if 'Mask' in data:
...@@ -192,6 +191,6 @@ def build_predictions_dictionary(data, class_label_map): ...@@ -192,6 +191,6 @@ def build_predictions_dictionary(data, class_label_map):
else: else:
dictionary[standard_fields.DetectionResultFields.detection_boxes] = data[[ dictionary[standard_fields.DetectionResultFields.detection_boxes] = data[[
'YMin', 'XMin', 'YMax', 'XMax' 'YMin', 'XMin', 'YMax', 'XMax'
]].to_numpy() ]].to_numpy().astype(float)
return dictionary return dictionary
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment