Esempio n. 1
0
 def __init__(self, image_shape, number_class, cluster_number, scalar, prior_shape):
     """
     
     :param image_shape:输入图像的形状[height, width]
     :param number_class:目标检测类别数+1
     :param cluster_number:先验框数量
     :param scalar:yolo2特征提取尺度[height, width],论文采用的32x32
     :param prior_shape:聚类获得的先验框的宽高[[h, w], [h, w], ...]
     """
     self.ImageShape = image_shape
     self.NumberClass = number_class
     self.ClusterNumber = cluster_number
     self.PriorShape = prior_shape
     self.Scalar = scalar
     self.CoordinateLabelData = None
     self.ClassLabelData = None
     self.Check = \
         (np.array(self.ImageShape, np.float64) / self.Scalar * 10
          - np.array(self.ImageShape, np.float64) / self.Scalar)
     assert ((self.Check[0] != 0.0) & (self.Check[1] != 0.0)) is True, \
         cutil.CError('image shape is %s, scalar is %s' % (self.ImageShape, self.Scalar))
     self.Check = np.array(self.ImageShape, np.int64) / self.Scalar
     pass