min_max_norm.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:mimicry.ai 作者: fizerkhan 项目源码 文件源码
def compute_mean(self, file_list):

        logger = logging.getLogger("acoustic_norm")

        mean_vector = numpy.zeros((1, self.feature_dimension))
        all_frame_number = 0

        io_funcs = BinaryIOCollection()
        for file_name in file_list:
            features = io_funcs.load_binary_file(file_name, self.feature_dimension)
            current_frame_number = features.size / self.feature_dimension
            mean_vector += numpy.reshape(numpy.sum(features, axis=0), (1, self.feature_dimension))
            all_frame_number += current_frame_number

        mean_vector /= float(all_frame_number)

        # po=numpy.get_printoptions()
        # numpy.set_printoptions(precision=2, threshold=20, linewidth=1000, edgeitems=4)
        logger.info('computed mean vector of length %d :' % mean_vector.shape[1] )
        logger.info(' mean: %s' % mean_vector)
        # restore the print options
        # numpy.set_printoptions(po)

        return  mean_vector
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号