import Augmentor
p = Augmentor.Pipeline('one')
# p.random_distortion(probability=0.05, grid_width=4, grid_height=4, magnitude=4)
p.rotate(probability=0.3, max_left_rotation=25, max_right_rotation=25)
p.flip_left_right(probability=0.2)
p.flip_top_bottom(probability=0.02)
p.flip_random(probability=0.05)
p.rotate90(probability=0.005)
p.rotate180(probability=0.005)
p.rotate270(probability=0.005)
p.skew_tilt(probability=0.001)
p.skew_left_right(probability=0.005)
p.skew_top_bottom(probability=0.005)
p.skew_corner(probability=0.002)
p.skew(probability=0.002)
p.shear(probability=0.005, max_shear_left=10, max_shear_right=10)
p.sample(100)
https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
https://machinelearningmastery.com/how-to-configure-image-data-augmentation-when-training-deep-learning-neural-networks/
https://www.tensorflow.org/tutorials/images/data_augmentation
https://towardsdatascience.com/how-to-augmentate-data-using-keras-38d84bd1c80c
from email.mime import image
import os
from PIL import Image
import cv2
# from PIL import Image
from os import listdir
# get the path or directory
folder_dir = "one"
for images in os.listdir(folder_dir):
# check if the image end swith png or jpg or jpeg
if (images.endswith(".png") or images.endswith(".jpg") or images.endswith(".jpeg")):
# display
# print(type(images))
img = Image.open('one/'+images)
# print(os.path.join(folder_dir, images))
# width, height = image.size
width = img.width
height = img.height
name=str(images)
name=name.rsplit( ".", 1 )[ 0 ]
# name.partition('.')
f= open('one/'+name+'.txt',"w+")
f.write("0 0 0 "+str(height)+" "+str(width))
f.close
# # display width and height
print("The height of the image is: ", height)
print("The width of the image is: ", width)
0 Comments
If you have any doubts/suggestion/any query or want to improve this article, you can comment down below and let me know. Will reply to you soon.