当前位置: 首页>>代码示例>>Python>>正文


Python inputs.augment_input_data方法代码示例

本文整理汇总了Python中object_detection.inputs.augment_input_data方法的典型用法代码示例。如果您正苦于以下问题:Python inputs.augment_input_data方法的具体用法?Python inputs.augment_input_data怎么用?Python inputs.augment_input_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object_detection.inputs的用法示例。


在下文中一共展示了inputs.augment_input_data方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_include_masks_in_data_augmentation

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import augment_input_data [as 别名]
def test_include_masks_in_data_augmentation(self):
    data_augmentation_options = [
        (preprocessor.resize_image, {
            'new_height': 20,
            'new_width': 20,
            'method': tf.image.ResizeMethod.NEAREST_NEIGHBOR
        })
    ]
    data_augmentation_fn = functools.partial(
        inputs.augment_input_data,
        data_augmentation_options=data_augmentation_options)
    def graph_fn():
      tensor_dict = {
          fields.InputDataFields.image:
              tf.constant(np.random.rand(10, 10, 3).astype(np.float32)),
          fields.InputDataFields.groundtruth_instance_masks:
              tf.constant(np.zeros([2, 10, 10], np.uint8))
      }
      augmented_tensor_dict = data_augmentation_fn(tensor_dict=tensor_dict)
      return (augmented_tensor_dict[fields.InputDataFields.image],
              augmented_tensor_dict[fields.InputDataFields.
                                    groundtruth_instance_masks])
    image, masks = self.execute_cpu(graph_fn, [])
    self.assertAllEqual(image.shape, [20, 20, 3])
    self.assertAllEqual(masks.shape, [2, 20, 20]) 
开发者ID:tensorflow,项目名称:models,代码行数:27,代码来源:inputs_test.py

示例2: test_apply_image_and_box_augmentation

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import augment_input_data [as 别名]
def test_apply_image_and_box_augmentation(self):
    data_augmentation_options = [
        (preprocessor.resize_image, {
            'new_height': 20,
            'new_width': 20,
            'method': tf.image.ResizeMethod.NEAREST_NEIGHBOR
        }),
        (preprocessor.scale_boxes_to_pixel_coordinates, {}),
    ]
    data_augmentation_fn = functools.partial(
        inputs.augment_input_data,
        data_augmentation_options=data_augmentation_options)
    tensor_dict = {
        fields.InputDataFields.image:
            tf.constant(np.random.rand(10, 10, 3).astype(np.float32)),
        fields.InputDataFields.groundtruth_boxes:
            tf.constant(np.array([[.5, .5, 1., 1.]], np.float32))
    }
    augmented_tensor_dict = data_augmentation_fn(tensor_dict=tensor_dict)
    with self.test_session() as sess:
      augmented_tensor_dict_out = sess.run(augmented_tensor_dict)

    self.assertAllEqual(
        augmented_tensor_dict_out[fields.InputDataFields.image].shape,
        [20, 20, 3]
    )
    self.assertAllClose(
        augmented_tensor_dict_out[fields.InputDataFields.groundtruth_boxes],
        [[10, 10, 20, 20]]
    ) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:32,代码来源:inputs_test.py

示例3: test_include_masks_in_data_augmentation

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import augment_input_data [as 别名]
def test_include_masks_in_data_augmentation(self):
    data_augmentation_options = [
        (preprocessor.resize_image, {
            'new_height': 20,
            'new_width': 20,
            'method': tf.image.ResizeMethod.NEAREST_NEIGHBOR
        })
    ]
    data_augmentation_fn = functools.partial(
        inputs.augment_input_data,
        data_augmentation_options=data_augmentation_options)
    tensor_dict = {
        fields.InputDataFields.image:
            tf.constant(np.random.rand(10, 10, 3).astype(np.float32)),
        fields.InputDataFields.groundtruth_instance_masks:
            tf.constant(np.zeros([2, 10, 10], np.uint8))
    }
    augmented_tensor_dict = data_augmentation_fn(tensor_dict=tensor_dict)
    with self.test_session() as sess:
      augmented_tensor_dict_out = sess.run(augmented_tensor_dict)

    self.assertAllEqual(
        augmented_tensor_dict_out[fields.InputDataFields.image].shape,
        [20, 20, 3])
    self.assertAllEqual(augmented_tensor_dict_out[
        fields.InputDataFields.groundtruth_instance_masks].shape, [2, 20, 20]) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:28,代码来源:inputs_test.py

示例4: test_include_keypoints_in_data_augmentation

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import augment_input_data [as 别名]
def test_include_keypoints_in_data_augmentation(self):
    data_augmentation_options = [
        (preprocessor.resize_image, {
            'new_height': 20,
            'new_width': 20,
            'method': tf.image.ResizeMethod.NEAREST_NEIGHBOR
        }),
        (preprocessor.scale_boxes_to_pixel_coordinates, {}),
    ]
    data_augmentation_fn = functools.partial(
        inputs.augment_input_data,
        data_augmentation_options=data_augmentation_options)
    tensor_dict = {
        fields.InputDataFields.image:
            tf.constant(np.random.rand(10, 10, 3).astype(np.float32)),
        fields.InputDataFields.groundtruth_boxes:
            tf.constant(np.array([[.5, .5, 1., 1.]], np.float32)),
        fields.InputDataFields.groundtruth_keypoints:
            tf.constant(np.array([[[0.5, 1.0], [0.5, 0.5]]], np.float32))
    }
    augmented_tensor_dict = data_augmentation_fn(tensor_dict=tensor_dict)
    with self.test_session() as sess:
      augmented_tensor_dict_out = sess.run(augmented_tensor_dict)

    self.assertAllEqual(
        augmented_tensor_dict_out[fields.InputDataFields.image].shape,
        [20, 20, 3]
    )
    self.assertAllClose(
        augmented_tensor_dict_out[fields.InputDataFields.groundtruth_boxes],
        [[10, 10, 20, 20]]
    )
    self.assertAllClose(
        augmented_tensor_dict_out[fields.InputDataFields.groundtruth_keypoints],
        [[[10, 20], [10, 10]]]
    ) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:38,代码来源:inputs_test.py

