# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for object_detection.data_decoders.tf_example_decoder."""

import os
import numpy as np
import six
import tensorflow.compat.v1 as tf

from object_detection.core import standard_fields as fields
from object_detection.data_decoders import tf_example_decoder
from object_detection.protos import input_reader_pb2
from object_detection.utils import dataset_util
from object_detection.utils import test_case


class TfExampleDecoderTest(test_case.TestCase):

  def _create_encoded_and_decoded_data(self, data, encoding_type):
    if encoding_type == 'jpeg':
      encode_fn = tf.image.encode_jpeg
      decode_fn = tf.image.decode_jpeg
    elif encoding_type == 'png':
      encode_fn = tf.image.encode_png
      decode_fn = tf.image.decode_png
    else:
      raise ValueError('Invalid encoding type.')

    def prepare_data_fn():
      encoded_data = encode_fn(data)
      decoded_data = decode_fn(encoded_data)
      return encoded_data, decoded_data

    return self.execute_cpu(prepare_data_fn, [])

  def testDecodeAdditionalChannels(self):
    image = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(image, 'jpeg')

    additional_channel = np.random.randint(256, size=(4, 5, 1)).astype(np.uint8)
    (encoded_additional_channel,
     decoded_additional_channel) = self._create_encoded_and_decoded_data(
         additional_channel, 'jpeg')

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/additional_channels/encoded':
                      dataset_util.bytes_list_feature(
                          [encoded_additional_channel] * 2),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/source_id':
                      dataset_util.bytes_feature(six.b('image_id')),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          num_additional_channels=2)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        np.concatenate([decoded_additional_channel] * 2, axis=2),
        tensor_dict[fields.InputDataFields.image_additional_channels])

  def testDecodeJpegImage(self):
    image = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, decoded_jpeg = self._create_encoded_and_decoded_data(
        image, 'jpeg')

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/source_id':
                      dataset_util.bytes_feature(six.b('image_id')),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))
      self.assertAllEqual(
          (output[fields.InputDataFields.image].get_shape().as_list()),
          [None, None, 3])
      self.assertAllEqual(
          (output[fields.InputDataFields.original_image_spatial_shape]
           .get_shape().as_list()), [2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(decoded_jpeg, tensor_dict[fields.InputDataFields.image])
    self.assertAllEqual([4, 5], tensor_dict[fields.InputDataFields.
                                            original_image_spatial_shape])
    self.assertEqual(
        six.b('image_id'), tensor_dict[fields.InputDataFields.source_id])

  def testDecodeImageKeyAndFilename(self):
    image = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(image, 'jpeg')

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/key/sha256':
                      dataset_util.bytes_feature(six.b('abc')),
                  'image/filename':
                      dataset_util.bytes_feature(six.b('filename'))
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertEqual(six.b('abc'), tensor_dict[fields.InputDataFields.key])
    self.assertEqual(
        six.b('filename'), tensor_dict[fields.InputDataFields.filename])

  def testDecodePngImage(self):
    image = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_png, decoded_png = self._create_encoded_and_decoded_data(
        image, 'png')

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_png),
                  'image/format':
                      dataset_util.bytes_feature(six.b('png')),
                  'image/source_id':
                      dataset_util.bytes_feature(six.b('image_id'))
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))
      self.assertAllEqual(
          (output[fields.InputDataFields.image].get_shape().as_list()),
          [None, None, 3])
      self.assertAllEqual(
          (output[fields.InputDataFields.original_image_spatial_shape]
           .get_shape().as_list()), [2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(decoded_png, tensor_dict[fields.InputDataFields.image])
    self.assertAllEqual([4, 5], tensor_dict[fields.InputDataFields.
                                            original_image_spatial_shape])
    self.assertEqual(
        six.b('image_id'), tensor_dict[fields.InputDataFields.source_id])

  def testDecodePngInstanceMasks(self):
    image = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_png, _ = self._create_encoded_and_decoded_data(image, 'png')
    mask_1 = np.random.randint(0, 2, size=(10, 10, 1)).astype(np.uint8)
    mask_2 = np.random.randint(0, 2, size=(10, 10, 1)).astype(np.uint8)
    encoded_png_1, _ = self._create_encoded_and_decoded_data(mask_1, 'png')
    decoded_png_1 = np.squeeze(mask_1.astype(np.float32))
    encoded_png_2, _ = self._create_encoded_and_decoded_data(mask_2, 'png')
    decoded_png_2 = np.squeeze(mask_2.astype(np.float32))
    encoded_masks = [encoded_png_1, encoded_png_2]
    decoded_masks = np.stack([decoded_png_1, decoded_png_2])

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_png),
                  'image/format':
                      dataset_util.bytes_feature(six.b('png')),
                  'image/object/mask':
                      dataset_util.bytes_list_feature(encoded_masks)
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          load_instance_masks=True,
          instance_mask_type=input_reader_pb2.PNG_MASKS)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        decoded_masks,
        tensor_dict[fields.InputDataFields.groundtruth_instance_masks])

  def testDecodeEmptyPngInstanceMasks(self):
    image_tensor = np.random.randint(256, size=(10, 10, 3)).astype(np.uint8)
    encoded_png, _ = self._create_encoded_and_decoded_data(image_tensor, 'png')
    encoded_masks = []

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_png),
                  'image/format':
                      dataset_util.bytes_feature(six.b('png')),
                  'image/object/mask':
                      dataset_util.bytes_list_feature(encoded_masks),
                  'image/height':
                      dataset_util.int64_feature(10),
                  'image/width':
                      dataset_util.int64_feature(10),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          load_instance_masks=True,
          instance_mask_type=input_reader_pb2.PNG_MASKS)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        tensor_dict[fields.InputDataFields.groundtruth_instance_masks].shape,
        [0, 10, 10])

  def testDecodeBoundingBox(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))
      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_boxes].get_shape().as_list()),
                          [None, 4])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    expected_boxes = np.vstack([bbox_ymins, bbox_xmins, bbox_ymaxs,
                                bbox_xmaxs]).transpose()
    self.assertAllEqual(expected_boxes,
                        tensor_dict[fields.InputDataFields.groundtruth_boxes])

  def testDecodeKeypointDepth(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]
    keypoint_ys = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
    keypoint_xs = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    keypoint_visibility = [1, 2, 0, 1, 0, 2]
    keypoint_depths = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
    keypoint_depth_weights = [1.0, 0.9, 0.8, 0.7, 0.6, 0.5]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
                  'image/object/keypoint/y':
                      dataset_util.float_list_feature(keypoint_ys),
                  'image/object/keypoint/x':
                      dataset_util.float_list_feature(keypoint_xs),
                  'image/object/keypoint/z':
                      dataset_util.float_list_feature(keypoint_depths),
                  'image/object/keypoint/z/weights':
                      dataset_util.float_list_feature(keypoint_depth_weights),
                  'image/object/keypoint/visibility':
                      dataset_util.int64_list_feature(keypoint_visibility),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          num_keypoints=3, load_keypoint_depth_features=True)
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual(
          (output[fields.InputDataFields.groundtruth_keypoint_depths].get_shape(
          ).as_list()), [2, 3])
      self.assertAllEqual(
          (output[fields.InputDataFields.groundtruth_keypoint_depth_weights]
           .get_shape().as_list()), [2, 3])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])

    expected_keypoint_depths = [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]]
    self.assertAllClose(
        expected_keypoint_depths,
        tensor_dict[fields.InputDataFields.groundtruth_keypoint_depths])

    expected_keypoint_depth_weights = [[1.0, 0.9, 0.8], [0.7, 0.6, 0.5]]
    self.assertAllClose(
        expected_keypoint_depth_weights,
        tensor_dict[fields.InputDataFields.groundtruth_keypoint_depth_weights])

  def testDecodeKeypointDepthNoDepth(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]
    keypoint_ys = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
    keypoint_xs = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    keypoint_visibility = [1, 2, 0, 1, 0, 2]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
                  'image/object/keypoint/y':
                      dataset_util.float_list_feature(keypoint_ys),
                  'image/object/keypoint/x':
                      dataset_util.float_list_feature(keypoint_xs),
                  'image/object/keypoint/visibility':
                      dataset_util.int64_list_feature(keypoint_visibility),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          num_keypoints=3, load_keypoint_depth_features=True)
      output = example_decoder.decode(tf.convert_to_tensor(example))

      return output

    tensor_dict = self.execute_cpu(graph_fn, [])

    expected_keypoints_depth_default = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
    self.assertAllClose(
        expected_keypoints_depth_default,
        tensor_dict[fields.InputDataFields.groundtruth_keypoint_depths])
    self.assertAllClose(
        expected_keypoints_depth_default,
        tensor_dict[fields.InputDataFields.groundtruth_keypoint_depth_weights])

  def testDecodeKeypoint(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]
    keypoint_ys = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
    keypoint_xs = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    keypoint_visibility = [1, 2, 0, 1, 0, 2]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
                  'image/object/keypoint/y':
                      dataset_util.float_list_feature(keypoint_ys),
                  'image/object/keypoint/x':
                      dataset_util.float_list_feature(keypoint_xs),
                  'image/object/keypoint/visibility':
                      dataset_util.int64_list_feature(keypoint_visibility),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(num_keypoints=3)
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_boxes].get_shape().as_list()),
                          [None, 4])
      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_keypoints].get_shape().as_list()),
                          [2, 3, 2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    expected_boxes = np.vstack([bbox_ymins, bbox_xmins, bbox_ymaxs,
                                bbox_xmaxs]).transpose()
    self.assertAllEqual(expected_boxes,
                        tensor_dict[fields.InputDataFields.groundtruth_boxes])

    expected_keypoints = [
        [[0.0, 1.0], [1.0, 2.0], [np.nan, np.nan]],
        [[3.0, 4.0], [np.nan, np.nan], [5.0, 6.0]]]
    self.assertAllClose(
        expected_keypoints,
        tensor_dict[fields.InputDataFields.groundtruth_keypoints])

    expected_visibility = (
        (np.array(keypoint_visibility) > 0).reshape((2, 3)))
    self.assertAllEqual(
        expected_visibility,
        tensor_dict[fields.InputDataFields.groundtruth_keypoint_visibilities])

  def testDecodeKeypointNoVisibilities(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]
    keypoint_ys = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
    keypoint_xs = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
                  'image/object/keypoint/y':
                      dataset_util.float_list_feature(keypoint_ys),
                  'image/object/keypoint/x':
                      dataset_util.float_list_feature(keypoint_xs),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(num_keypoints=3)
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_boxes].get_shape().as_list()),
                          [None, 4])
      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_keypoints].get_shape().as_list()),
                          [2, 3, 2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    expected_boxes = np.vstack([bbox_ymins, bbox_xmins, bbox_ymaxs,
                                bbox_xmaxs]).transpose()
    self.assertAllEqual(expected_boxes,
                        tensor_dict[fields.InputDataFields.groundtruth_boxes])

    expected_keypoints = (
        np.vstack([keypoint_ys, keypoint_xs]).transpose().reshape((2, 3, 2)))
    self.assertAllEqual(
        expected_keypoints,
        tensor_dict[fields.InputDataFields.groundtruth_keypoints])

    expected_visibility = np.ones((2, 3))
    self.assertAllEqual(
        expected_visibility,
        tensor_dict[fields.InputDataFields.groundtruth_keypoint_visibilities])

  def testDecodeDefaultGroundtruthWeights(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_boxes].get_shape().as_list()),
                          [None, 4])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllClose(tensor_dict[fields.InputDataFields.groundtruth_weights],
                        np.ones(2, dtype=np.float32))

  def testDecodeObjectLabel(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_classes = [0, 1]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/class/label':
                      dataset_util.int64_list_feature(bbox_classes),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_classes].get_shape().as_list()),
                          [2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])

    self.assertAllEqual(bbox_classes,
                        tensor_dict[fields.InputDataFields.groundtruth_classes])

  def testDecodeMultiClassScores(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]
    flattened_multiclass_scores = [100., 50.] + [20., 30.]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/class/multiclass_scores':
                      dataset_util.float_list_feature(
                          flattened_multiclass_scores),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          load_multiclass_scores=True)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(flattened_multiclass_scores,
                        tensor_dict[fields.InputDataFields.multiclass_scores])

  def testDecodeEmptyMultiClassScores(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          load_multiclass_scores=True)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertEqual(
        (0,), tensor_dict[fields.InputDataFields.multiclass_scores].shape)

  def testDecodeObjectLabelNoText(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_classes = [1, 2]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/class/label':
                      dataset_util.int64_list_feature(bbox_classes),
              })).SerializeToString()
      label_map_string = """
        item {
          id:1
          name:'cat'
        }
        item {
          id:2
          name:'dog'
        }
      """
      label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
      with tf.gfile.Open(label_map_path, 'wb') as f:
        f.write(label_map_string)

      example_decoder = tf_example_decoder.TfExampleDecoder(
          label_map_proto_file=label_map_path)
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_classes].get_shape().as_list()),
                          [None])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])

    self.assertAllEqual(bbox_classes,
                        tensor_dict[fields.InputDataFields.groundtruth_classes])

  def testDecodeObjectLabelWithText(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_classes_text = [six.b('cat'), six.b('dog')]
    # Annotation label gets overridden by labelmap id.
    annotated_bbox_classes = [3, 4]
    expected_bbox_classes = [1, 2]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/class/text':
                      dataset_util.bytes_list_feature(bbox_classes_text),
                  'image/object/class/label':
                      dataset_util.int64_list_feature(annotated_bbox_classes),
              })).SerializeToString()
      label_map_string = """
        item {
          id:1
          name:'cat'
        }
        item {
          id:2
          name:'dog'
        }
      """
      label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
      with tf.gfile.Open(label_map_path, 'wb') as f:
        f.write(label_map_string)

      example_decoder = tf_example_decoder.TfExampleDecoder(
          label_map_proto_file=label_map_path)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])

    self.assertAllEqual(expected_bbox_classes,
                        tensor_dict[fields.InputDataFields.groundtruth_classes])

  def testDecodeObjectLabelUnrecognizedName(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_classes_text = [six.b('cat'), six.b('cheetah')]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/class/text':
                      dataset_util.bytes_list_feature(bbox_classes_text),
              })).SerializeToString()

      label_map_string = """
        item {
          id:2
          name:'cat'
        }
        item {
          id:1
          name:'dog'
        }
      """
      label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
      with tf.gfile.Open(label_map_path, 'wb') as f:
        f.write(label_map_string)
      example_decoder = tf_example_decoder.TfExampleDecoder(
          label_map_proto_file=label_map_path)
      output = example_decoder.decode(tf.convert_to_tensor(example))
      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_classes].get_shape().as_list()),
                          [None])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual([2, -1],
                        tensor_dict[fields.InputDataFields.groundtruth_classes])

  def testDecodeObjectLabelWithMappingWithDisplayName(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_classes_text = [six.b('cat'), six.b('dog')]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/class/text':
                      dataset_util.bytes_list_feature(bbox_classes_text),
              })).SerializeToString()

      label_map_string = """
        item {
          id:3
          display_name:'cat'
        }
        item {
          id:1
          display_name:'dog'
        }
      """
      label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
      with tf.gfile.Open(label_map_path, 'wb') as f:
        f.write(label_map_string)
      example_decoder = tf_example_decoder.TfExampleDecoder(
          label_map_proto_file=label_map_path)
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_classes].get_shape().as_list()),
                          [None])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual([3, 1],
                        tensor_dict[fields.InputDataFields.groundtruth_classes])

  def testDecodeObjectLabelUnrecognizedNameWithMappingWithDisplayName(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_classes_text = [six.b('cat'), six.b('cheetah')]
    bbox_classes_id = [5, 6]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/class/text':
                      dataset_util.bytes_list_feature(bbox_classes_text),
                  'image/object/class/label':
                      dataset_util.int64_list_feature(bbox_classes_id),
              })).SerializeToString()

      label_map_string = """
        item {
          name:'/m/cat'
          id:3
          display_name:'cat'
        }
        item {
          name:'/m/dog'
          id:1
          display_name:'dog'
        }
      """
      label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
      with tf.gfile.Open(label_map_path, 'wb') as f:
        f.write(label_map_string)
      example_decoder = tf_example_decoder.TfExampleDecoder(
          label_map_proto_file=label_map_path)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual([3, -1],
                        tensor_dict[fields.InputDataFields.groundtruth_classes])

  def testDecodeObjectLabelWithMappingWithName(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_classes_text = [six.b('cat'), six.b('dog')]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/class/text':
                      dataset_util.bytes_list_feature(bbox_classes_text),
              })).SerializeToString()

      label_map_string = """
        item {
          id:3
          name:'cat'
        }
        item {
          id:1
          name:'dog'
        }
      """
      label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
      with tf.gfile.Open(label_map_path, 'wb') as f:
        f.write(label_map_string)
      example_decoder = tf_example_decoder.TfExampleDecoder(
          label_map_proto_file=label_map_path)
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_classes].get_shape().as_list()),
                          [None])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual([3, 1],
                        tensor_dict[fields.InputDataFields.groundtruth_classes])

  def testDecodeObjectArea(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    object_area = [100., 174.]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/area':
                      dataset_util.float_list_feature(object_area),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_area].get_shape().as_list()), [2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])

    self.assertAllEqual(object_area,
                        tensor_dict[fields.InputDataFields.groundtruth_area])

  def testDecodeVerifiedNegClasses(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    neg_category_ids = [0, 5, 8]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/neg_category_ids':
                      dataset_util.int64_list_feature(neg_category_ids),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        neg_category_ids,
        tensor_dict[fields.InputDataFields.groundtruth_verified_neg_classes])

  def testDecodeNotExhaustiveClasses(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    not_exhaustive_category_ids = [0, 5, 8]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/not_exhaustive_category_ids':
                      dataset_util.int64_list_feature(
                          not_exhaustive_category_ids),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        not_exhaustive_category_ids,
        tensor_dict[fields.InputDataFields.groundtruth_not_exhaustive_classes])

  def testDecodeObjectIsCrowd(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    object_is_crowd = [0, 1]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/is_crowd':
                      dataset_util.int64_list_feature(object_is_crowd),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_is_crowd].get_shape().as_list()),
                          [2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        [bool(item) for item in object_is_crowd],
        tensor_dict[fields.InputDataFields.groundtruth_is_crowd])

  def testDecodeObjectDifficult(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    object_difficult = [0, 1]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/difficult':
                      dataset_util.int64_list_feature(object_difficult),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_difficult].get_shape().as_list()),
                          [2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        [bool(item) for item in object_difficult],
        tensor_dict[fields.InputDataFields.groundtruth_difficult])

  def testDecodeObjectGroupOf(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    object_group_of = [0, 1]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/group_of':
                      dataset_util.int64_list_feature(object_group_of),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_group_of].get_shape().as_list()),
                          [2])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        [bool(item) for item in object_group_of],
        tensor_dict[fields.InputDataFields.groundtruth_group_of])

  def testDecodeObjectWeight(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    object_weights = [0.75, 1.0]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/weight':
                      dataset_util.float_list_feature(object_weights),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_weights].get_shape().as_list()),
                          [None])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])

    self.assertAllEqual(object_weights,
                        tensor_dict[fields.InputDataFields.groundtruth_weights])

  def testDecodeClassConfidence(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    class_confidence = [0.0, 1.0, 0.0]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/class/confidence':
                      dataset_util.float_list_feature(class_confidence),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual(
          (output[fields.InputDataFields.groundtruth_image_confidences]
           .get_shape().as_list()), [3])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(
        class_confidence,
        tensor_dict[fields.InputDataFields.groundtruth_image_confidences])

  def testDecodeInstanceSegmentation(self):
    num_instances = 4
    image_height = 5
    image_width = 3

    # Randomly generate image.
    image_tensor = np.random.randint(
        256, size=(image_height, image_width, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')

    # Randomly generate instance segmentation masks.
    instance_masks = (
        np.random.randint(2, size=(num_instances, image_height,
                                   image_width)).astype(np.float32))
    instance_masks_flattened = np.reshape(instance_masks, [-1])

    # Randomly generate class labels for each instance.
    object_classes = np.random.randint(
        100, size=(num_instances)).astype(np.int64)

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/height':
                      dataset_util.int64_feature(image_height),
                  'image/width':
                      dataset_util.int64_feature(image_width),
                  'image/object/mask':
                      dataset_util.float_list_feature(instance_masks_flattened),
                  'image/object/class/label':
                      dataset_util.int64_list_feature(object_classes)
              })).SerializeToString()
      example_decoder = tf_example_decoder.TfExampleDecoder(
          load_instance_masks=True)
      output = example_decoder.decode(tf.convert_to_tensor(example))

      self.assertAllEqual(
          (output[fields.InputDataFields.groundtruth_instance_masks].get_shape(
          ).as_list()), [4, 5, 3])

      self.assertAllEqual((output[
          fields.InputDataFields.groundtruth_classes].get_shape().as_list()),
                          [4])
      return output

    tensor_dict = self.execute_cpu(graph_fn, [])

    self.assertAllEqual(
        instance_masks.astype(np.float32),
        tensor_dict[fields.InputDataFields.groundtruth_instance_masks])
    self.assertAllEqual(object_classes,
                        tensor_dict[fields.InputDataFields.groundtruth_classes])

  def testInstancesNotAvailableByDefault(self):
    num_instances = 4
    image_height = 5
    image_width = 3
    # Randomly generate image.
    image_tensor = np.random.randint(
        256, size=(image_height, image_width, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')

    # Randomly generate instance segmentation masks.
    instance_masks = (
        np.random.randint(2, size=(num_instances, image_height,
                                   image_width)).astype(np.float32))
    instance_masks_flattened = np.reshape(instance_masks, [-1])

    # Randomly generate class labels for each instance.
    object_classes = np.random.randint(
        100, size=(num_instances)).astype(np.int64)

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/height':
                      dataset_util.int64_feature(image_height),
                  'image/width':
                      dataset_util.int64_feature(image_width),
                  'image/object/mask':
                      dataset_util.float_list_feature(instance_masks_flattened),
                  'image/object/class/label':
                      dataset_util.int64_list_feature(object_classes)
              })).SerializeToString()
      example_decoder = tf_example_decoder.TfExampleDecoder()
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertNotIn(fields.InputDataFields.groundtruth_instance_masks,
                     tensor_dict)

  def testDecodeImageLabels(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')

    def graph_fn_1():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded': dataset_util.bytes_feature(encoded_jpeg),
                  'image/format': dataset_util.bytes_feature(six.b('jpeg')),
                  'image/class/label': dataset_util.int64_list_feature([1, 2]),
              })).SerializeToString()
      example_decoder = tf_example_decoder.TfExampleDecoder()
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn_1, [])
    self.assertIn(fields.InputDataFields.groundtruth_image_classes, tensor_dict)
    self.assertAllEqual(
        tensor_dict[fields.InputDataFields.groundtruth_image_classes],
        np.array([1, 2]))

    def graph_fn_2():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/class/text':
                      dataset_util.bytes_list_feature(
                          [six.b('dog'), six.b('cat')]),
              })).SerializeToString()
      label_map_string = """
        item {
          id:3
          name:'cat'
        }
        item {
          id:1
          name:'dog'
        }
      """
      label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
      with tf.gfile.Open(label_map_path, 'wb') as f:
        f.write(label_map_string)
      example_decoder = tf_example_decoder.TfExampleDecoder(
          label_map_proto_file=label_map_path)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn_2, [])
    self.assertIn(fields.InputDataFields.groundtruth_image_classes, tensor_dict)
    self.assertAllEqual(
        tensor_dict[fields.InputDataFields.groundtruth_image_classes],
        np.array([1, 3]))

  def testDecodeContextFeatures(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]
    num_features = 8
    context_feature_length = 10
    context_features = np.random.random(num_features*context_feature_length)

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/context_features':
                      dataset_util.float_list_feature(context_features),
                  'image/context_feature_length':
                      dataset_util.int64_feature(context_feature_length),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          load_context_features=True)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertAllClose(
        context_features.reshape(num_features, context_feature_length),
        tensor_dict[fields.InputDataFields.context_features])
    self.assertAllEqual(
        context_feature_length,
        tensor_dict[fields.InputDataFields.context_feature_length])

  def testContextFeaturesNotAvailableByDefault(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]
    num_features = 10
    context_feature_length = 10
    context_features = np.random.random(num_features*context_feature_length)

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/context_features':
                      dataset_util.float_list_feature(context_features),
                  'image/context_feature_length':
                      dataset_util.int64_feature(context_feature_length),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder()
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])
    self.assertNotIn(fields.InputDataFields.context_features,
                     tensor_dict)

  def testExpandLabels(self):
    label_map_string = """
      item {
        id:1
        name:'cat'
        ancestor_ids: 2
      }
      item {
        id:2
        name:'animal'
        descendant_ids: 1
      }
      item {
        id:3
        name:'man'
        ancestor_ids: 5
      }
      item {
        id:4
        name:'woman'
        display_name:'woman'
        ancestor_ids: 5
      }
      item {
        id:5
        name:'person'
        descendant_ids: 3
        descendant_ids: 4
      }
    """

    label_map_path = os.path.join(self.get_temp_dir(), 'label_map.pbtxt')
    with tf.gfile.Open(label_map_path, 'wb') as f:
      f.write(label_map_string)
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0]
    bbox_xmins = [1.0, 5.0]
    bbox_ymaxs = [2.0, 6.0]
    bbox_xmaxs = [3.0, 7.0]
    bbox_classes_text = [six.b('cat'), six.b('cat')]
    bbox_group_of = [0, 1]
    image_class_text = [six.b('cat'), six.b('person')]
    image_confidence = [1.0, 0.0]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
                  'image/object/class/text':
                      dataset_util.bytes_list_feature(bbox_classes_text),
                  'image/object/group_of':
                      dataset_util.int64_list_feature(bbox_group_of),
                  'image/class/text':
                      dataset_util.bytes_list_feature(image_class_text),
                  'image/class/confidence':
                      dataset_util.float_list_feature(image_confidence),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          label_map_proto_file=label_map_path, expand_hierarchy_labels=True)
      return example_decoder.decode(tf.convert_to_tensor(example))

    tensor_dict = self.execute_cpu(graph_fn, [])

    boxes = np.vstack([bbox_ymins, bbox_xmins, bbox_ymaxs,
                       bbox_xmaxs]).transpose()
    expected_boxes = np.stack(
        [boxes[0, :], boxes[0, :], boxes[1, :], boxes[1, :]], axis=0)
    expected_boxes_class = np.array([1, 2, 1, 2])
    expected_boxes_group_of = np.array([0, 0, 1, 1])
    expected_image_class = np.array([1, 2, 3, 4, 5])
    expected_image_confidence = np.array([1.0, 1.0, 0.0, 0.0, 0.0])
    self.assertAllEqual(expected_boxes,
                        tensor_dict[fields.InputDataFields.groundtruth_boxes])
    self.assertAllEqual(expected_boxes_class,
                        tensor_dict[fields.InputDataFields.groundtruth_classes])
    self.assertAllEqual(
        expected_boxes_group_of,
        tensor_dict[fields.InputDataFields.groundtruth_group_of])
    self.assertAllEqual(
        expected_image_class,
        tensor_dict[fields.InputDataFields.groundtruth_image_classes])
    self.assertAllEqual(
        expected_image_confidence,
        tensor_dict[fields.InputDataFields.groundtruth_image_confidences])

  def testDecodeDensePose(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0, 2.0]
    bbox_xmins = [1.0, 5.0, 8.0]
    bbox_ymaxs = [2.0, 6.0, 1.0]
    bbox_xmaxs = [3.0, 7.0, 3.3]
    densepose_num = [0, 4, 2]
    densepose_part_index = [2, 2, 3, 4, 2, 9]
    densepose_x = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
    densepose_y = [0.9, 0.8, 0.7, 0.6, 0.5, 0.4]
    densepose_u = [0.01, 0.02, 0.03, 0.04, 0.05, 0.06]
    densepose_v = [0.99, 0.98, 0.97, 0.96, 0.95, 0.94]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
                  'image/object/densepose/num':
                      dataset_util.int64_list_feature(densepose_num),
                  'image/object/densepose/part_index':
                      dataset_util.int64_list_feature(densepose_part_index),
                  'image/object/densepose/x':
                      dataset_util.float_list_feature(densepose_x),
                  'image/object/densepose/y':
                      dataset_util.float_list_feature(densepose_y),
                  'image/object/densepose/u':
                      dataset_util.float_list_feature(densepose_u),
                  'image/object/densepose/v':
                      dataset_util.float_list_feature(densepose_v),

              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          load_dense_pose=True)
      output = example_decoder.decode(tf.convert_to_tensor(example))
      dp_num_points = output[fields.InputDataFields.groundtruth_dp_num_points]
      dp_part_ids = output[fields.InputDataFields.groundtruth_dp_part_ids]
      dp_surface_coords = output[
          fields.InputDataFields.groundtruth_dp_surface_coords]
      return dp_num_points, dp_part_ids, dp_surface_coords

    dp_num_points, dp_part_ids, dp_surface_coords = self.execute_cpu(
        graph_fn, [])

    expected_dp_num_points = [0, 4, 2]
    expected_dp_part_ids = [
        [0, 0, 0, 0],
        [2, 2, 3, 4],
        [2, 9, 0, 0]
    ]
    expected_dp_surface_coords = np.array(
        [
            # Instance 0 (no points).
            [[0., 0., 0., 0.],
             [0., 0., 0., 0.],
             [0., 0., 0., 0.],
             [0., 0., 0., 0.]],
            # Instance 1 (4 points).
            [[0.9, 0.1, 0.99, 0.01],
             [0.8, 0.2, 0.98, 0.02],
             [0.7, 0.3, 0.97, 0.03],
             [0.6, 0.4, 0.96, 0.04]],
            # Instance 2 (2 points).
            [[0.5, 0.5, 0.95, 0.05],
             [0.4, 0.6, 0.94, 0.06],
             [0., 0., 0., 0.],
             [0., 0., 0., 0.]],
        ], dtype=np.float32)

    self.assertAllEqual(dp_num_points, expected_dp_num_points)
    self.assertAllEqual(dp_part_ids, expected_dp_part_ids)
    self.assertAllClose(dp_surface_coords, expected_dp_surface_coords)

  def testDecodeTrack(self):
    image_tensor = np.random.randint(256, size=(4, 5, 3)).astype(np.uint8)
    encoded_jpeg, _ = self._create_encoded_and_decoded_data(
        image_tensor, 'jpeg')
    bbox_ymins = [0.0, 4.0, 2.0]
    bbox_xmins = [1.0, 5.0, 8.0]
    bbox_ymaxs = [2.0, 6.0, 1.0]
    bbox_xmaxs = [3.0, 7.0, 3.3]
    track_labels = [0, 1, 2]

    def graph_fn():
      example = tf.train.Example(
          features=tf.train.Features(
              feature={
                  'image/encoded':
                      dataset_util.bytes_feature(encoded_jpeg),
                  'image/format':
                      dataset_util.bytes_feature(six.b('jpeg')),
                  'image/object/bbox/ymin':
                      dataset_util.float_list_feature(bbox_ymins),
                  'image/object/bbox/xmin':
                      dataset_util.float_list_feature(bbox_xmins),
                  'image/object/bbox/ymax':
                      dataset_util.float_list_feature(bbox_ymaxs),
                  'image/object/bbox/xmax':
                      dataset_util.float_list_feature(bbox_xmaxs),
                  'image/object/track/label':
                      dataset_util.int64_list_feature(track_labels),
              })).SerializeToString()

      example_decoder = tf_example_decoder.TfExampleDecoder(
          load_track_id=True)
      output = example_decoder.decode(tf.convert_to_tensor(example))
      track_ids = output[fields.InputDataFields.groundtruth_track_ids]
      return track_ids

    track_ids = self.execute_cpu(graph_fn, [])

    expected_track_labels = [0, 1, 2]

    self.assertAllEqual(track_ids, expected_track_labels)


