File size: 477 Bytes
c9019cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import numpy as np
import os
import glob
import pandas as pd
import cv2
from xml.etree import ElementTree
import random
import shutil
import glob
from PIL import Image

for dirname in os.listdir("tmp"):
    print(dirname)
    for fpath in glob.glob(os.path.join("fullsizeimg",dirname,"original","*")):
        img=Image.open(fpath)
        img_resize = img.resize((300, 300),Image.LANCZOS)
        img_resize.save(os.path.join("300_300img",dirname+"_"+os.path.basename(fpath)))