示例5: test_apply_image_and_box_augmentation

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import augment_input_data [as 别名]
def test_apply_image_and_box_augmentation(self):
        data_augmentation_options = [
            (preprocessor.resize_image, {
                'new_height': 20,
                'new_width': 20,
                'method': tf.image.ResizeMethod.NEAREST_NEIGHBOR
            }),
            (preprocessor.scale_boxes_to_pixel_coordinates, {}),
        ]
        data_augmentation_fn = functools.partial(
            inputs.augment_input_data,
            data_augmentation_options=data_augmentation_options)
        tensor_dict = {
            fields.InputDataFields.image:
                tf.constant(np.random.rand(10, 10, 3).astype(np.float32)),
            fields.InputDataFields.groundtruth_boxes:
                tf.constant(np.array([[.5, .5, 1., 1.]], np.float32))
        }
        augmented_tensor_dict = data_augmentation_fn(tensor_dict=tensor_dict)
        with self.test_session() as sess:
            augmented_tensor_dict_out = sess.run(augmented_tensor_dict)

        self.assertAllEqual(
            augmented_tensor_dict_out[fields.InputDataFields.image].shape,
            [20, 20, 3]
        )
        self.assertAllClose(
            augmented_tensor_dict_out[fields.InputDataFields.groundtruth_boxes],
            [[10, 10, 20, 20]]
        ) 
开发者ID:scorelab,项目名称:Elphas,代码行数:32,代码来源:inputs_test.py

示例6: test_include_masks_in_data_augmentation

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import augment_input_data [as 别名]
def test_include_masks_in_data_augmentation(self):
        data_augmentation_options = [
            (preprocessor.resize_image, {
                'new_height': 20,
                'new_width': 20,
                'method': tf.image.ResizeMethod.NEAREST_NEIGHBOR
            })
        ]
        data_augmentation_fn = functools.partial(
            inputs.augment_input_data,
            data_augmentation_options=data_augmentation_options)
        tensor_dict = {
            fields.InputDataFields.image:
                tf.constant(np.random.rand(10, 10, 3).astype(np.float32)),
            fields.InputDataFields.groundtruth_instance_masks:
                tf.constant(np.zeros([2, 10, 10], np.uint8))
        }
        augmented_tensor_dict = data_augmentation_fn(tensor_dict=tensor_dict)
        with self.test_session() as sess:
            augmented_tensor_dict_out = sess.run(augmented_tensor_dict)

        self.assertAllEqual(
            augmented_tensor_dict_out[fields.InputDataFields.image].shape,
            [20, 20, 3])
        self.assertAllEqual(augmented_tensor_dict_out[
            fields.InputDataFields.groundtruth_instance_masks].shape, [2, 20, 20]) 
开发者ID:scorelab,项目名称:Elphas,代码行数:28,代码来源:inputs_test.py

示例7: test_include_keypoints_in_data_augmentation

# 需要导入模块: from object_detection import inputs [as 别名]
# 或者: from object_detection.inputs import augment_input_data [as 别名]
def test_include_keypoints_in_data_augmentation(self):
        data_augmentation_options = [
            (preprocessor.resize_image, {
                'new_height': 20,
                'new_width': 20,
                'method': tf.image.ResizeMethod.NEAREST_NEIGHBOR
            }),
            (preprocessor.scale_boxes_to_pixel_coordinates, {}),
        ]
        data_augmentation_fn = functools.partial(
            inputs.augment_input_data,
            data_augmentation_options=data_augmentation_options)
        tensor_dict = {
            fields.InputDataFields.image:
                tf.constant(np.random.rand(10, 10, 3).astype(np.float32)),
            fields.InputDataFields.groundtruth_boxes:
                tf.constant(np.array([[.5, .5, 1., 1.]], np.float32)),
            fields.InputDataFields.groundtruth_keypoints:
                tf.constant(np.array([[[0.5, 1.0], [0.5, 0.5]]], np.float32))
        }
        augmented_tensor_dict = data_augmentation_fn(tensor_dict=tensor_dict)
        with self.test_session() as sess:
            augmented_tensor_dict_out = sess.run(augmented_tensor_dict)

        self.assertAllEqual(
            augmented_tensor_dict_out[fields.InputDataFields.image].shape,
            [20, 20, 3]
        )
        self.assertAllClose(
            augmented_tensor_dict_out[fields.InputDataFields.groundtruth_boxes],
            [[10, 10, 20, 20]]
        )
        self.assertAllClose(
            augmented_tensor_dict_out[fields.InputDataFields.groundtruth_keypoints],
            [[[10, 20], [10, 10]]]
        ) 
开发者ID:scorelab,项目名称:Elphas,代码行数:38,代码来源:inputs_test.py


注:本文中的object_detection.inputs.augment_input_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。