if __name__ == '__main__':
  tf.test.main()

[((1650, 2, 1650, 16), 'tensorflow.compat.v1.test.main', 'tf.test.main', ({}, {}), '()', True, 'import tensorflow.compat.v1 as tf\n'), ((183, 20, 183, 60), 'numpy.stack', 'np.stack', ({(183, 29, 183, 59): '[decoded_png_1, decoded_png_2]'}, {}), '([decoded_png_1, decoded_png_2])', True, 'import numpy as np\n'), ((518, 26, 518, 41), 'numpy.ones', 'np.ones', ({(518, 34, 518, 40): '(2, 3)'}, {}), '((2, 3))', True, 'import numpy as np\n'), ((1187, 31, 1187, 63), 'numpy.reshape', 'np.reshape', ({(1187, 42, 1187, 56): 'instance_masks', (1187, 58, 1187, 62): '[-1]'}, {}), '(instance_masks, [-1])', True, 'import numpy as np\n'), ((1245, 31, 1245, 63), 'numpy.reshape', 'np.reshape', ({(1245, 42, 1245, 56): 'instance_masks', (1245, 58, 1245, 62): '[-1]'}, {}), '(instance_masks, [-1])', True, 'import numpy as np\n'), ((1342, 23, 1342, 76), 'numpy.random.random', 'np.random.random', ({(1342, 40, 1342, 75): 'num_features * context_feature_length'}, {}), '(num_features * context_feature_length)', True, 'import numpy as np\n'), ((1388, 23, 1388, 76), 'numpy.random.random', 'np.random.random', ({(1388, 40, 1388, 75): 'num_features * context_feature_length'}, {}), '(num_features * context_feature_length)', True, 'import numpy as np\n'), ((1499, 21, 1500, 69), 'numpy.stack', 'np.stack', (), '', True, 'import numpy as np\n'), ((1501, 27, 1501, 49), 'numpy.array', 'np.array', ({(1501, 36, 1501, 48): '[1, 2, 1, 2]'}, {}), '([1, 2, 1, 2])', True, 'import numpy as np\n'), ((1502, 30, 1502, 52), 'numpy.array', 'np.array', ({(1502, 39, 1502, 51): '[0, 0, 1, 1]'}, {}), '([0, 0, 1, 1])', True, 'import numpy as np\n'), ((1503, 27, 1503, 52), 'numpy.array', 'np.array', ({(1503, 36, 1503, 51): '[1, 2, 3, 4, 5]'}, {}), '([1, 2, 3, 4, 5])', True, 'import numpy as np\n'), ((1504, 32, 1504, 67), 'numpy.array', 'np.array', ({(1504, 41, 1504, 66): '[1.0, 1.0, 0.0, 0.0, 0.0]'}, {}), '([1.0, 1.0, 0.0, 0.0, 0.0])', True, 'import numpy as np\n'), ((1583, 33, 1600, 28), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((72, 24, 73, 36), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((78, 8, 78, 64), 'numpy.concatenate', 'np.concatenate', (), '', True, 'import numpy as np\n'), ((98, 24, 98, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((113, 8, 113, 25), 'six.b', 'six.b', ({(113, 14, 113, 24): '"""image_id"""'}, {}), "('image_id')", False, 'import six\n'), ((131, 24, 131, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((135, 21, 135, 33), 'six.b', 'six.b', ({(135, 27, 135, 32): '"""abc"""'}, {}), "('abc')", False, 'import six\n'), ((137, 8, 137, 25), 'six.b', 'six.b', ({(137, 14, 137, 24): '"""filename"""'}, {}), "('filename')", False, 'import six\n'), ((156, 24, 156, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((171, 8, 171, 25), 'six.b', 'six.b', ({(171, 14, 171, 24): '"""image_id"""'}, {}), "('image_id')", False, 'import six\n'), ((197, 24, 199, 56), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((228, 24, 230, 56), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((265, 24, 265, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((320, 24, 321, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((380, 24, 381, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((432, 24, 432, 76), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((495, 24, 495, 76), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((550, 24, 550, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((560, 24, 560, 52), 'numpy.ones', 'np.ones', (), '', True, 'import numpy as np\n'), ((580, 24, 580, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((624, 24, 625, 38), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((659, 24, 660, 38), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((698, 24, 699, 46), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((716, 25, 716, 37), 'six.b', 'six.b', ({(716, 31, 716, 36): '"""cat"""'}, {}), "('cat')", False, 'import six\n'), ((716, 39, 716, 51), 'six.b', 'six.b', ({(716, 45, 716, 50): '"""dog"""'}, {}), "('dog')", False, 'import six\n'), ((748, 24, 749, 46), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((761, 25, 761, 37), 'six.b', 'six.b', ({(761, 31, 761, 36): '"""cat"""'}, {}), "('cat')", False, 'import six\n'), ((761, 39, 761, 55), 'six.b', 'six.b', ({(761, 45, 761, 54): '"""cheetah"""'}, {}), "('cheetah')", False, 'import six\n'), ((788, 24, 789, 46), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((804, 25, 804, 37), 'six.b', 'six.b', ({(804, 31, 804, 36): '"""cat"""'}, {}), "('cat')", False, 'import six\n'), ((804, 39, 804, 51), 'six.b', 'six.b', ({(804, 45, 804, 50): '"""dog"""'}, {}), "('dog')", False, 'import six\n'), ((831, 24, 832, 46), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((848, 25, 848, 37), 'six.b', 'six.b', ({(848, 31, 848, 36): '"""cat"""'}, {}), "('cat')", False, 'import six\n'), ((848, 39, 848, 55), 'six.b', 'six.b', ({(848, 45, 848, 54): '"""cheetah"""'}, {}), "('cheetah')", False, 'import six\n'), ((880, 24, 881, 46), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((892, 25, 892, 37), 'six.b', 'six.b', ({(892, 31, 892, 36): '"""cat"""'}, {}), "('cat')", False, 'import six\n'), ((892, 39, 892, 51), 'six.b', 'six.b', ({(892, 45, 892, 50): '"""dog"""'}, {}), "('dog')", False, 'import six\n'), ((919, 24, 920, 46), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((950, 24, 950, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((980, 24, 980, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1008, 24, 1008, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1035, 24, 1035, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1066, 24, 1066, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1097, 24, 1097, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1128, 24, 1128, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1159, 24, 1159, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1210, 24, 1211, 35), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1268, 24, 1268, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1288, 24, 1288, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1295, 8, 1295, 24), 'numpy.array', 'np.array', ({(1295, 17, 1295, 23): '[1, 2]'}, {}), '([1, 2])', True, 'import numpy as np\n'), ((1322, 24, 1323, 46), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1330, 8, 1330, 24), 'numpy.array', 'np.array', ({(1330, 17, 1330, 23): '[1, 3]'}, {}), '([1, 3])', True, 'import numpy as np\n'), ((1366, 24, 1367, 37), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1412, 24, 1412, 61), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', ({}, {}), '()', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1451, 9, 1451, 44), 'tensorflow.compat.v1.gfile.Open', 'tf.gfile.Open', ({(1451, 23, 1451, 37): 'label_map_path', (1451, 39, 1451, 43): '"""wb"""'}, {}), "(label_map_path, 'wb')", True, 'import tensorflow.compat.v1 as tf\n'), ((1460, 25, 1460, 37), 'six.b', 'six.b', ({(1460, 31, 1460, 36): '"""cat"""'}, {}), "('cat')", False, 'import six\n'), ((1460, 39, 1460, 51), 'six.b', 'six.b', ({(1460, 45, 1460, 50): '"""cat"""'}, {}), "('cat')", False, 'import six\n'), ((1462, 24, 1462, 36), 'six.b', 'six.b', ({(1462, 30, 1462, 35): '"""cat"""'}, {}), "('cat')", False, 'import six\n'), ((1462, 38, 1462, 53), 'six.b', 'six.b', ({(1462, 44, 1462, 52): '"""person"""'}, {}), "('person')", False, 'import six\n'), ((1491, 24, 1492, 76), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1565, 24, 1566, 31), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((1636, 24, 1637, 29), 'object_detection.data_decoders.tf_example_decoder.TfExampleDecoder', 'tf_example_decoder.TfExampleDecoder', (), '', False, 'from object_detection.data_decoders import tf_example_decoder\n'), ((49, 12, 49, 50), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((52, 25, 52, 63), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((74, 36, 74, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(74, 57, 74, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((82, 12, 82, 50), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((99, 38, 99, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(99, 59, 99, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((116, 12, 116, 50), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((132, 36, 132, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(132, 57, 132, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((140, 12, 140, 50), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((157, 38, 157, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(157, 59, 157, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((174, 12, 174, 50), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((176, 13, 176, 54), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((177, 13, 177, 54), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((200, 36, 200, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(200, 57, 200, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((208, 19, 208, 59), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((231, 36, 231, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(231, 57, 231, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((239, 19, 239, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((266, 38, 266, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(266, 59, 266, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((273, 21, 274, 44), 'numpy.vstack', 'np.vstack', ({(273, 31, 274, 43): '[bbox_ymins, bbox_xmins, bbox_ymaxs, bbox_xmaxs]'}, {}), '([bbox_ymins, bbox_xmins, bbox_ymaxs, bbox_xmaxs])', True, 'import numpy as np\n'), ((279, 19, 279, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((322, 38, 322, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(322, 59, 322, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((345, 19, 345, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((382, 38, 382, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(382, 59, 382, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((397, 19, 397, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((433, 38, 433, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(433, 59, 433, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((444, 21, 445, 44), 'numpy.vstack', 'np.vstack', ({(444, 31, 445, 43): '[bbox_ymins, bbox_xmins, bbox_ymaxs, bbox_xmaxs]'}, {}), '([bbox_ymins, bbox_xmins, bbox_ymaxs, bbox_xmaxs])', True, 'import numpy as np\n'), ((463, 19, 463, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((496, 38, 496, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(496, 59, 496, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((507, 21, 508, 44), 'numpy.vstack', 'np.vstack', ({(507, 31, 508, 43): '[bbox_ymins, bbox_xmins, bbox_ymaxs, bbox_xmaxs]'}, {}), '([bbox_ymins, bbox_xmins, bbox_ymaxs, bbox_xmaxs])', True, 'import numpy as np\n'), ((524, 19, 524, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((551, 38, 551, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(551, 59, 551, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((563, 19, 563, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((581, 38, 581, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(581, 59, 581, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((594, 19, 594, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((626, 36, 626, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(626, 57, 626, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((633, 19, 633, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((661, 36, 661, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(661, 57, 661, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((668, 19, 668, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((695, 11, 695, 46), 'tensorflow.compat.v1.gfile.Open', 'tf.gfile.Open', ({(695, 25, 695, 39): 'label_map_path', (695, 41, 695, 45): '"""wb"""'}, {}), "(label_map_path, 'wb')", True, 'import tensorflow.compat.v1 as tf\n'), ((700, 38, 700, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(700, 59, 700, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((713, 19, 713, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((745, 11, 745, 46), 'tensorflow.compat.v1.gfile.Open', 'tf.gfile.Open', ({(745, 25, 745, 39): 'label_map_path', (745, 41, 745, 45): '"""wb"""'}, {}), "(label_map_path, 'wb')", True, 'import tensorflow.compat.v1 as tf\n'), ((750, 36, 750, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(750, 57, 750, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((758, 19, 758, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((786, 11, 786, 46), 'tensorflow.compat.v1.gfile.Open', 'tf.gfile.Open', ({(786, 25, 786, 39): 'label_map_path', (786, 41, 786, 45): '"""wb"""'}, {}), "(label_map_path, 'wb')", True, 'import tensorflow.compat.v1 as tf\n'), ((790, 38, 790, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(790, 59, 790, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((801, 19, 801, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((829, 11, 829, 46), 'tensorflow.compat.v1.gfile.Open', 'tf.gfile.Open', ({(829, 25, 829, 39): 'label_map_path', (829, 41, 829, 45): '"""wb"""'}, {}), "(label_map_path, 'wb')", True, 'import tensorflow.compat.v1 as tf\n'), ((833, 38, 833, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(833, 59, 833, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((845, 19, 845, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((878, 11, 878, 46), 'tensorflow.compat.v1.gfile.Open', 'tf.gfile.Open', ({(878, 25, 878, 39): 'label_map_path', (878, 41, 878, 45): '"""wb"""'}, {}), "(label_map_path, 'wb')", True, 'import tensorflow.compat.v1 as tf\n'), ((882, 36, 882, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(882, 57, 882, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((889, 19, 889, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((917, 11, 917, 46), 'tensorflow.compat.v1.gfile.Open', 'tf.gfile.Open', ({(917, 25, 917, 39): 'label_map_path', (917, 41, 917, 45): '"""wb"""'}, {}), "(label_map_path, 'wb')", True, 'import tensorflow.compat.v1 as tf\n'), ((921, 38, 921, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(921, 59, 921, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((933, 19, 933, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((951, 38, 951, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(951, 59, 951, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((963, 19, 963, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((981, 38, 981, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(981, 59, 981, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((990, 19, 990, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1009, 38, 1009, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1009, 59, 1009, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1018, 19, 1018, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1036, 38, 1036, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1036, 59, 1036, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1049, 19, 1049, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1067, 38, 1067, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1067, 59, 1067, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1080, 19, 1080, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1098, 38, 1098, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1098, 59, 1098, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1111, 19, 1111, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1129, 38, 1129, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1129, 59, 1129, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1142, 19, 1142, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1160, 38, 1160, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1160, 59, 1160, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1178, 19, 1179, 49), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1185, 8, 1186, 48), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1190, 21, 1191, 34), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1212, 38, 1212, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1212, 59, 1212, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1236, 19, 1237, 49), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1243, 8, 1244, 48), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1248, 21, 1249, 34), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1269, 36, 1269, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1269, 57, 1269, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1276, 19, 1276, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1289, 36, 1289, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1289, 57, 1289, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1320, 11, 1320, 46), 'tensorflow.compat.v1.gfile.Open', 'tf.gfile.Open', ({(1320, 25, 1320, 39): 'label_map_path', (1320, 41, 1320, 45): '"""wb"""'}, {}), "(label_map_path, 'wb')", True, 'import tensorflow.compat.v1 as tf\n'), ((1324, 36, 1324, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1324, 57, 1324, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1333, 19, 1333, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1368, 36, 1368, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1368, 57, 1368, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1379, 19, 1379, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1413, 36, 1413, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1413, 57, 1413, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1453, 19, 1453, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1493, 36, 1493, 65), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1493, 57, 1493, 64): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1497, 12, 1498, 35), 'numpy.vstack', 'np.vstack', ({(1497, 22, 1498, 34): '[bbox_ymins, bbox_xmins, bbox_ymaxs, bbox_xmaxs]'}, {}), '([bbox_ymins, bbox_xmins, bbox_ymaxs, bbox_xmaxs])', True, 'import numpy as np\n'), ((1520, 19, 1520, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1567, 38, 1567, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1567, 59, 1567, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((1607, 19, 1607, 57), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((1638, 38, 1638, 67), 'tensorflow.compat.v1.convert_to_tensor', 'tf.convert_to_tensor', ({(1638, 59, 1638, 66): 'example'}, {}), '(example)', True, 'import tensorflow.compat.v1 as tf\n'), ((457, 9, 457, 38), 'numpy.array', 'np.array', ({(457, 18, 457, 37): 'keypoint_visibility'}, {}), '(keypoint_visibility)', True, 'import numpy as np\n'), ((513, 8, 513, 45), 'numpy.vstack', 'np.vstack', ({(513, 18, 513, 44): '[keypoint_ys, keypoint_xs]'}, {}), '([keypoint_ys, keypoint_xs])', True, 'import numpy as np\n'), ((62, 22, 62, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(62, 49, 62, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((64, 22, 65, 59), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(65, 26, 65, 58): '[encoded_additional_channel] * 2'}, {}), '([encoded_additional_channel] * 2)', False, 'from object_detection.utils import dataset_util\n'), ((91, 22, 91, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(91, 49, 91, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((124, 22, 124, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(124, 49, 124, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((149, 22, 149, 61), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(149, 49, 149, 60): 'encoded_png'}, {}), '(encoded_png)', False, 'from object_detection.utils import dataset_util\n'), ((190, 22, 190, 61), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(190, 49, 190, 60): 'encoded_png'}, {}), '(encoded_png)', False, 'from object_detection.utils import dataset_util\n'), ((194, 22, 194, 68), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(194, 54, 194, 67): 'encoded_masks'}, {}), '(encoded_masks)', False, 'from object_detection.utils import dataset_util\n'), ((217, 22, 217, 61), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(217, 49, 217, 60): 'encoded_png'}, {}), '(encoded_png)', False, 'from object_detection.utils import dataset_util\n'), ((221, 22, 221, 68), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(221, 54, 221, 67): 'encoded_masks'}, {}), '(encoded_masks)', False, 'from object_detection.utils import dataset_util\n'), ((223, 22, 223, 52), 'object_detection.utils.dataset_util.int64_feature', 'dataset_util.int64_feature', ({(223, 49, 223, 51): '10'}, {}), '(10)', False, 'from object_detection.utils import dataset_util\n'), ((225, 22, 225, 52), 'object_detection.utils.dataset_util.int64_feature', 'dataset_util.int64_feature', ({(225, 49, 225, 51): '10'}, {}), '(10)', False, 'from object_detection.utils import dataset_util\n'), ((252, 22, 252, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(252, 49, 252, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((256, 22, 256, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(256, 54, 256, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((258, 22, 258, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(258, 54, 258, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((260, 22, 260, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(260, 54, 260, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((262, 22, 262, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(262, 54, 262, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((297, 22, 297, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(297, 49, 297, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((301, 22, 301, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(301, 54, 301, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((303, 22, 303, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(303, 54, 303, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((305, 22, 305, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(305, 54, 305, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((307, 22, 307, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(307, 54, 307, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((309, 22, 309, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(309, 54, 309, 65): 'keypoint_ys'}, {}), '(keypoint_ys)', False, 'from object_detection.utils import dataset_util\n'), ((311, 22, 311, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(311, 54, 311, 65): 'keypoint_xs'}, {}), '(keypoint_xs)', False, 'from object_detection.utils import dataset_util\n'), ((313, 22, 313, 70), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(313, 54, 313, 69): 'keypoint_depths'}, {}), '(keypoint_depths)', False, 'from object_detection.utils import dataset_util\n'), ((315, 22, 315, 77), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(315, 54, 315, 76): 'keypoint_depth_weights'}, {}), '(keypoint_depth_weights)', False, 'from object_detection.utils import dataset_util\n'), ((317, 22, 317, 74), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(317, 54, 317, 73): 'keypoint_visibility'}, {}), '(keypoint_visibility)', False, 'from object_detection.utils import dataset_util\n'), ((361, 22, 361, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(361, 49, 361, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((365, 22, 365, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(365, 54, 365, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((367, 22, 367, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(367, 54, 367, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((369, 22, 369, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(369, 54, 369, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((371, 22, 371, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(371, 54, 371, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((373, 22, 373, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(373, 54, 373, 65): 'keypoint_ys'}, {}), '(keypoint_ys)', False, 'from object_detection.utils import dataset_util\n'), ((375, 22, 375, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(375, 54, 375, 65): 'keypoint_xs'}, {}), '(keypoint_xs)', False, 'from object_detection.utils import dataset_util\n'), ((377, 22, 377, 74), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(377, 54, 377, 73): 'keypoint_visibility'}, {}), '(keypoint_visibility)', False, 'from object_detection.utils import dataset_util\n'), ((413, 22, 413, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(413, 49, 413, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((417, 22, 417, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(417, 54, 417, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((419, 22, 419, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(419, 54, 419, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((421, 22, 421, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(421, 54, 421, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((423, 22, 423, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(423, 54, 423, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((425, 22, 425, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(425, 54, 425, 65): 'keypoint_ys'}, {}), '(keypoint_ys)', False, 'from object_detection.utils import dataset_util\n'), ((427, 22, 427, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(427, 54, 427, 65): 'keypoint_xs'}, {}), '(keypoint_xs)', False, 'from object_detection.utils import dataset_util\n'), ((429, 22, 429, 74), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(429, 54, 429, 73): 'keypoint_visibility'}, {}), '(keypoint_visibility)', False, 'from object_detection.utils import dataset_util\n'), ((478, 22, 478, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(478, 49, 478, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((482, 22, 482, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(482, 54, 482, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((484, 22, 484, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(484, 54, 484, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((486, 22, 486, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(486, 54, 486, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((488, 22, 488, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(488, 54, 488, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((490, 22, 490, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(490, 54, 490, 65): 'keypoint_ys'}, {}), '(keypoint_ys)', False, 'from object_detection.utils import dataset_util\n'), ((492, 22, 492, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(492, 54, 492, 65): 'keypoint_xs'}, {}), '(keypoint_xs)', False, 'from object_detection.utils import dataset_util\n'), ((537, 22, 537, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(537, 49, 537, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((541, 22, 541, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(541, 54, 541, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((543, 22, 543, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(543, 54, 543, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((545, 22, 545, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(545, 54, 545, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((547, 22, 547, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(547, 54, 547, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((573, 22, 573, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(573, 49, 573, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((577, 22, 577, 67), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(577, 54, 577, 66): 'bbox_classes'}, {}), '(bbox_classes)', False, 'from object_detection.utils import dataset_util\n'), ((608, 22, 608, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(608, 49, 608, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((612, 22, 613, 54), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(613, 26, 613, 53): 'flattened_multiclass_scores'}, {}), '(flattened_multiclass_scores)', False, 'from object_detection.utils import dataset_util\n'), ((615, 22, 615, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(615, 54, 615, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((617, 22, 617, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(617, 54, 617, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((619, 22, 619, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(619, 54, 619, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((621, 22, 621, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(621, 54, 621, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((646, 22, 646, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(646, 49, 646, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((650, 22, 650, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(650, 54, 650, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((652, 22, 652, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(652, 54, 652, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((654, 22, 654, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(654, 54, 654, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((656, 22, 656, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(656, 54, 656, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((678, 22, 678, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(678, 49, 678, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((682, 22, 682, 67), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(682, 54, 682, 66): 'bbox_classes'}, {}), '(bbox_classes)', False, 'from object_detection.utils import dataset_util\n'), ((726, 22, 726, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(726, 49, 726, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((730, 22, 730, 72), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(730, 54, 730, 71): 'bbox_classes_text'}, {}), '(bbox_classes_text)', False, 'from object_detection.utils import dataset_util\n'), ((732, 22, 732, 77), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(732, 54, 732, 76): 'annotated_bbox_classes'}, {}), '(annotated_bbox_classes)', False, 'from object_detection.utils import dataset_util\n'), ((768, 22, 768, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(768, 49, 768, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((772, 22, 772, 72), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(772, 54, 772, 71): 'bbox_classes_text'}, {}), '(bbox_classes_text)', False, 'from object_detection.utils import dataset_util\n'), ((811, 22, 811, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(811, 49, 811, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((815, 22, 815, 72), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(815, 54, 815, 71): 'bbox_classes_text'}, {}), '(bbox_classes_text)', False, 'from object_detection.utils import dataset_util\n'), ((856, 22, 856, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(856, 49, 856, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((860, 22, 860, 72), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(860, 54, 860, 71): 'bbox_classes_text'}, {}), '(bbox_classes_text)', False, 'from object_detection.utils import dataset_util\n'), ((862, 22, 862, 70), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(862, 54, 862, 69): 'bbox_classes_id'}, {}), '(bbox_classes_id)', False, 'from object_detection.utils import dataset_util\n'), ((899, 22, 899, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(899, 49, 899, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((903, 22, 903, 72), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(903, 54, 903, 71): 'bbox_classes_text'}, {}), '(bbox_classes_text)', False, 'from object_detection.utils import dataset_util\n'), ((943, 22, 943, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(943, 49, 943, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((947, 22, 947, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(947, 54, 947, 65): 'object_area'}, {}), '(object_area)', False, 'from object_detection.utils import dataset_util\n'), ((973, 22, 973, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(973, 49, 973, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((977, 22, 977, 71), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(977, 54, 977, 70): 'neg_category_ids'}, {}), '(neg_category_ids)', False, 'from object_detection.utils import dataset_util\n'), ((1000, 22, 1000, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1000, 49, 1000, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1004, 22, 1005, 54), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1005, 26, 1005, 53): 'not_exhaustive_category_ids'}, {}), '(not_exhaustive_category_ids)', False, 'from object_detection.utils import dataset_util\n'), ((1028, 22, 1028, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1028, 49, 1028, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1032, 22, 1032, 70), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1032, 54, 1032, 69): 'object_is_crowd'}, {}), '(object_is_crowd)', False, 'from object_detection.utils import dataset_util\n'), ((1059, 22, 1059, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1059, 49, 1059, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1063, 22, 1063, 71), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1063, 54, 1063, 70): 'object_difficult'}, {}), '(object_difficult)', False, 'from object_detection.utils import dataset_util\n'), ((1090, 22, 1090, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1090, 49, 1090, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1094, 22, 1094, 70), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1094, 54, 1094, 69): 'object_group_of'}, {}), '(object_group_of)', False, 'from object_detection.utils import dataset_util\n'), ((1121, 22, 1121, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1121, 49, 1121, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1125, 22, 1125, 69), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1125, 54, 1125, 68): 'object_weights'}, {}), '(object_weights)', False, 'from object_detection.utils import dataset_util\n'), ((1152, 22, 1152, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1152, 49, 1152, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1156, 22, 1156, 71), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1156, 54, 1156, 70): 'class_confidence'}, {}), '(class_confidence)', False, 'from object_detection.utils import dataset_util\n'), ((1198, 22, 1198, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1198, 49, 1198, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1202, 22, 1202, 62), 'object_detection.utils.dataset_util.int64_feature', 'dataset_util.int64_feature', ({(1202, 49, 1202, 61): 'image_height'}, {}), '(image_height)', False, 'from object_detection.utils import dataset_util\n'), ((1204, 22, 1204, 61), 'object_detection.utils.dataset_util.int64_feature', 'dataset_util.int64_feature', ({(1204, 49, 1204, 60): 'image_width'}, {}), '(image_width)', False, 'from object_detection.utils import dataset_util\n'), ((1206, 22, 1206, 79), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1206, 54, 1206, 78): 'instance_masks_flattened'}, {}), '(instance_masks_flattened)', False, 'from object_detection.utils import dataset_util\n'), ((1208, 22, 1208, 69), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1208, 54, 1208, 68): 'object_classes'}, {}), '(object_classes)', False, 'from object_detection.utils import dataset_util\n'), ((1256, 22, 1256, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1256, 49, 1256, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1260, 22, 1260, 62), 'object_detection.utils.dataset_util.int64_feature', 'dataset_util.int64_feature', ({(1260, 49, 1260, 61): 'image_height'}, {}), '(image_height)', False, 'from object_detection.utils import dataset_util\n'), ((1262, 22, 1262, 61), 'object_detection.utils.dataset_util.int64_feature', 'dataset_util.int64_feature', ({(1262, 49, 1262, 60): 'image_width'}, {}), '(image_width)', False, 'from object_detection.utils import dataset_util\n'), ((1264, 22, 1264, 79), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1264, 54, 1264, 78): 'instance_masks_flattened'}, {}), '(instance_masks_flattened)', False, 'from object_detection.utils import dataset_util\n'), ((1266, 22, 1266, 69), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1266, 54, 1266, 68): 'object_classes'}, {}), '(object_classes)', False, 'from object_detection.utils import dataset_util\n'), ((1284, 35, 1284, 75), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1284, 62, 1284, 74): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1286, 39, 1286, 78), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1286, 71, 1286, 77): '[1, 2]'}, {}), '([1, 2])', False, 'from object_detection.utils import dataset_util\n'), ((1302, 22, 1302, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1302, 49, 1302, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1349, 22, 1349, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1349, 49, 1349, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1353, 22, 1353, 71), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1353, 54, 1353, 70): 'context_features'}, {}), '(context_features)', False, 'from object_detection.utils import dataset_util\n'), ((1355, 22, 1355, 72), 'object_detection.utils.dataset_util.int64_feature', 'dataset_util.int64_feature', ({(1355, 49, 1355, 71): 'context_feature_length'}, {}), '(context_feature_length)', False, 'from object_detection.utils import dataset_util\n'), ((1357, 22, 1357, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1357, 54, 1357, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((1359, 22, 1359, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1359, 54, 1359, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((1361, 22, 1361, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1361, 54, 1361, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1363, 22, 1363, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1363, 54, 1363, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1395, 22, 1395, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1395, 49, 1395, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1399, 22, 1399, 71), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1399, 54, 1399, 70): 'context_features'}, {}), '(context_features)', False, 'from object_detection.utils import dataset_util\n'), ((1401, 22, 1401, 72), 'object_detection.utils.dataset_util.int64_feature', 'dataset_util.int64_feature', ({(1401, 49, 1401, 71): 'context_feature_length'}, {}), '(context_feature_length)', False, 'from object_detection.utils import dataset_util\n'), ((1403, 22, 1403, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1403, 54, 1403, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((1405, 22, 1405, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1405, 54, 1405, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((1407, 22, 1407, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1407, 54, 1407, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1409, 22, 1409, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1409, 54, 1409, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1470, 22, 1470, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1470, 49, 1470, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1474, 22, 1474, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1474, 54, 1474, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((1476, 22, 1476, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1476, 54, 1476, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((1478, 22, 1478, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1478, 54, 1478, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1480, 22, 1480, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1480, 54, 1480, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1482, 22, 1482, 72), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(1482, 54, 1482, 71): 'bbox_classes_text'}, {}), '(bbox_classes_text)', False, 'from object_detection.utils import dataset_util\n'), ((1484, 22, 1484, 68), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1484, 54, 1484, 67): 'bbox_group_of'}, {}), '(bbox_group_of)', False, 'from object_detection.utils import dataset_util\n'), ((1486, 22, 1486, 71), 'object_detection.utils.dataset_util.bytes_list_feature', 'dataset_util.bytes_list_feature', ({(1486, 54, 1486, 70): 'image_class_text'}, {}), '(image_class_text)', False, 'from object_detection.utils import dataset_util\n'), ((1488, 22, 1488, 71), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1488, 54, 1488, 70): 'image_confidence'}, {}), '(image_confidence)', False, 'from object_detection.utils import dataset_util\n'), ((1539, 22, 1539, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1539, 49, 1539, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1543, 22, 1543, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1543, 54, 1543, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((1545, 22, 1545, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1545, 54, 1545, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((1547, 22, 1547, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1547, 54, 1547, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1549, 22, 1549, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1549, 54, 1549, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1551, 22, 1551, 68), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1551, 54, 1551, 67): 'densepose_num'}, {}), '(densepose_num)', False, 'from object_detection.utils import dataset_util\n'), ((1553, 22, 1553, 75), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1553, 54, 1553, 74): 'densepose_part_index'}, {}), '(densepose_part_index)', False, 'from object_detection.utils import dataset_util\n'), ((1555, 22, 1555, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1555, 54, 1555, 65): 'densepose_x'}, {}), '(densepose_x)', False, 'from object_detection.utils import dataset_util\n'), ((1557, 22, 1557, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1557, 54, 1557, 65): 'densepose_y'}, {}), '(densepose_y)', False, 'from object_detection.utils import dataset_util\n'), ((1559, 22, 1559, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1559, 54, 1559, 65): 'densepose_u'}, {}), '(densepose_u)', False, 'from object_detection.utils import dataset_util\n'), ((1561, 22, 1561, 66), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1561, 54, 1561, 65): 'densepose_v'}, {}), '(densepose_v)', False, 'from object_detection.utils import dataset_util\n'), ((1621, 22, 1621, 62), 'object_detection.utils.dataset_util.bytes_feature', 'dataset_util.bytes_feature', ({(1621, 49, 1621, 61): 'encoded_jpeg'}, {}), '(encoded_jpeg)', False, 'from object_detection.utils import dataset_util\n'), ((1625, 22, 1625, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1625, 54, 1625, 64): 'bbox_ymins'}, {}), '(bbox_ymins)', False, 'from object_detection.utils import dataset_util\n'), ((1627, 22, 1627, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1627, 54, 1627, 64): 'bbox_xmins'}, {}), '(bbox_xmins)', False, 'from object_detection.utils import dataset_util\n'), ((1629, 22, 1629, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1629, 54, 1629, 64): 'bbox_ymaxs'}, {}), '(bbox_ymaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1631, 22, 1631, 65), 'object_detection.utils.dataset_util.float_list_feature', 'dataset_util.float_list_feature', ({(1631, 54, 1631, 64): 'bbox_xmaxs'}, {}), '(bbox_xmaxs)', False, 'from object_detection.utils import dataset_util\n'), ((1633, 22, 1633, 67), 'object_detection.utils.dataset_util.int64_list_feature', 'dataset_util.int64_list_feature', ({(1633, 54, 1633, 66): 'track_labels'}, {}), '(track_labels)', False, 'from object_detection.utils import dataset_util\n'), ((67, 49, 67, 62), 'six.b', 'six.b', ({(67, 55, 67, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((69, 49, 69, 66), 'six.b', 'six.b', ({(69, 55, 69, 65): '"""image_id"""'}, {}), "('image_id')", False, 'import six\n'), ((93, 49, 93, 62), 'six.b', 'six.b', ({(93, 55, 93, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((95, 49, 95, 66), 'six.b', 'six.b', ({(95, 55, 95, 65): '"""image_id"""'}, {}), "('image_id')", False, 'import six\n'), ((126, 49, 126, 61), 'six.b', 'six.b', ({(126, 55, 126, 60): '"""abc"""'}, {}), "('abc')", False, 'import six\n'), ((128, 49, 128, 66), 'six.b', 'six.b', ({(128, 55, 128, 65): '"""filename"""'}, {}), "('filename')", False, 'import six\n'), ((151, 49, 151, 61), 'six.b', 'six.b', ({(151, 55, 151, 60): '"""png"""'}, {}), "('png')", False, 'import six\n'), ((153, 49, 153, 66), 'six.b', 'six.b', ({(153, 55, 153, 65): '"""image_id"""'}, {}), "('image_id')", False, 'import six\n'), ((192, 49, 192, 61), 'six.b', 'six.b', ({(192, 55, 192, 60): '"""png"""'}, {}), "('png')", False, 'import six\n'), ((219, 49, 219, 61), 'six.b', 'six.b', ({(219, 55, 219, 60): '"""png"""'}, {}), "('png')", False, 'import six\n'), ((254, 49, 254, 62), 'six.b', 'six.b', ({(254, 55, 254, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((299, 49, 299, 62), 'six.b', 'six.b', ({(299, 55, 299, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((363, 49, 363, 62), 'six.b', 'six.b', ({(363, 55, 363, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((415, 49, 415, 62), 'six.b', 'six.b', ({(415, 55, 415, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((480, 49, 480, 62), 'six.b', 'six.b', ({(480, 55, 480, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((539, 49, 539, 62), 'six.b', 'six.b', ({(539, 55, 539, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((575, 49, 575, 62), 'six.b', 'six.b', ({(575, 55, 575, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((610, 49, 610, 62), 'six.b', 'six.b', ({(610, 55, 610, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((648, 49, 648, 62), 'six.b', 'six.b', ({(648, 55, 648, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((680, 49, 680, 62), 'six.b', 'six.b', ({(680, 55, 680, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((728, 49, 728, 62), 'six.b', 'six.b', ({(728, 55, 728, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((770, 49, 770, 62), 'six.b', 'six.b', ({(770, 55, 770, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((813, 49, 813, 62), 'six.b', 'six.b', ({(813, 55, 813, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((858, 49, 858, 62), 'six.b', 'six.b', ({(858, 55, 858, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((901, 49, 901, 62), 'six.b', 'six.b', ({(901, 55, 901, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((945, 49, 945, 62), 'six.b', 'six.b', ({(945, 55, 945, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((975, 49, 975, 62), 'six.b', 'six.b', ({(975, 55, 975, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1002, 49, 1002, 62), 'six.b', 'six.b', ({(1002, 55, 1002, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1030, 49, 1030, 62), 'six.b', 'six.b', ({(1030, 55, 1030, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1061, 49, 1061, 62), 'six.b', 'six.b', ({(1061, 55, 1061, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1092, 49, 1092, 62), 'six.b', 'six.b', ({(1092, 55, 1092, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1123, 49, 1123, 62), 'six.b', 'six.b', ({(1123, 55, 1123, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1154, 49, 1154, 62), 'six.b', 'six.b', ({(1154, 55, 1154, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1200, 49, 1200, 62), 'six.b', 'six.b', ({(1200, 55, 1200, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1258, 49, 1258, 62), 'six.b', 'six.b', ({(1258, 55, 1258, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1285, 61, 1285, 74), 'six.b', 'six.b', ({(1285, 67, 1285, 73): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1304, 49, 1304, 62), 'six.b', 'six.b', ({(1304, 55, 1304, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1351, 49, 1351, 62), 'six.b', 'six.b', ({(1351, 55, 1351, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1397, 49, 1397, 62), 'six.b', 'six.b', ({(1397, 55, 1397, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1472, 49, 1472, 62), 'six.b', 'six.b', ({(1472, 55, 1472, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1541, 49, 1541, 62), 'six.b', 'six.b', ({(1541, 55, 1541, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1623, 49, 1623, 62), 'six.b', 'six.b', ({(1623, 55, 1623, 61): '"""jpeg"""'}, {}), "('jpeg')", False, 'import six\n'), ((1307, 27, 1307, 39), 'six.b', 'six.b', ({(1307, 33, 1307, 38): '"""dog"""'}, {}), "('dog')", False, 'import six\n'), ((1307, 41, 1307, 53), 'six.b', 'six.b', ({(1307, 47, 1307, 52): '"""cat"""'}, {}), "('cat')", False, 'import six\n')]