[3, 6, 6, 9, 9], // Inside matD
])
// Construct the pretrained map with four matrix.
matA = np.ones((5, 5))
matB = np.ones((5, 5)) + 1
matC = np.ones((5, 5)) + 2
matD = np.ones((5, 5)) + 3
pretrained = np.bmat([[matA, matB], [matC, matD]])
// Expand the dimensions to be compatible with ROIPoolingLayer.
pretrained = np.expand_dims(pretrained, axis=0)
pretrained = np.expand_dims(pretrained, axis=3)
results = self._run_roi_pooling(roi_proposals, pretrained, self.config)
print(results["crops"].shape)
print(results["roi_pool"][0])
After Change
[2, 1, 6, 4, 9], // Inside mat_C
[3, 6, 6, 9, 9], // Inside mat_D
])
pretrained = self.pretrained
results = self._run_roi_pooling(roi_proposals, pretrained, self.config)
// Check that crops has the correct shape. This is (4, 4, 4, 1)
// because we have 4 proposals, "pool size" = 2x2 then the
// tf.image.crop_and_resize function duplicates that size.
self.assertEqual(
results["crops"].shape,
(4, 4, 4, 1)
)
// Check that roi_pool has the correct shape. This is (4, 2, 2, 1)
// because we have 4 proposals, "pool size" = 2x2.
self.assertEqual(
results["roi_pool"].shape,
(4, 2, 2, 1)
)
results["roi_pool"] = np.squeeze(results["roi_pool"], axis=3)
// Check that max polling returns only "multiplier_a"
self.assertAllEqual(
results["roi_pool"][0],