From f6bc5d2823bdf136c9c37b1ad2d2286df0b40d1c Mon Sep 17 00:00:00 2001 From: Francisco Massa Date: Fri, 31 Jul 2020 11:19:45 +0200 Subject: [PATCH] Add max size assert in DETRdemo (#171) --- notebooks/detr_demo.ipynb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/notebooks/detr_demo.ipynb b/notebooks/detr_demo.ipynb index fa242f1a0..8c5c96598 100644 --- a/notebooks/detr_demo.ipynb +++ b/notebooks/detr_demo.ipynb @@ -597,6 +597,11 @@ " # mean-std normalize the input image (batch-size: 1)\n", " img = transform(im).unsqueeze(0)\n", "\n", + " # demo model only support by default images with aspect ratio between 0.5 and 2\n", + " # if you want to use images with an aspect ratio outside this range\n", + " # rescale your image so that the maximum size is at most 1333 for best results\n", + " assert img.shape[-2] <= 1600 and img.shape[-1] <= 1600, 'demo model only supports images up to 1600 pixels on each side'\n", + "\n", " # propagate through the model\n", " outputs = model(img)\n", "\n", @@ -698,4 +703,4 @@ ] } ] -} \ No newline at end of file +}