def setUp(self):
super(ROIPoolingTest, self).setUp()
# Setup
self.im_shape = (10, 10)
self.config = EasyDict({
'pooling_mode': 'crop',
'pooled_width': 2,
'pooled_height': 2,
'padding': 'VALID',
})
# Construct the pretrained map with four matrix.
self.multiplier_a = 1
self.multiplier_b = 2
self.multiplier_c = 3
self.multiplier_d = 4
mat_a = np.ones((5, 5)) * self.multiplier_a
mat_b = np.ones((5, 5)) * self.multiplier_b
mat_c = np.ones((5, 5)) * self.multiplier_c
mat_d = np.ones((5, 5)) * self.multiplier_d
self.pretrained = np.bmat([[mat_a, mat_b], [mat_c, mat_d]])
# Expand the dimensions to be compatible with ROIPoolingLayer.
self.pretrained = np.expand_dims(self.pretrained, axis=0)
self.pretrained = np.expand_dims(self.pretrained, axis=3)
# pretrained:
# mat_a | mat_b
# -------------
# mat_c | mat_d
tf.reset_default_graph()
评论列表
文章目录