def gen(self, normal_mu_range, anomaly_mu_range):
self.gens = [
compound_distribution(
stats.uniform(loc=anomaly_mu_range[0], scale=anomaly_mu_range[1] - anomaly_mu_range[0]),
truncated(stats.poisson, max_value=1024)
),
compound_distribution(
stats.uniform(loc=normal_mu_range[0], scale=normal_mu_range[1] - normal_mu_range[0]),
truncated(stats.poisson, max_value=1024)
)
]
self.priors = np.array([0.1, 0.9])
n = 10
MC = CameraMC(self.priors, self.gens, image_shape=(1, n, n), n_frames=100)
self.cats, self.params, self.imgs = MC.get_sample()
self.hists = ndcount(self.imgs).reshape(n, n, -1)
self.hists = self.hists.astype('float32') / np.sum(self.hists, axis=2)[:, :, None]
self.cats = self.cats.reshape(-1)
print("Img shape %s" % (self.imgs.shape, ))
print("Hists shape %s" % (self.hists.shape, ))
print("Categories shape %s" % (self.cats.shape, ))
评论列表
文章目录