{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Recreate the Backbone","metadata":{}},{"cell_type":"code","source":"import torch\nimport torch.nn as nn","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:14:51.512425Z","iopub.execute_input":"2023-06-09T09:14:51.513201Z","iopub.status.idle":"2023-06-09T09:14:53.739308Z","shell.execute_reply.started":"2023-06-09T09:14:51.513143Z","shell.execute_reply":"2023-06-09T09:14:53.738202Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/utils/torch_utils.py\ndef check_all_model_params_in_groups2(model, param_groups):\n    num_params = len([param for group in param_groups for param in group])\n    num_params_expected = len(list(model.parameters()))\n\n    if num_params != num_params_expected:\n        raise RuntimeError(f\"{num_params_expected} params in model, but only {num_params} in parameter group.\")","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:14:56.756162Z","iopub.execute_input":"2023-06-09T09:14:56.757531Z","iopub.status.idle":"2023-06-09T09:14:56.764963Z","shell.execute_reply.started":"2023-06-09T09:14:56.757479Z","shell.execute_reply":"2023-06-09T09:14:56.763594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/torchvision/faster_rcnn/backbones/resnet_fpn_utils.py\ndef param_groups(model):\n    body = model.body\n\n    layers = []\n    layers += [nn.Sequential(body.conv1, body.bn1)]\n    layers += [getattr(body, l) for l in list(body) if l.startswith(\"layer\")]\n    layers += [model.fpn]\n\n    _param_groups = [list(layer.parameters()) for layer in layers]\n    check_all_model_params_in_groups2(model, _param_groups)\n\n    return _param_groups","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:00.492930Z","iopub.execute_input":"2023-06-09T09:15:00.494053Z","iopub.status.idle":"2023-06-09T09:15:00.502237Z","shell.execute_reply.started":"2023-06-09T09:15:00.493982Z","shell.execute_reply":"2023-06-09T09:15:00.500962Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/torchvision/faster_rcnn/backbones/resnet_fpn_utils.py\nfrom types import MethodType\n\ndef patch_param_groups(model):\n    model.param_groups = MethodType(param_groups, model)","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:03.578519Z","iopub.execute_input":"2023-06-09T09:15:03.579270Z","iopub.status.idle":"2023-06-09T09:15:03.584478Z","shell.execute_reply.started":"2023-06-09T09:15:03.579229Z","shell.execute_reply":"2023-06-09T09:15:03.583251Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/torchvision/faster_rcnn/backbones/resnet_fpn_configs.py\nfrom torchvision.models.detection.backbone_utils import resnet_fpn_backbone\n\ndef _resnet_fpn(name, pretrained=True, **kwargs):\n    model = resnet_fpn_backbone(backbone_name=name, pretrained=pretrained, **kwargs)\n    patch_param_groups(model)\n\n    return model","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:05.696052Z","iopub.execute_input":"2023-06-09T09:15:05.696980Z","iopub.status.idle":"2023-06-09T09:15:05.918686Z","shell.execute_reply.started":"2023-06-09T09:15:05.696940Z","shell.execute_reply":"2023-06-09T09:15:05.917626Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/torchvision/faster_rcnn/backbones/resnet_fpn_configs.py\ndef resnet50_fpn_fn(pretrained=True, **kwargs):\n    return _resnet_fpn(\"resnet50\", pretrained=pretrained, **kwargs)","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:07.773043Z","iopub.execute_input":"2023-06-09T09:15:07.774208Z","iopub.status.idle":"2023-06-09T09:15:07.780153Z","shell.execute_reply.started":"2023-06-09T09:15:07.774162Z","shell.execute_reply":"2023-06-09T09:15:07.779052Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dot_scatter_backbone = resnet50_fpn_fn(pretrained=False)\ndot_scatter_backbone","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:09.373495Z","iopub.execute_input":"2023-06-09T09:15:09.374236Z","iopub.status.idle":"2023-06-09T09:15:09.976165Z","shell.execute_reply.started":"2023-06-09T09:15:09.374192Z","shell.execute_reply":"2023-06-09T09:15:09.974888Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Recreate the Model","metadata":{}},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/torchvision/utils.py\ndef patch_param_groups2(model, head_layers, backbone_param_groups):\n    def param_groups2(model):\n        head_param_groups = [list(layer.parameters()) for layer in head_layers]\n\n        _param_groups = backbone_param_groups + head_param_groups\n        check_all_model_params_in_groups2(model, _param_groups)\n\n        return _param_groups\n\n    model.param_groups = MethodType(param_groups2, model)","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:19.457023Z","iopub.execute_input":"2023-06-09T09:15:19.457426Z","iopub.status.idle":"2023-06-09T09:15:19.464741Z","shell.execute_reply.started":"2023-06-09T09:15:19.457388Z","shell.execute_reply":"2023-06-09T09:15:19.463605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/torchvision/utils.py\ndef patch_rcnn_param_groups(model):\n    return patch_param_groups2(model=model, head_layers=[model.rpn, model.roi_heads], backbone_param_groups=model.backbone.param_groups())","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:21.938522Z","iopub.execute_input":"2023-06-09T09:15:21.939484Z","iopub.status.idle":"2023-06-09T09:15:21.946846Z","shell.execute_reply.started":"2023-06-09T09:15:21.939431Z","shell.execute_reply":"2023-06-09T09:15:21.945674Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/torchvision/utils.py\ndef _noop_normalize(image):\n    return image\n\ndef _noop_resize(image, target):\n    return image, target\n\ndef remove_internal_model_transforms(model):\n    model.transform.normalize = _noop_normalize\n    model.transform.resize = _noop_resize","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:23.120938Z","iopub.execute_input":"2023-06-09T09:15:23.121682Z","iopub.status.idle":"2023-06-09T09:15:23.127535Z","shell.execute_reply.started":"2023-06-09T09:15:23.121641Z","shell.execute_reply":"2023-06-09T09:15:23.126419Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/torchvision/faster_rcnn/model.py\nfrom torchvision.models.detection.faster_rcnn import FasterRCNN\n\ndef get_model(num_classes, backbone, remove_internal_transforms=True, **faster_rcnn_kwargs):\n    model = FasterRCNN(backbone, num_classes=num_classes, **faster_rcnn_kwargs)\n\n    patch_rcnn_param_groups(model=model)\n\n    if remove_internal_transforms:\n        remove_internal_model_transforms(model)\n\n    return model","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:25.602426Z","iopub.execute_input":"2023-06-09T09:15:25.603066Z","iopub.status.idle":"2023-06-09T09:15:25.609596Z","shell.execute_reply.started":"2023-06-09T09:15:25.603019Z","shell.execute_reply":"2023-06-09T09:15:25.608468Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dot_scatter_model = get_model(num_classes=2, backbone=dot_scatter_backbone)\ndot_scatter_model","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:28.754893Z","iopub.execute_input":"2023-06-09T09:15:28.756140Z","iopub.status.idle":"2023-06-09T09:15:28.968953Z","shell.execute_reply.started":"2023-06-09T09:15:28.756088Z","shell.execute_reply":"2023-06-09T09:15:28.967976Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dot_scatter_model.load_state_dict(torch.load('/kaggle/input/b-m-g-a-extra-data/dot_scatter__8.pth'))","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:35.614122Z","iopub.execute_input":"2023-06-09T09:15:35.615014Z","iopub.status.idle":"2023-06-09T09:15:39.842236Z","shell.execute_reply.started":"2023-06-09T09:15:35.614954Z","shell.execute_reply":"2023-06-09T09:15:39.841161Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\ndevice","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:46.695880Z","iopub.execute_input":"2023-06-09T09:15:46.696978Z","iopub.status.idle":"2023-06-09T09:15:46.705605Z","shell.execute_reply.started":"2023-06-09T09:15:46.696925Z","shell.execute_reply":"2023-06-09T09:15:46.703852Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dot_scatter_model = dot_scatter_model.to(device)\ndot_scatter_model.eval();","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:48.776935Z","iopub.execute_input":"2023-06-09T09:15:48.778134Z","iopub.status.idle":"2023-06-09T09:15:48.844168Z","shell.execute_reply.started":"2023-06-09T09:15:48.778083Z","shell.execute_reply":"2023-06-09T09:15:48.843047Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Postprocessing Functions","metadata":{}},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/utils/imageio.py\nfrom collections import namedtuple\n\nImgSize = namedtuple(\"ImgSize\", \"width, height\")","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:51.885168Z","iopub.execute_input":"2023-06-09T09:15:51.886562Z","iopub.status.idle":"2023-06-09T09:15:51.892293Z","shell.execute_reply.started":"2023-06-09T09:15:51.886515Z","shell.execute_reply":"2023-06-09T09:15:51.890964Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/utils/imageio.py\nimport PIL\nimport numpy as np\n\ndef get_img_size_from_data(data):\n    \"\"\"\n    Returns image size.\n    If the data is a NumPy array, it is expected to be in the format (h, w) or (h, w, c).\n    \"\"\"\n    assert isinstance(data, (PIL.Image.Image, np.ndarray))\n\n    if isinstance(data, PIL.Image.Image):\n        width, height = data.size\n    else:\n        height, width, *_ = data.shape\n\n    return ImgSize(width=width, height=height)","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:54.187803Z","iopub.execute_input":"2023-06-09T09:15:54.188265Z","iopub.status.idle":"2023-06-09T09:15:54.196211Z","shell.execute_reply.started":"2023-06-09T09:15:54.188226Z","shell.execute_reply":"2023-06-09T09:15:54.194878Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import albumentations as A\n\ndot_scatter_tfms_list = [\n    A.LongestMaxSize(always_apply=False, p=1, max_size=640, interpolation=1),\n    A.PadIfNeeded(always_apply=False, p=1.0, min_height=640, min_width=640, pad_height_divisor=None, pad_width_divisor=None, border_mode=0, value=[124, 116, 104], mask_value=None),\n    A.Normalize(always_apply=False, p=1.0, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), max_pixel_value=255.0)\n]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:15:57.653838Z","iopub.execute_input":"2023-06-09T09:15:57.654577Z","iopub.status.idle":"2023-06-09T09:15:58.971604Z","shell.execute_reply.started":"2023-06-09T09:15:57.654535Z","shell.execute_reply":"2023-06-09T09:15:58.970519Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/tfms/albumentations/albumentations_helpers.py\ndef get_transform(tfms_list, t):\n    \"\"\"\n    Extract transform `t` from `tfms_list`.\n    \n    Parameters\n    ----------\n    tfms_list: list of albumentations transforms.\n    t: name (str) of the transform to look for and return from within `tfms_list`.\n    \n    Returns\n    -------\n    The `t` transform if found inside `tfms_list`, otherwise `None`.\n    \"\"\"\n    for el in tfms_list:\n        if t in str(type(el)):\n            return el\n    return None","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:16:05.199335Z","iopub.execute_input":"2023-06-09T09:16:05.199965Z","iopub.status.idle":"2023-06-09T09:16:05.206742Z","shell.execute_reply.started":"2023-06-09T09:16:05.199924Z","shell.execute_reply":"2023-06-09T09:16:05.205441Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/tfms/albumentations/albumentations_helpers.py\ndef py3round(number):\n    \"\"\"\n    Unified rounding in all Python versions. Used by Albumentations.\n    \n    Parameters\n    ----------\n    number: float to round.\n    \n    Returns\n    -------\n    Rounded number.\n    \"\"\"\n    if abs(round(number) - number) == 0.5:\n        return int(2.0 * round(number / 2.0))\n\n    return int(round(number))","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:16:07.616872Z","iopub.execute_input":"2023-06-09T09:16:07.617905Z","iopub.status.idle":"2023-06-09T09:16:07.624087Z","shell.execute_reply.started":"2023-06-09T09:16:07.617865Z","shell.execute_reply":"2023-06-09T09:16:07.622718Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/tfms/albumentations/albumentations_helpers.py\ndef func_max_size(height, width, max_size, func):\n    \"\"\"\n    Calculate rescaled height and width of the image in question w.r.t. to a specific size.\n    \n    Parameters\n    ----------\n    height: height of the image in question.\n    width: width of the image in question.\n    max_size: size w.r.t. the image needs to be rescaled (resized).\n    func: min/max. Whether to compare max_size to the smallest/longest of the image dims.\n    \n    Returns\n    -------\n    Rescaled height and width.\n    \"\"\"\n    scale = max_size / float(func(width, height))\n\n    if scale != 1.0:\n        height, width = tuple(py3round(dim * scale) for dim in (height, width))\n    return height, width","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:16:09.715732Z","iopub.execute_input":"2023-06-09T09:16:09.716155Z","iopub.status.idle":"2023-06-09T09:16:09.723374Z","shell.execute_reply.started":"2023-06-09T09:16:09.716116Z","shell.execute_reply":"2023-06-09T09:16:09.722276Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/tfms/albumentations/albumentations_helpers.py\ndef get_size_without_padding(tfms_list, before_tfm_img_size, height, width):\n    \"\"\"\n    Infer the height and width of the pre-processed image after removing padding.\n    \n    Parameters\n    ----------\n    tfms_list: list of albumentations transforms applied to the `before_tfm_img` image before passing it to the model for inference.\n    before_tfm_img_size: original image size before being pre-processed for inference.\n    height: height of output image from icevision `predict` function.\n    width: width of output image from icevision `predict` function.\n    \n    Returns\n    -------\n    height and width of the image coming out of the inference pipeline, after removing padding.\n    \"\"\"\n    if get_transform(tfms_list, \"Pad\") is not None:\n\n        t = get_transform(tfms_list, \"SmallestMaxSize\")\n        if t is not None:\n            presize = t.max_size\n            height, width = func_max_size(before_tfm_img_size.height, before_tfm_img_size.width, presize, min)\n\n        t = get_transform(tfms_list, \"LongestMaxSize\")\n        if t is not None:\n            size = t.max_size\n            height, width = func_max_size(before_tfm_img_size.height, before_tfm_img_size.width, size, max)\n\n    return height, width","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:16:11.859279Z","iopub.execute_input":"2023-06-09T09:16:11.859682Z","iopub.status.idle":"2023-06-09T09:16:11.868892Z","shell.execute_reply.started":"2023-06-09T09:16:11.859646Z","shell.execute_reply":"2023-06-09T09:16:11.867654Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"BBox = namedtuple(\"BBox\", \"xmin, ymin, xmax, ymax\")","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:16:12.572045Z","iopub.execute_input":"2023-06-09T09:16:12.572772Z","iopub.status.idle":"2023-06-09T09:16:12.577964Z","shell.execute_reply.started":"2023-06-09T09:16:12.572732Z","shell.execute_reply":"2023-06-09T09:16:12.576550Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Original source: https://github.com/airctic/icevision/blob/master/icevision/models/inference.py\ndef postprocess_bbox(img_size, bbox, transforms, h_after, w_after):\n    \"\"\"\n    Post-process predicted bbox to adjust coordinates to input image size.\n    \n    Parameters\n    ----------\n    img_size: original image size, before any model-pre-processing done.\n    bbox: predicted bbox.\n    transforms: list of model-pre-processing transforms.\n    h_after: height of image after model-pre-processing transforms.\n    w_after: width of image after model-pre-processing transforms.\n    \n    Returns\n    -------\n    Tuple with (xmin, ymin, xmax, ymax) rescaled and re-adjusted to match the original image size.\n    \"\"\"\n    h_after, w_after = get_size_without_padding(transforms, img_size, h_after, w_after)\n    pad = np.abs(h_after - w_after) // 2\n\n    h_scale, w_scale = h_after / img_size.height, w_after / img_size.width\n    if h_after < w_after:\n        xmin, xmax, ymin, ymax = (\n            int(bbox.xmin),\n            int(bbox.xmax),\n            int(bbox.ymin) - pad,\n            int(bbox.ymax) - pad,\n        )\n    else:\n        xmin, xmax, ymin, ymax = (\n            int(bbox.xmin) - pad,\n            int(bbox.xmax) - pad,\n            int(bbox.ymin),\n            int(bbox.ymax),\n        )\n\n    xmin, xmax, ymin, ymax = (\n        max(xmin, 0),\n        min(xmax, w_after),\n        max(ymin, 0),\n        min(ymax, h_after),\n    )\n    xmin, xmax, ymin, ymax = (\n        int(xmin / w_scale),\n        int(xmax / w_scale),\n        int(ymin / h_scale),\n        int(ymax / h_scale),\n    )\n\n    return xmin, ymin, xmax, ymax","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:16:14.960572Z","iopub.execute_input":"2023-06-09T09:16:14.961749Z","iopub.status.idle":"2023-06-09T09:16:14.973693Z","shell.execute_reply.started":"2023-06-09T09:16:14.961699Z","shell.execute_reply":"2023-06-09T09:16:14.972537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Inference on 25 Randomly Selected Images","metadata":{}},{"cell_type":"code","source":"from pathlib import Path\n\ncompetition_data_path = Path('/kaggle/input/benetech-making-graphs-accessible')\ntrain_path = competition_data_path/'train'\nimages_path = train_path/'images'","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:16:35.571462Z","iopub.execute_input":"2023-06-09T09:16:35.571927Z","iopub.status.idle":"2023-06-09T09:16:35.582875Z","shell.execute_reply.started":"2023-06-09T09:16:35.571884Z","shell.execute_reply":"2023-06-09T09:16:35.581677Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Let's run inference on the 25 randomly selected images in the <a href=\"https://www.kaggle.com/code/sambitmukherjee/dot-scatter-detection-training\" target=\"_blank\">training notebook</a>'s \"Model Evaluation\" section.","metadata":{}},{"cell_type":"code","source":"random_sample = [\n    '8a7867569982.jpg', \n    'f85bb9a1a051.jpg', \n    '737fac2f8edb.jpg', \n    'a8131c4adf39.jpg', \n    '241b5d921b2f.jpg', \n    'bbca26b3abcb.jpg', \n    '4d6d80aed4b7.jpg', \n    '07c882b97e67.jpg', \n    'ffe511433cd1.jpg', \n    '650cd195d2ba.jpg', \n    '2bb6e76a5b35.jpg', \n    '536b28ae1a7e.jpg', \n    '8bbf53f02f90.jpg', \n    'b84525206a6e.jpg', \n    '5fd0b2fd2087.jpg', \n    '68d2ae351e4f.jpg', \n    'edd6276dd20b.jpg', \n    'a96cf5e26a01.jpg', \n    '98e63edc1c82.jpg', \n    '6839aafcf23e.jpg', \n    '6373ef9a9333.jpg', \n    '220436d228aa.jpg', \n    '06f0e45acf73.jpg', \n    '366b69368f99.jpg', \n    '312313d42699.jpg'\n]\nlen(random_sample)","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:04.250433Z","iopub.execute_input":"2023-06-09T09:17:04.251311Z","iopub.status.idle":"2023-06-09T09:17:04.261373Z","shell.execute_reply.started":"2023-06-09T09:17:04.251258Z","shell.execute_reply":"2023-06-09T09:17:04.260194Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from albumentations.pytorch.transforms import ToTensorV2\n\ndot_scatter_transforms = A.Compose([\n    A.LongestMaxSize(always_apply=False, p=1, max_size=640, interpolation=1),\n    A.PadIfNeeded(always_apply=False, p=1.0, min_height=640, min_width=640, pad_height_divisor=None, pad_width_divisor=None, border_mode=0, value=[124, 116, 104], mask_value=None),\n    A.Normalize(always_apply=False, p=1.0, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225), max_pixel_value=255.0), \n    ToTensorV2()\n])\ndot_scatter_transforms","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:09.032015Z","iopub.execute_input":"2023-06-09T09:17:09.032757Z","iopub.status.idle":"2023-06-09T09:17:09.048585Z","shell.execute_reply.started":"2023-06-09T09:17:09.032717Z","shell.execute_reply":"2023-06-09T09:17:09.047415Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from PIL import Image\nimport cv2","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:11.677153Z","iopub.execute_input":"2023-06-09T09:17:11.677591Z","iopub.status.idle":"2023-06-09T09:17:11.683588Z","shell.execute_reply.started":"2023-06-09T09:17:11.677535Z","shell.execute_reply":"2023-06-09T09:17:11.682216Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"score_threshold = 0.5","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:13.254425Z","iopub.execute_input":"2023-06-09T09:17:13.255260Z","iopub.status.idle":"2023-06-09T09:17:13.260615Z","shell.execute_reply.started":"2023-06-09T09:17:13.255220Z","shell.execute_reply":"2023-06-09T09:17:13.259048Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_dot_scatter_bboxes(img_file_name):\n    img = Image.open(images_path/img_file_name)\n    img_arr = np.array(img)\n    transformed = dot_scatter_transforms(image=img_arr)\n    batched = transformed['image'].unsqueeze(0)\n    batched = batched.to(device)\n    with torch.no_grad():\n        out = dot_scatter_model(batched)\n    first_out = out[0]\n    first_out['boxes'] = first_out['boxes'][first_out['scores'] > score_threshold]\n    postprocessed_bboxes = []\n    for box in first_out['boxes']:\n        bbox = BBox(box[0].item(), box[1].item(), box[2].item(), box[3].item())\n        new_bbox = postprocess_bbox(img_size=ImgSize(width=img.size[0], height=img.size[1]), bbox=bbox, transforms=dot_scatter_tfms_list, h_after=640, w_after=640)\n        postprocessed_bboxes.append(list(new_bbox))\n    return postprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:26.862078Z","iopub.execute_input":"2023-06-09T09:17:26.862722Z","iopub.status.idle":"2023-06-09T09:17:26.874144Z","shell.execute_reply.started":"2023-06-09T09:17:26.862683Z","shell.execute_reply":"2023-06-09T09:17:26.872730Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_img_with_bbs(img_file_name, postprocessed_bboxes):\n    img = Image.open(images_path/img_file_name)\n    img_arr = np.array(img)\n    for i in range(len(postprocessed_bboxes)):\n        start_point = postprocessed_bboxes[i][0], postprocessed_bboxes[i][1]\n        end_point = postprocessed_bboxes[i][2], postprocessed_bboxes[i][3]\n        cv2.rectangle(img_arr, start_point, end_point, color=(0, 0, 255), thickness=1)\n    img_with_bbs = Image.fromarray(img_arr)\n    return img_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:30.003960Z","iopub.execute_input":"2023-06-09T09:17:30.004699Z","iopub.status.idle":"2023-06-09T09:17:30.012250Z","shell.execute_reply.started":"2023-06-09T09:17:30.004662Z","shell.execute_reply":"2023-06-09T09:17:30.011129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[0]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:34.727433Z","iopub.execute_input":"2023-06-09T09:17:34.728240Z","iopub.status.idle":"2023-06-09T09:17:34.736385Z","shell.execute_reply.started":"2023-06-09T09:17:34.728201Z","shell.execute_reply":"2023-06-09T09:17:34.735149Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:35.362439Z","iopub.execute_input":"2023-06-09T09:17:35.363174Z","iopub.status.idle":"2023-06-09T09:17:38.931093Z","shell.execute_reply.started":"2023-06-09T09:17:35.363134Z","shell.execute_reply":"2023-06-09T09:17:38.929913Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:38.933179Z","iopub.execute_input":"2023-06-09T09:17:38.934080Z","iopub.status.idle":"2023-06-09T09:17:38.972275Z","shell.execute_reply.started":"2023-06-09T09:17:38.934037Z","shell.execute_reply":"2023-06-09T09:17:38.970967Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[1]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:48.355884Z","iopub.execute_input":"2023-06-09T09:17:48.356938Z","iopub.status.idle":"2023-06-09T09:17:48.363527Z","shell.execute_reply.started":"2023-06-09T09:17:48.356897Z","shell.execute_reply":"2023-06-09T09:17:48.362430Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:48.882792Z","iopub.execute_input":"2023-06-09T09:17:48.883541Z","iopub.status.idle":"2023-06-09T09:17:48.957363Z","shell.execute_reply.started":"2023-06-09T09:17:48.883499Z","shell.execute_reply":"2023-06-09T09:17:48.956275Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:49.001472Z","iopub.execute_input":"2023-06-09T09:17:49.001829Z","iopub.status.idle":"2023-06-09T09:17:49.026821Z","shell.execute_reply.started":"2023-06-09T09:17:49.001795Z","shell.execute_reply":"2023-06-09T09:17:49.025501Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[2]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:55.347806Z","iopub.execute_input":"2023-06-09T09:17:55.348589Z","iopub.status.idle":"2023-06-09T09:17:55.356379Z","shell.execute_reply.started":"2023-06-09T09:17:55.348546Z","shell.execute_reply":"2023-06-09T09:17:55.355039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:55.725504Z","iopub.execute_input":"2023-06-09T09:17:55.725894Z","iopub.status.idle":"2023-06-09T09:17:55.795513Z","shell.execute_reply.started":"2023-06-09T09:17:55.725856Z","shell.execute_reply":"2023-06-09T09:17:55.794403Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:17:56.296907Z","iopub.execute_input":"2023-06-09T09:17:56.298109Z","iopub.status.idle":"2023-06-09T09:17:56.329575Z","shell.execute_reply.started":"2023-06-09T09:17:56.298056Z","shell.execute_reply":"2023-06-09T09:17:56.328343Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[3]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:00.936801Z","iopub.execute_input":"2023-06-09T09:18:00.937218Z","iopub.status.idle":"2023-06-09T09:18:00.945864Z","shell.execute_reply.started":"2023-06-09T09:18:00.937180Z","shell.execute_reply":"2023-06-09T09:18:00.944544Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:01.022116Z","iopub.execute_input":"2023-06-09T09:18:01.022740Z","iopub.status.idle":"2023-06-09T09:18:01.097539Z","shell.execute_reply.started":"2023-06-09T09:18:01.022701Z","shell.execute_reply":"2023-06-09T09:18:01.096464Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:01.119691Z","iopub.execute_input":"2023-06-09T09:18:01.120347Z","iopub.status.idle":"2023-06-09T09:18:01.155876Z","shell.execute_reply.started":"2023-06-09T09:18:01.120312Z","shell.execute_reply":"2023-06-09T09:18:01.154676Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[4]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:07.228673Z","iopub.execute_input":"2023-06-09T09:18:07.229093Z","iopub.status.idle":"2023-06-09T09:18:07.236790Z","shell.execute_reply.started":"2023-06-09T09:18:07.229055Z","shell.execute_reply":"2023-06-09T09:18:07.235498Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:07.358052Z","iopub.execute_input":"2023-06-09T09:18:07.358416Z","iopub.status.idle":"2023-06-09T09:18:07.427553Z","shell.execute_reply.started":"2023-06-09T09:18:07.358382Z","shell.execute_reply":"2023-06-09T09:18:07.426433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:07.761988Z","iopub.execute_input":"2023-06-09T09:18:07.762763Z","iopub.status.idle":"2023-06-09T09:18:07.792210Z","shell.execute_reply.started":"2023-06-09T09:18:07.762721Z","shell.execute_reply":"2023-06-09T09:18:07.791076Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[5]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:13.519490Z","iopub.execute_input":"2023-06-09T09:18:13.520499Z","iopub.status.idle":"2023-06-09T09:18:13.528471Z","shell.execute_reply.started":"2023-06-09T09:18:13.520444Z","shell.execute_reply":"2023-06-09T09:18:13.526988Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:14.065486Z","iopub.execute_input":"2023-06-09T09:18:14.066451Z","iopub.status.idle":"2023-06-09T09:18:14.136220Z","shell.execute_reply.started":"2023-06-09T09:18:14.066397Z","shell.execute_reply":"2023-06-09T09:18:14.134889Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:14.138187Z","iopub.execute_input":"2023-06-09T09:18:14.139228Z","iopub.status.idle":"2023-06-09T09:18:14.167256Z","shell.execute_reply.started":"2023-06-09T09:18:14.139183Z","shell.execute_reply":"2023-06-09T09:18:14.166055Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[6]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:20.487919Z","iopub.execute_input":"2023-06-09T09:18:20.488963Z","iopub.status.idle":"2023-06-09T09:18:20.496830Z","shell.execute_reply.started":"2023-06-09T09:18:20.488923Z","shell.execute_reply":"2023-06-09T09:18:20.495464Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:21.384674Z","iopub.execute_input":"2023-06-09T09:18:21.385443Z","iopub.status.idle":"2023-06-09T09:18:21.452774Z","shell.execute_reply.started":"2023-06-09T09:18:21.385403Z","shell.execute_reply":"2023-06-09T09:18:21.451683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:21.455077Z","iopub.execute_input":"2023-06-09T09:18:21.455478Z","iopub.status.idle":"2023-06-09T09:18:21.484231Z","shell.execute_reply.started":"2023-06-09T09:18:21.455434Z","shell.execute_reply":"2023-06-09T09:18:21.483065Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[7]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:26.126696Z","iopub.execute_input":"2023-06-09T09:18:26.127424Z","iopub.status.idle":"2023-06-09T09:18:26.134467Z","shell.execute_reply.started":"2023-06-09T09:18:26.127378Z","shell.execute_reply":"2023-06-09T09:18:26.133202Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:26.629887Z","iopub.execute_input":"2023-06-09T09:18:26.631100Z","iopub.status.idle":"2023-06-09T09:18:26.712122Z","shell.execute_reply.started":"2023-06-09T09:18:26.631046Z","shell.execute_reply":"2023-06-09T09:18:26.710981Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:26.778762Z","iopub.execute_input":"2023-06-09T09:18:26.779427Z","iopub.status.idle":"2023-06-09T09:18:26.810698Z","shell.execute_reply.started":"2023-06-09T09:18:26.779372Z","shell.execute_reply":"2023-06-09T09:18:26.809384Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[8]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:33.993026Z","iopub.execute_input":"2023-06-09T09:18:33.993779Z","iopub.status.idle":"2023-06-09T09:18:34.000985Z","shell.execute_reply.started":"2023-06-09T09:18:33.993739Z","shell.execute_reply":"2023-06-09T09:18:33.999810Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:34.119206Z","iopub.execute_input":"2023-06-09T09:18:34.119573Z","iopub.status.idle":"2023-06-09T09:18:34.191262Z","shell.execute_reply.started":"2023-06-09T09:18:34.119532Z","shell.execute_reply":"2023-06-09T09:18:34.190159Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:34.193326Z","iopub.execute_input":"2023-06-09T09:18:34.194028Z","iopub.status.idle":"2023-06-09T09:18:34.223220Z","shell.execute_reply.started":"2023-06-09T09:18:34.193969Z","shell.execute_reply":"2023-06-09T09:18:34.222064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[9]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:39.734375Z","iopub.execute_input":"2023-06-09T09:18:39.734787Z","iopub.status.idle":"2023-06-09T09:18:39.742340Z","shell.execute_reply.started":"2023-06-09T09:18:39.734751Z","shell.execute_reply":"2023-06-09T09:18:39.741077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:40.264434Z","iopub.execute_input":"2023-06-09T09:18:40.264922Z","iopub.status.idle":"2023-06-09T09:18:40.364734Z","shell.execute_reply.started":"2023-06-09T09:18:40.264867Z","shell.execute_reply":"2023-06-09T09:18:40.363400Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:40.370388Z","iopub.execute_input":"2023-06-09T09:18:40.370793Z","iopub.status.idle":"2023-06-09T09:18:40.417454Z","shell.execute_reply.started":"2023-06-09T09:18:40.370753Z","shell.execute_reply":"2023-06-09T09:18:40.416515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[10]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:45.521472Z","iopub.execute_input":"2023-06-09T09:18:45.522652Z","iopub.status.idle":"2023-06-09T09:18:45.534446Z","shell.execute_reply.started":"2023-06-09T09:18:45.522610Z","shell.execute_reply":"2023-06-09T09:18:45.533083Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:45.660792Z","iopub.execute_input":"2023-06-09T09:18:45.661168Z","iopub.status.idle":"2023-06-09T09:18:45.730544Z","shell.execute_reply.started":"2023-06-09T09:18:45.661134Z","shell.execute_reply":"2023-06-09T09:18:45.729409Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:46.027218Z","iopub.execute_input":"2023-06-09T09:18:46.027797Z","iopub.status.idle":"2023-06-09T09:18:46.063299Z","shell.execute_reply.started":"2023-06-09T09:18:46.027749Z","shell.execute_reply":"2023-06-09T09:18:46.062237Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[11]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:50.746380Z","iopub.execute_input":"2023-06-09T09:18:50.746783Z","iopub.status.idle":"2023-06-09T09:18:50.754472Z","shell.execute_reply.started":"2023-06-09T09:18:50.746747Z","shell.execute_reply":"2023-06-09T09:18:50.753074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:50.804807Z","iopub.execute_input":"2023-06-09T09:18:50.805467Z","iopub.status.idle":"2023-06-09T09:18:50.872697Z","shell.execute_reply.started":"2023-06-09T09:18:50.805424Z","shell.execute_reply":"2023-06-09T09:18:50.870963Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:51.269491Z","iopub.execute_input":"2023-06-09T09:18:51.270428Z","iopub.status.idle":"2023-06-09T09:18:51.293827Z","shell.execute_reply.started":"2023-06-09T09:18:51.270378Z","shell.execute_reply":"2023-06-09T09:18:51.292769Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[12]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:59.133505Z","iopub.execute_input":"2023-06-09T09:18:59.134508Z","iopub.status.idle":"2023-06-09T09:18:59.142375Z","shell.execute_reply.started":"2023-06-09T09:18:59.134452Z","shell.execute_reply":"2023-06-09T09:18:59.141059Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:59.664632Z","iopub.execute_input":"2023-06-09T09:18:59.665061Z","iopub.status.idle":"2023-06-09T09:18:59.736667Z","shell.execute_reply.started":"2023-06-09T09:18:59.665019Z","shell.execute_reply":"2023-06-09T09:18:59.735576Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:18:59.738856Z","iopub.execute_input":"2023-06-09T09:18:59.739543Z","iopub.status.idle":"2023-06-09T09:18:59.770188Z","shell.execute_reply.started":"2023-06-09T09:18:59.739503Z","shell.execute_reply":"2023-06-09T09:18:59.768968Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[13]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:04.905718Z","iopub.execute_input":"2023-06-09T09:19:04.906294Z","iopub.status.idle":"2023-06-09T09:19:04.915339Z","shell.execute_reply.started":"2023-06-09T09:19:04.906252Z","shell.execute_reply":"2023-06-09T09:19:04.913820Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:05.428983Z","iopub.execute_input":"2023-06-09T09:19:05.429697Z","iopub.status.idle":"2023-06-09T09:19:05.500729Z","shell.execute_reply.started":"2023-06-09T09:19:05.429658Z","shell.execute_reply":"2023-06-09T09:19:05.499531Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:05.502768Z","iopub.execute_input":"2023-06-09T09:19:05.503811Z","iopub.status.idle":"2023-06-09T09:19:05.532747Z","shell.execute_reply.started":"2023-06-09T09:19:05.503756Z","shell.execute_reply":"2023-06-09T09:19:05.531736Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[14]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:11.196942Z","iopub.execute_input":"2023-06-09T09:19:11.197647Z","iopub.status.idle":"2023-06-09T09:19:11.204961Z","shell.execute_reply.started":"2023-06-09T09:19:11.197606Z","shell.execute_reply":"2023-06-09T09:19:11.203776Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:11.722469Z","iopub.execute_input":"2023-06-09T09:19:11.723769Z","iopub.status.idle":"2023-06-09T09:19:11.834973Z","shell.execute_reply.started":"2023-06-09T09:19:11.723714Z","shell.execute_reply":"2023-06-09T09:19:11.833946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:11.836811Z","iopub.execute_input":"2023-06-09T09:19:11.837447Z","iopub.status.idle":"2023-06-09T09:19:11.875472Z","shell.execute_reply.started":"2023-06-09T09:19:11.837408Z","shell.execute_reply":"2023-06-09T09:19:11.874488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[15]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:18.010645Z","iopub.execute_input":"2023-06-09T09:19:18.011079Z","iopub.status.idle":"2023-06-09T09:19:18.018145Z","shell.execute_reply.started":"2023-06-09T09:19:18.011030Z","shell.execute_reply":"2023-06-09T09:19:18.017083Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:18.533720Z","iopub.execute_input":"2023-06-09T09:19:18.534140Z","iopub.status.idle":"2023-06-09T09:19:18.604497Z","shell.execute_reply.started":"2023-06-09T09:19:18.534102Z","shell.execute_reply":"2023-06-09T09:19:18.603361Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:18.606624Z","iopub.execute_input":"2023-06-09T09:19:18.607315Z","iopub.status.idle":"2023-06-09T09:19:18.634564Z","shell.execute_reply.started":"2023-06-09T09:19:18.607274Z","shell.execute_reply":"2023-06-09T09:19:18.633401Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[16]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:23.776963Z","iopub.execute_input":"2023-06-09T09:19:23.777718Z","iopub.status.idle":"2023-06-09T09:19:23.785244Z","shell.execute_reply.started":"2023-06-09T09:19:23.777677Z","shell.execute_reply":"2023-06-09T09:19:23.784127Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:24.299969Z","iopub.execute_input":"2023-06-09T09:19:24.301358Z","iopub.status.idle":"2023-06-09T09:19:24.379629Z","shell.execute_reply.started":"2023-06-09T09:19:24.301308Z","shell.execute_reply":"2023-06-09T09:19:24.378384Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:24.381982Z","iopub.execute_input":"2023-06-09T09:19:24.382719Z","iopub.status.idle":"2023-06-09T09:19:24.413854Z","shell.execute_reply.started":"2023-06-09T09:19:24.382678Z","shell.execute_reply":"2023-06-09T09:19:24.412790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[17]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:28.496125Z","iopub.execute_input":"2023-06-09T09:19:28.496534Z","iopub.status.idle":"2023-06-09T09:19:28.504090Z","shell.execute_reply.started":"2023-06-09T09:19:28.496496Z","shell.execute_reply":"2023-06-09T09:19:28.502972Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:28.673027Z","iopub.execute_input":"2023-06-09T09:19:28.673395Z","iopub.status.idle":"2023-06-09T09:19:28.742881Z","shell.execute_reply.started":"2023-06-09T09:19:28.673363Z","shell.execute_reply":"2023-06-09T09:19:28.741764Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:29.018425Z","iopub.execute_input":"2023-06-09T09:19:29.019470Z","iopub.status.idle":"2023-06-09T09:19:29.048414Z","shell.execute_reply.started":"2023-06-09T09:19:29.019421Z","shell.execute_reply":"2023-06-09T09:19:29.047257Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[18]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:34.786501Z","iopub.execute_input":"2023-06-09T09:19:34.786885Z","iopub.status.idle":"2023-06-09T09:19:34.795402Z","shell.execute_reply.started":"2023-06-09T09:19:34.786851Z","shell.execute_reply":"2023-06-09T09:19:34.794082Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:34.840861Z","iopub.execute_input":"2023-06-09T09:19:34.841655Z","iopub.status.idle":"2023-06-09T09:19:34.911440Z","shell.execute_reply.started":"2023-06-09T09:19:34.841622Z","shell.execute_reply":"2023-06-09T09:19:34.910314Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:34.951147Z","iopub.execute_input":"2023-06-09T09:19:34.951768Z","iopub.status.idle":"2023-06-09T09:19:34.974598Z","shell.execute_reply.started":"2023-06-09T09:19:34.951723Z","shell.execute_reply":"2023-06-09T09:19:34.973422Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[19]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:38.520626Z","iopub.execute_input":"2023-06-09T09:19:38.521843Z","iopub.status.idle":"2023-06-09T09:19:38.529576Z","shell.execute_reply.started":"2023-06-09T09:19:38.521791Z","shell.execute_reply":"2023-06-09T09:19:38.528260Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:38.980840Z","iopub.execute_input":"2023-06-09T09:19:38.981985Z","iopub.status.idle":"2023-06-09T09:19:39.064529Z","shell.execute_reply.started":"2023-06-09T09:19:38.981934Z","shell.execute_reply":"2023-06-09T09:19:39.063428Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:39.066521Z","iopub.execute_input":"2023-06-09T09:19:39.067550Z","iopub.status.idle":"2023-06-09T09:19:39.098967Z","shell.execute_reply.started":"2023-06-09T09:19:39.067507Z","shell.execute_reply":"2023-06-09T09:19:39.097962Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[20]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:43.365572Z","iopub.execute_input":"2023-06-09T09:19:43.366664Z","iopub.status.idle":"2023-06-09T09:19:43.374912Z","shell.execute_reply.started":"2023-06-09T09:19:43.366616Z","shell.execute_reply":"2023-06-09T09:19:43.373204Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:43.720902Z","iopub.execute_input":"2023-06-09T09:19:43.721929Z","iopub.status.idle":"2023-06-09T09:19:43.797892Z","shell.execute_reply.started":"2023-06-09T09:19:43.721888Z","shell.execute_reply":"2023-06-09T09:19:43.796772Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:43.821024Z","iopub.execute_input":"2023-06-09T09:19:43.821806Z","iopub.status.idle":"2023-06-09T09:19:43.850186Z","shell.execute_reply.started":"2023-06-09T09:19:43.821762Z","shell.execute_reply":"2023-06-09T09:19:43.849062Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[21]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:47.894443Z","iopub.execute_input":"2023-06-09T09:19:47.895247Z","iopub.status.idle":"2023-06-09T09:19:47.908283Z","shell.execute_reply.started":"2023-06-09T09:19:47.895195Z","shell.execute_reply":"2023-06-09T09:19:47.906838Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:48.418975Z","iopub.execute_input":"2023-06-09T09:19:48.420056Z","iopub.status.idle":"2023-06-09T09:19:48.487747Z","shell.execute_reply.started":"2023-06-09T09:19:48.419979Z","shell.execute_reply":"2023-06-09T09:19:48.486649Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:48.492024Z","iopub.execute_input":"2023-06-09T09:19:48.492338Z","iopub.status.idle":"2023-06-09T09:19:48.516837Z","shell.execute_reply.started":"2023-06-09T09:19:48.492307Z","shell.execute_reply":"2023-06-09T09:19:48.515662Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[22]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:52.150735Z","iopub.execute_input":"2023-06-09T09:19:52.151899Z","iopub.status.idle":"2023-06-09T09:19:52.159910Z","shell.execute_reply.started":"2023-06-09T09:19:52.151850Z","shell.execute_reply":"2023-06-09T09:19:52.158417Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:52.614408Z","iopub.execute_input":"2023-06-09T09:19:52.614809Z","iopub.status.idle":"2023-06-09T09:19:52.687505Z","shell.execute_reply.started":"2023-06-09T09:19:52.614772Z","shell.execute_reply":"2023-06-09T09:19:52.686430Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:52.689475Z","iopub.execute_input":"2023-06-09T09:19:52.690524Z","iopub.status.idle":"2023-06-09T09:19:52.724258Z","shell.execute_reply.started":"2023-06-09T09:19:52.690482Z","shell.execute_reply":"2023-06-09T09:19:52.723228Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[23]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:56.326347Z","iopub.execute_input":"2023-06-09T09:19:56.326985Z","iopub.status.idle":"2023-06-09T09:19:56.335139Z","shell.execute_reply.started":"2023-06-09T09:19:56.326945Z","shell.execute_reply":"2023-06-09T09:19:56.333989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:56.805922Z","iopub.execute_input":"2023-06-09T09:19:56.807104Z","iopub.status.idle":"2023-06-09T09:19:56.883424Z","shell.execute_reply.started":"2023-06-09T09:19:56.807053Z","shell.execute_reply":"2023-06-09T09:19:56.882227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:19:56.887024Z","iopub.execute_input":"2023-06-09T09:19:56.887955Z","iopub.status.idle":"2023-06-09T09:19:56.917804Z","shell.execute_reply.started":"2023-06-09T09:19:56.887902Z","shell.execute_reply":"2023-06-09T09:19:56.916783Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = random_sample[24]\nimg_file_name","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:01.578242Z","iopub.execute_input":"2023-06-09T09:20:01.578854Z","iopub.status.idle":"2023-06-09T09:20:01.585895Z","shell.execute_reply.started":"2023-06-09T09:20:01.578813Z","shell.execute_reply":"2023-06-09T09:20:01.584688Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:02.048960Z","iopub.execute_input":"2023-06-09T09:20:02.049942Z","iopub.status.idle":"2023-06-09T09:20:02.256027Z","shell.execute_reply.started":"2023-06-09T09:20:02.049891Z","shell.execute_reply":"2023-06-09T09:20:02.254903Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:02.257917Z","iopub.execute_input":"2023-06-09T09:20:02.258925Z","iopub.status.idle":"2023-06-09T09:20:02.287067Z","shell.execute_reply.started":"2023-06-09T09:20:02.258881Z","shell.execute_reply":"2023-06-09T09:20:02.285835Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Inference on 12 Top Loss Images","metadata":{}},{"cell_type":"markdown","source":"Let's run inference on the 12 top loss images from the <a href=\"https://www.kaggle.com/code/sambitmukherjee/dot-scatter-detection-training\" target=\"_blank\">training notebook</a>'s \"Model Evaluation\" section.","metadata":{}},{"cell_type":"code","source":"top_loss_images = [\n    'c6350443191a.jpg',\n    '366b69368f99.jpg',\n    '536b28ae1a7e.jpg',\n    '9b62dbdded7b.jpg',\n    'ca30ad3528c4.jpg',\n    'c226d88f9d0d.jpg',\n    '00f5404753cf.jpg',\n    '5fd0b2fd2087.jpg', \n    '0ccb2bf2bafd.jpg',\n    'b99a20b437b4.jpg', \n    '6ae113ad2454.jpg', \n    'c7c5aeda29c3.jpg'\n]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:27.742021Z","iopub.execute_input":"2023-06-09T09:20:27.743152Z","iopub.status.idle":"2023-06-09T09:20:27.748722Z","shell.execute_reply.started":"2023-06-09T09:20:27.743111Z","shell.execute_reply":"2023-06-09T09:20:27.747516Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[0]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:31.033301Z","iopub.execute_input":"2023-06-09T09:20:31.033709Z","iopub.status.idle":"2023-06-09T09:20:31.038695Z","shell.execute_reply.started":"2023-06-09T09:20:31.033674Z","shell.execute_reply":"2023-06-09T09:20:31.037423Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:31.414226Z","iopub.execute_input":"2023-06-09T09:20:31.414840Z","iopub.status.idle":"2023-06-09T09:20:31.487247Z","shell.execute_reply.started":"2023-06-09T09:20:31.414799Z","shell.execute_reply":"2023-06-09T09:20:31.486072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:31.641118Z","iopub.execute_input":"2023-06-09T09:20:31.641776Z","iopub.status.idle":"2023-06-09T09:20:31.674512Z","shell.execute_reply.started":"2023-06-09T09:20:31.641740Z","shell.execute_reply":"2023-06-09T09:20:31.673367Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[1]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:35.840941Z","iopub.execute_input":"2023-06-09T09:20:35.842174Z","iopub.status.idle":"2023-06-09T09:20:35.848212Z","shell.execute_reply.started":"2023-06-09T09:20:35.842132Z","shell.execute_reply":"2023-06-09T09:20:35.846601Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:36.154004Z","iopub.execute_input":"2023-06-09T09:20:36.154388Z","iopub.status.idle":"2023-06-09T09:20:36.226174Z","shell.execute_reply.started":"2023-06-09T09:20:36.154353Z","shell.execute_reply":"2023-06-09T09:20:36.225062Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:36.244786Z","iopub.execute_input":"2023-06-09T09:20:36.245648Z","iopub.status.idle":"2023-06-09T09:20:36.275723Z","shell.execute_reply.started":"2023-06-09T09:20:36.245606Z","shell.execute_reply":"2023-06-09T09:20:36.274563Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[2]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:40.517924Z","iopub.execute_input":"2023-06-09T09:20:40.518692Z","iopub.status.idle":"2023-06-09T09:20:40.523847Z","shell.execute_reply.started":"2023-06-09T09:20:40.518652Z","shell.execute_reply":"2023-06-09T09:20:40.522732Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:40.849871Z","iopub.execute_input":"2023-06-09T09:20:40.850612Z","iopub.status.idle":"2023-06-09T09:20:40.915011Z","shell.execute_reply.started":"2023-06-09T09:20:40.850571Z","shell.execute_reply":"2023-06-09T09:20:40.913916Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:41.053229Z","iopub.execute_input":"2023-06-09T09:20:41.053564Z","iopub.status.idle":"2023-06-09T09:20:41.077195Z","shell.execute_reply.started":"2023-06-09T09:20:41.053532Z","shell.execute_reply":"2023-06-09T09:20:41.076041Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[3]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:45.043380Z","iopub.execute_input":"2023-06-09T09:20:45.043779Z","iopub.status.idle":"2023-06-09T09:20:45.049137Z","shell.execute_reply.started":"2023-06-09T09:20:45.043743Z","shell.execute_reply":"2023-06-09T09:20:45.047987Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:45.113714Z","iopub.execute_input":"2023-06-09T09:20:45.114055Z","iopub.status.idle":"2023-06-09T09:20:45.181616Z","shell.execute_reply.started":"2023-06-09T09:20:45.114021Z","shell.execute_reply":"2023-06-09T09:20:45.180568Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:45.213819Z","iopub.execute_input":"2023-06-09T09:20:45.214162Z","iopub.status.idle":"2023-06-09T09:20:45.239156Z","shell.execute_reply.started":"2023-06-09T09:20:45.214130Z","shell.execute_reply":"2023-06-09T09:20:45.238019Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[4]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:49.306056Z","iopub.execute_input":"2023-06-09T09:20:49.306805Z","iopub.status.idle":"2023-06-09T09:20:49.312122Z","shell.execute_reply.started":"2023-06-09T09:20:49.306766Z","shell.execute_reply":"2023-06-09T09:20:49.310827Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:49.494778Z","iopub.execute_input":"2023-06-09T09:20:49.495895Z","iopub.status.idle":"2023-06-09T09:20:49.567527Z","shell.execute_reply.started":"2023-06-09T09:20:49.495834Z","shell.execute_reply":"2023-06-09T09:20:49.566419Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:49.839274Z","iopub.execute_input":"2023-06-09T09:20:49.839669Z","iopub.status.idle":"2023-06-09T09:20:49.866215Z","shell.execute_reply.started":"2023-06-09T09:20:49.839632Z","shell.execute_reply":"2023-06-09T09:20:49.865067Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[5]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:54.140676Z","iopub.execute_input":"2023-06-09T09:20:54.141639Z","iopub.status.idle":"2023-06-09T09:20:54.147073Z","shell.execute_reply.started":"2023-06-09T09:20:54.141597Z","shell.execute_reply":"2023-06-09T09:20:54.145697Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:54.534785Z","iopub.execute_input":"2023-06-09T09:20:54.535935Z","iopub.status.idle":"2023-06-09T09:20:54.608874Z","shell.execute_reply.started":"2023-06-09T09:20:54.535863Z","shell.execute_reply":"2023-06-09T09:20:54.607734Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:54.610809Z","iopub.execute_input":"2023-06-09T09:20:54.611821Z","iopub.status.idle":"2023-06-09T09:20:54.664044Z","shell.execute_reply.started":"2023-06-09T09:20:54.611778Z","shell.execute_reply":"2023-06-09T09:20:54.662937Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[6]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:20:59.734802Z","iopub.execute_input":"2023-06-09T09:20:59.735558Z","iopub.status.idle":"2023-06-09T09:20:59.740413Z","shell.execute_reply.started":"2023-06-09T09:20:59.735517Z","shell.execute_reply":"2023-06-09T09:20:59.739185Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:00.287850Z","iopub.execute_input":"2023-06-09T09:21:00.288580Z","iopub.status.idle":"2023-06-09T09:21:00.365077Z","shell.execute_reply.started":"2023-06-09T09:21:00.288540Z","shell.execute_reply":"2023-06-09T09:21:00.363936Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:00.367290Z","iopub.execute_input":"2023-06-09T09:21:00.368032Z","iopub.status.idle":"2023-06-09T09:21:00.395553Z","shell.execute_reply.started":"2023-06-09T09:21:00.367975Z","shell.execute_reply":"2023-06-09T09:21:00.394380Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[7]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:05.501387Z","iopub.execute_input":"2023-06-09T09:21:05.502057Z","iopub.status.idle":"2023-06-09T09:21:05.507139Z","shell.execute_reply.started":"2023-06-09T09:21:05.501989Z","shell.execute_reply":"2023-06-09T09:21:05.505977Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:06.016291Z","iopub.execute_input":"2023-06-09T09:21:06.017305Z","iopub.status.idle":"2023-06-09T09:21:06.083458Z","shell.execute_reply.started":"2023-06-09T09:21:06.017255Z","shell.execute_reply":"2023-06-09T09:21:06.082339Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:06.105200Z","iopub.execute_input":"2023-06-09T09:21:06.106062Z","iopub.status.idle":"2023-06-09T09:21:06.134185Z","shell.execute_reply.started":"2023-06-09T09:21:06.106018Z","shell.execute_reply":"2023-06-09T09:21:06.133045Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[8]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:11.262068Z","iopub.execute_input":"2023-06-09T09:21:11.263088Z","iopub.status.idle":"2023-06-09T09:21:11.269326Z","shell.execute_reply.started":"2023-06-09T09:21:11.263028Z","shell.execute_reply":"2023-06-09T09:21:11.267735Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:11.456926Z","iopub.execute_input":"2023-06-09T09:21:11.458084Z","iopub.status.idle":"2023-06-09T09:21:11.535596Z","shell.execute_reply.started":"2023-06-09T09:21:11.458036Z","shell.execute_reply":"2023-06-09T09:21:11.534489Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:11.785907Z","iopub.execute_input":"2023-06-09T09:21:11.786886Z","iopub.status.idle":"2023-06-09T09:21:11.815772Z","shell.execute_reply.started":"2023-06-09T09:21:11.786837Z","shell.execute_reply":"2023-06-09T09:21:11.814666Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[9]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:15.980372Z","iopub.execute_input":"2023-06-09T09:21:15.980764Z","iopub.status.idle":"2023-06-09T09:21:15.986294Z","shell.execute_reply.started":"2023-06-09T09:21:15.980731Z","shell.execute_reply":"2023-06-09T09:21:15.985053Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:16.219199Z","iopub.execute_input":"2023-06-09T09:21:16.219897Z","iopub.status.idle":"2023-06-09T09:21:16.284543Z","shell.execute_reply.started":"2023-06-09T09:21:16.219850Z","shell.execute_reply":"2023-06-09T09:21:16.283449Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:16.507671Z","iopub.execute_input":"2023-06-09T09:21:16.508438Z","iopub.status.idle":"2023-06-09T09:21:16.534946Z","shell.execute_reply.started":"2023-06-09T09:21:16.508399Z","shell.execute_reply":"2023-06-09T09:21:16.533809Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[10]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:21.747764Z","iopub.execute_input":"2023-06-09T09:21:21.748184Z","iopub.status.idle":"2023-06-09T09:21:21.753505Z","shell.execute_reply.started":"2023-06-09T09:21:21.748145Z","shell.execute_reply":"2023-06-09T09:21:21.752232Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:22.270095Z","iopub.execute_input":"2023-06-09T09:21:22.271131Z","iopub.status.idle":"2023-06-09T09:21:22.356757Z","shell.execute_reply.started":"2023-06-09T09:21:22.271076Z","shell.execute_reply":"2023-06-09T09:21:22.355524Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:22.358787Z","iopub.execute_input":"2023-06-09T09:21:22.359754Z","iopub.status.idle":"2023-06-09T09:21:22.400625Z","shell.execute_reply.started":"2023-06-09T09:21:22.359711Z","shell.execute_reply":"2023-06-09T09:21:22.399594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"img_file_name = top_loss_images[11]","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:26.685119Z","iopub.execute_input":"2023-06-09T09:21:26.685839Z","iopub.status.idle":"2023-06-09T09:21:26.690821Z","shell.execute_reply.started":"2023-06-09T09:21:26.685798Z","shell.execute_reply":"2023-06-09T09:21:26.689639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npostprocessed_bboxes = get_dot_scatter_bboxes(img_file_name)\npostprocessed_bboxes","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:26.714974Z","iopub.execute_input":"2023-06-09T09:21:26.715751Z","iopub.status.idle":"2023-06-09T09:21:26.785515Z","shell.execute_reply.started":"2023-06-09T09:21:26.715718Z","shell.execute_reply":"2023-06-09T09:21:26.784410Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img_with_bbs = get_img_with_bbs(img_file_name, postprocessed_bboxes)\nimg_with_bbs","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:27.208500Z","iopub.execute_input":"2023-06-09T09:21:27.208965Z","iopub.status.idle":"2023-06-09T09:21:27.244723Z","shell.execute_reply.started":"2023-06-09T09:21:27.208923Z","shell.execute_reply":"2023-06-09T09:21:27.243567Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"---","metadata":{}},{"cell_type":"code","source":"print(\"That's all!\")","metadata":{"execution":{"iopub.status.busy":"2023-06-09T09:21:33.547518Z","iopub.execute_input":"2023-06-09T09:21:33.548498Z","iopub.status.idle":"2023-06-09T09:21:33.555433Z","shell.execute_reply.started":"2023-06-09T09:21:33.548439Z","shell.execute_reply":"2023-06-09T09:21:33.553940Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}