prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add tutorial with hard negative samples
  ## 📓 Documentation Update
  "how to use an image as background annotation" is a common question. We can provide a tutorial showing how to do that
  
  ### Racoon and dogs
  If you train a model on the racoon dataset and show the model a picture of a dog it will classify it as a racoon. We can add images of dogs to the dataset (without any annotations) and show how the difference of model performance in both scenarios.
  
  </issue>
  <code>
  [start of icevision/models/base_show_results.py]
  1 __all__ = ["base_show_results"]
  2 
  3 from icevision.imports import *
  4 from icevision.utils import *
  5 from icevision.core import *
  6 from icevision.visualize import *
  7 from icevision.data import *
  8 
  9 
  10 def base_show_results(
  11     predict_fn: callable,
  12     build_infer_batch_fn: callable,
  13     model: nn.Module,
  14     dataset: Dataset,
  15     class_map: Optional[ClassMap] = None,
  16     num_samples: int = 6,
  17     ncols: int = 3,
  18     denormalize_fn: Optional[callable] = denormalize_imagenet,
  19     show: bool = True,
  20 ) -> None:
  21     samples = [dataset[i] for i in range(num_samples)]
  22     batch, samples = build_infer_batch_fn(samples)
  23     preds = predict_fn(model, batch)
  24 
  25     imgs = [sample["img"] for sample in samples]
  26     show_preds(
  27         imgs,
  28         preds,
  29         class_map=class_map,
  30         denormalize_fn=denormalize_fn,
  31         ncols=ncols,
  32         show=show,
  33     )
  34
  [end of icevision/models/base_show_results.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/icevision/models/base_show_results.py b/icevision/models/base_show_results.py
  --- a/icevision/models/base_show_results.py
  +++ b/icevision/models/base_show_results.py
  @@ -18,7 +18,7 @@
       denormalize_fn: Optional[callable] = denormalize_imagenet,
       show: bool = True,
   ) -> None:
  -    samples = [dataset[i] for i in range(num_samples)]
  +    samples = random.choices(dataset, k=num_samples)
       batch, samples = build_infer_batch_fn(samples)
       preds = predict_fn(model, batch)
  
verification_info: {"golden_diff": "diff --git a/icevision/models/base_show_results.py b/icevision/models/base_show_results.py\n--- a/icevision/models/base_show_results.py\n+++ b/icevision/models/base_show_results.py\n@@ -18,7 +18,7 @@\n     denormalize_fn: Optional[callable] = denormalize_imagenet,\n     show: bool = True,\n ) -> None:\n-    samples = [dataset[i] for i in range(num_samples)]\n+    samples = random.choices(dataset, k=num_samples)\n     batch, samples = build_infer_batch_fn(samples)\n     preds = predict_fn(model, batch)\n", "issue": "Add tutorial with hard negative samples\n## \ud83d\udcd3 Documentation Update\r\n\"how to use an image as background annotation\" is a common question. We can provide a tutorial showing how to do that\r\n\r\n### Racoon and dogs\r\nIf you train a model on the racoon dataset and show the model a picture of a dog it will classify it as a racoon. We can add images of dogs to the dataset (without any annotations) and show how the difference of model performance in both scenarios.\n", "before_files": [{"content": "__all__ = [\"base_show_results\"]\n\nfrom icevision.imports import *\nfrom icevision.utils import *\nfrom icevision.core import *\nfrom icevision.visualize import *\nfrom icevision.data import *\n\n\ndef base_show_results(\n    predict_fn: callable,\n    build_infer_batch_fn: callable,\n    model: nn.Module,\n    dataset: Dataset,\n    class_map: Optional[ClassMap] = None,\n    num_samples: int = 6,\n    ncols: int = 3,\n    denormalize_fn: Optional[callable] = denormalize_imagenet,\n    show: bool = True,\n) -> None:\n    samples = [dataset[i] for i in range(num_samples)]\n    batch, samples = build_infer_batch_fn(samples)\n    preds = predict_fn(model, batch)\n\n    imgs = [sample[\"img\"] for sample in samples]\n    show_preds(\n        imgs,\n        preds,\n        class_map=class_map,\n        denormalize_fn=denormalize_fn,\n        ncols=ncols,\n        show=show,\n    )\n", "path": "icevision/models/base_show_results.py"}]}