jeffheaton / t81_558_deep_learning

T81-558: Keras - Applications of Deep Neural Networks @Washington University in St. Louis
https://sites.wustl.edu/jeffheaton/t81-558/
Other
5.72k stars 3.03k forks source link

Part# 6.4 square chopping #58

Closed jackohulk99 closed 4 years ago

jackohulk99 commented 4 years ago

Thank for the great notebook to learn ,especially during the cov-19 homestay. I don't know if mis-understood but the function below seems to make the image rectangle instead of square. Do you mean .eg. crop((pad,0,pad+cols,cols) like in the previous course?

def make_square(img): cols,rows = img.size

if rows>cols:
    pad = (rows-cols)/2
    img = img.crop((pad,0,cols,cols))
else:
    pad = (cols-rows)/2
    img = img.crop((0,pad,rows,rows))  
jeffheaton commented 4 years ago

Thanks, will take a look.

jeffheaton commented 4 years ago

I tried the code, as I have it and got the below result. What are you suggesting I change?

Before: 744x1157 After: 200x200 Before: 2592x3888 After: 200x200 Before: 2419x3888 After: 200x200 Before: 1704x2272 After: 200x200 Before: 2185x3700 After: 200x200 Before: 1834x2816 After: 200x200 Before: 1696x2544 After: 200x200