diff --git a/examples/efficientnet.py b/examples/efficientnet.py index c02ed217..cfa962ef 100644 --- a/examples/efficientnet.py +++ b/examples/efficientnet.py @@ -127,7 +127,9 @@ if __name__ == "__main__": else: url = "https://raw.githubusercontent.com/karpathy/micrograd/master/puppy.jpg" img = Image.open(io.BytesIO(fetch(url))) - aspect_ratio = img.size[0] / img.size[1] + aspect_ratio_landscape = img.size[0] / img.size[1] + aspect_ratio_portrait = img.size[1] / img.size[0] + aspect_ratio = max (aspect_ratio_landscape, aspect_ratio_portrait) img = img.resize((int(224*max(aspect_ratio,1.0)), int(224*max(1.0/aspect_ratio,1.0)))) img = np.array(img)