PIL的Image读取

  1. from PIL import Image
  2. img = Image.open(os.path.join(indir, image)).convert('RGB')
  3. img = transform(img)

cv2读取

  1. import cv2
  2. # this is numpy, but BGR
  3. image = cv2.imread(path)
  4. # 转为RGB
  5. image = image[:,:,::-1]