Training_run.py 文件源码

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

项目:semantic-segmentation 作者: albertbuchard 项目源码 文件源码
def extract_data(filename, num_images):
    imgs = []
    stars = []
    ridges = []
    print("loading, please wait")
    for i in range(1, num_images+1):
        imageid = 'satImage_'+ '%.3d' % i
        ##Load images
        for j in range(8):
            image_filename = 'training_big/Images/' + imageid + "_rota"+str(np.int(j))+".png"
            if os.path.isfile(image_filename):

                img = mpimg.imread(image_filename)
                n1,n2,n = img.shape

                imgs.append(img.astype(np.float32, copy=False))

            else:
                print ('File ' + image_filename + ' does not exist')

    ##Format images
    num_images = len(imgs)
    IMG_WIDTH = imgs[0].shape[0]
    IMG_HEIGHT = imgs[0].shape[1]
    N_PATCHES_PER_IMAGE = (IMG_WIDTH/IMG_PATCH_SIZE)*(IMG_HEIGHT/IMG_PATCH_SIZE)
    img_patches = [img_crop(imgs[i], IMG_PATCH_SIZE, IMG_PATCH_SIZE) for i in range(num_images)]
    data = [img_patches[i][j] for i in range(len(img_patches)) for j in range(len(img_patches[i]))]
    return np.asarray(data)



# Assign a label to a patch v
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号