b3_data_iter.py 文件源码

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

项目:kaggle-dstl-satellite-imagery-feature-detection 作者: u1234x1234 项目源码 文件源码
def sample_crop(self, n):
        kx = np.array([len(x) for x in self.maps_with_class])
        class_hist = np.random.multinomial(n, self.class_probs * (kx != 0))
        class_ids = np.repeat(np.arange(class_hist.shape[0]), class_hist)
        X = []
        for class_id in class_ids:
            for i in range(20):
                random_image_idx = np.random.choice(self.maps_with_class[class_id])
                if random_image_idx < 25:
                    break
            x = self.kde_samplers[random_image_idx][class_id].sample()[0]
            x /= self.mask_size
            x = np.clip(x, 0., 1.)
            return x, class_id, random_image_idx
            X.append(x)
        return X
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号