create_dataset.py 文件源码

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

项目:MachineLearning 作者: timomernick 项目源码 文件源码
def generate_image(width, height):
    image = np.zeros([height, width], dtype=np.float32)
    count = np.random.randint(min_count, max_count+1)
    half_size = dot_size/2
    for i in range(count):
        x = np.random.randint(half_size, width - half_size)
        y = np.random.randint(half_size, height - half_size)
        rr, cc = circle(x, y, half_size)
        image[rr, cc] = 1.0
    return image, count
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号