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


Python ops.matmul_crop_and_resize方法代码示例

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


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

示例1: testBatchMatMulCropAndResize3x3To2x2_2Channels

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testBatchMatMulCropAndResize3x3To2x2_2Channels(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1, 0], [2, 1], [3, 2]],
                       [[4, 3], [5, 4], [6, 5]],
                       [[7, 6], [8, 7], [9, 8]]],
                      [[[1, 0], [2, 1], [3, 2]],
                       [[4, 3], [5, 4], [6, 5]],
                       [[7, 6], [8, 7], [9, 8]]]], dtype=np.float32)
    boxes = np.array([[[0, 0, 1, 1],
                       [0, 0, .5, .5]],
                      [[1, 1, 0, 0],
                       [.5, .5, 0, 0]]], dtype=np.float32)
    expected_output = [[[[[1, 0], [3, 2]], [[7, 6], [9, 8]]],
                        [[[1, 0], [2, 1]], [[4, 3], [5, 4]]]],
                       [[[[9, 8], [7, 6]], [[3, 2], [1, 0]]],
                        [[[5, 4], [4, 3]], [[2, 1], [1, 0]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:23,代码来源:ops_test.py

示例2: testMatMulCropAndResize2x2To1x1

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize2x2To1x1(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[1, 1])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[[0, 0, 1, 1]]], dtype=np.float32)
    expected_output = [[[[[2.5]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:12,代码来源:ops_test.py

示例3: testMatMulCropAndResize2x2To1x1Flipped

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize2x2To1x1Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[1, 1])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[[1, 1, 0, 0]]], dtype=np.float32)
    expected_output = [[[[[2.5]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:12,代码来源:ops_test.py

示例4: testMatMulCropAndResize2x2To3x3

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize2x2To3x3(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[3, 3])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[[0, 0, 1, 1]]], dtype=np.float32)
    expected_output = [[[[[1.0], [1.5], [2.0]],
                         [[2.0], [2.5], [3.0]],
                         [[3.0], [3.5], [4.0]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:14,代码来源:ops_test.py

示例5: testMatMulCropAndResize2x2To3x3Flipped

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize2x2To3x3Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[3, 3])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[[1, 1, 0, 0]]], dtype=np.float32)
    expected_output = [[[[[4.0], [3.5], [3.0]],
                         [[3.0], [2.5], [2.0]],
                         [[2.0], [1.5], [1.0]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:14,代码来源:ops_test.py

示例6: testMatMulCropAndResize3x3To2x2

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize3x3To2x2(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1], [2], [3]],
                       [[4], [5], [6]],
                       [[7], [8], [9]]]], dtype=np.float32)
    boxes = np.array([[[0, 0, 1, 1],
                       [0, 0, .5, .5]]], dtype=np.float32)
    expected_output = [[[[[1], [3]], [[7], [9]]],
                        [[[1], [2]], [[4], [5]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:16,代码来源:ops_test.py

示例7: testMatMulCropAndResize3x3To2x2Flipped

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize3x3To2x2Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1], [2], [3]],
                       [[4], [5], [6]],
                       [[7], [8], [9]]]], dtype=np.float32)
    boxes = np.array([[[1, 1, 0, 0],
                       [.5, .5, 0, 0]]], dtype=np.float32)
    expected_output = [[[[[9], [7]], [[3], [1]]],
                        [[[5], [4]], [[2], [1]]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:16,代码来源:ops_test.py

示例8: testInvalidInputShape

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testInvalidInputShape(self):
    image = tf.constant([[[1], [2]], [[3], [4]]], dtype=tf.float32)
    boxes = tf.constant([[-1, -1, 1, 1]], dtype=tf.float32)
    crop_size = [4, 4]
    with self.assertRaises(ValueError):
      _ = ops.matmul_crop_and_resize(image, boxes, crop_size) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:8,代码来源:ops_test.py

示例9: testMatMulCropAndResize2x2To1x1

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize2x2To1x1(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[1, 1])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[0, 0, 1, 1]], dtype=np.float32)
    expected_output = [[[[2.5]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:12,代码来源:ops_test.py

示例10: testMatMulCropAndResize2x2To1x1Flipped

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize2x2To1x1Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[1, 1])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[1, 1, 0, 0]], dtype=np.float32)
    expected_output = [[[[2.5]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:12,代码来源:ops_test.py

示例11: testMatMulCropAndResize2x2To3x3

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize2x2To3x3(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[3, 3])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[0, 0, 1, 1]], dtype=np.float32)
    expected_output = [[[[1.0], [1.5], [2.0]],
                        [[2.0], [2.5], [3.0]],
                        [[3.0], [3.5], [4.0]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:14,代码来源:ops_test.py

示例12: testMatMulCropAndResize2x2To3x3Flipped

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize2x2To3x3Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[3, 3])

    image = np.array([[[[1], [2]], [[3], [4]]]], dtype=np.float32)
    boxes = np.array([[1, 1, 0, 0]], dtype=np.float32)
    expected_output = [[[[4.0], [3.5], [3.0]],
                        [[3.0], [2.5], [2.0]],
                        [[2.0], [1.5], [1.0]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:14,代码来源:ops_test.py

示例13: testMatMulCropAndResize3x3To2x2

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize3x3To2x2(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1], [2], [3]],
                       [[4], [5], [6]],
                       [[7], [8], [9]]]], dtype=np.float32)
    boxes = np.array([[0, 0, 1, 1],
                      [0, 0, .5, .5]], dtype=np.float32)
    expected_output = [[[[1], [3]], [[7], [9]]],
                       [[[1], [2]], [[4], [5]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:16,代码来源:ops_test.py

示例14: testMatMulCropAndResize3x3To2x2Flipped

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import matmul_crop_and_resize [as 别名]
def testMatMulCropAndResize3x3To2x2Flipped(self):

    def graph_fn(image, boxes):
      return ops.matmul_crop_and_resize(image, boxes, crop_size=[2, 2])

    image = np.array([[[[1], [2], [3]],
                       [[4], [5], [6]],
                       [[7], [8], [9]]]], dtype=np.float32)
    boxes = np.array([[1, 1, 0, 0],
                      [.5, .5, 0, 0]], dtype=np.float32)
    expected_output = [[[[9], [7]], [[3], [1]]],
                       [[[5], [4]], [[2], [1]]]]
    crop_output = self.execute(graph_fn, [image, boxes])
    self.assertAllClose(crop_output, expected_output) 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:16,代码来源:ops_test.py


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