图像尺寸调整以及保存:
import os
from PIL import Image
filename = os.listdir("./train/main/label1/")
base_dir = "./train/main/label1/"
new_dir = "./train/main/label/"
size_m = 800
size_n = 640
for img in filename:
image = Image.open(base_dir + img)
image_size = image.resize((size_m, size_n),Image.ANTIALIAS)
image_size.save(new_dir+ img)