You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
601 B

  1. from PIL import Image
  2. import os
  3. if not os.path.isdir("data/vgg-16"):
  4. os.makedirs("data/vgg-16")
  5. species = os.listdir("data/cropped")
  6. for specie in species:
  7. if not os.path.isdir("data/vgg-16/"+specie):
  8. os.makedirs("data/vgg-16/"+specie)
  9. fichiers = os.listdir("data/cropped/"+specie)
  10. for fichier in fichiers:
  11. if not os.path.isfile("data/vgg-16/"+specie+"/"+fichier):
  12. image = Image.open("data/cropped/"+specie+"/"+fichier)
  13. image_resizee = image.resize((224, 224))
  14. image_resizee.save("data/vgg-16/"+specie+"/"+fichier)