I am working on a binary image classifier in tensorflow. I want to specify the img_shape in a Conv2D layer. I would like to know if there is a way of finding the average shape of all images in the dataset.
It would help a lot. Thanks
Found the solution using PIL library (I am using a directory of images)
import PIL
from PIL import Image
widths = []
heights = []
for img in os.listdir(""):
img_path = os.path.join("") # Making image file path
im = Image.open(img_path)
widths.append(im.size[0])
heights.append(im.size[1])
AVG_HEIGHT = round(sum(heights)/len(heights))
AVG_WIDTH = round(sum(widths)/len(widths))