本文整理匯總了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)