{"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":"# **Install MMDetection and MMDetection-Compatible Torch**","metadata":{}},{"cell_type":"code","source":"!pip install '/kaggle/input/pytorch-170-cuda-toolkit-110221/torch-1.7.0+cu110-cp37-cp37m-linux_x86_64.whl' --no-deps\n!pip install '/kaggle/input/pytorch-170-cuda-toolkit-110221/torchvision-0.8.1+cu110-cp37-cp37m-linux_x86_64.whl' --no-deps\n!pip install '/kaggle/input/pytorch-170-cuda-toolkit-110221/torchaudio-0.7.0-cp37-cp37m-linux_x86_64.whl' --no-deps","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:40:04.184834Z","iopub.execute_input":"2023-03-19T19:40:04.185224Z","iopub.status.idle":"2023-03-19T19:41:02.303743Z","shell.execute_reply.started":"2023-03-19T19:40:04.185135Z","shell.execute_reply":"2023-03-19T19:41:02.302834Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# !pip install '/kaggle/input/no-shuffle-mmdetectionv2140/archive (4)/addict-2.4.0-py3-none-any.whl' --no-deps\n# !pip install '/kaggle/input/no-shuffle-mmdetectionv2140/archive (4)/yapf-0.31.0-py2.py3-none-any.whl' --no-deps\n# !pip install '/kaggle/input/no-shuffle-mmdetectionv2140/archive (4)/terminal-0.4.0-py3-none-any.whl' --no-deps\n# !pip install '/kaggle/input/no-shuffle-mmdetectionv2140/archive (4)/terminaltables-3.1.0-py3-none-any.whl' --no-deps\n# !pip install '/kaggle/input/no-shuffle-mmdetectionv2140/archive (4)/mmcv_full-1_3_8-cu110-torch1_7_0/mmcv_full-1.3.8-cp37-cp37m-manylinux1_x86_64.whl' --no-deps\n# !pip install '/kaggle/input/no-shuffle-mmdetectionv2140/archive (4)/pycocotools-2.0.2/pycocotools-2.0.2' --no-deps\n# !pip install '/kaggle/input/no-shuffle-mmdetectionv2140/archive (4)/mmpycocotools-12.0.3/mmpycocotools-12.0.3' --no-deps\n# !rm -rf mmdetection\n# !cp -r '/kaggle/input/no-shuffle-mmdetectionv2140/archive (4)/mmdetection-2.14.0' '/kaggle/working/'\n# !mv /kaggle/working/mmdetection-2.14.0 /kaggle/working/mmdetection\n# %cd /kaggle/working/mmdetection\n# !pip install -e .","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:41:02.306966Z","iopub.execute_input":"2023-03-19T19:41:02.307529Z","iopub.status.idle":"2023-03-19T19:41:02.312322Z","shell.execute_reply.started":"2023-03-19T19:41:02.307480Z","shell.execute_reply":"2023-03-19T19:41:02.311495Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install '/kaggle/input/mmdetectionv2140/addict-2.4.0-py3-none-any.whl' --no-deps\n!pip install '/kaggle/input/mmdetectionv2140/yapf-0.31.0-py2.py3-none-any.whl' --no-deps\n!pip install '/kaggle/input/mmdetectionv2140/terminal-0.4.0-py3-none-any.whl' --no-deps\n!pip install '/kaggle/input/mmdetectionv2140/terminaltables-3.1.0-py3-none-any.whl' --no-deps\n!pip install '/kaggle/input/mmdetectionv2140/mmcv_full-1_3_8-cu110-torch1_7_0/mmcv_full-1.3.8-cp37-cp37m-manylinux1_x86_64.whl' --no-deps\n!pip install '/kaggle/input/mmdetectionv2140/pycocotools-2.0.2/pycocotools-2.0.2' --no-deps\n!pip install '/kaggle/input/mmdetectionv2140/mmpycocotools-12.0.3/mmpycocotools-12.0.3' --no-deps\n!rm -rf mmdetection\n!cp -r '/kaggle/input/mmdetectionv2140/mmdetection-2.14.0' '/kaggle/working/'\n!mv /kaggle/working/mmdetection-2.14.0 /kaggle/working/mmdetection\n%cd /kaggle/working/mmdetection\n!pip install -e .","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:41:02.313273Z","iopub.execute_input":"2023-03-19T19:41:02.313515Z","iopub.status.idle":"2023-03-19T19:41:56.469382Z","shell.execute_reply.started":"2023-03-19T19:41:02.313483Z","shell.execute_reply":"2023-03-19T19:41:56.468517Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **Import Libraries** ","metadata":{}},{"cell_type":"code","source":"import torch\nimport torch.nn as nn\nimport torchvision.transforms as transforms\nimport torch.nn.functional as F\nimport sklearn\nimport torchvision\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import LabelEncoder\nimport numpy as np\nimport pandas as pd\nimport os\nimport matplotlib.pyplot as plt\nimport PIL\nimport json\nfrom PIL import Image, ImageEnhance\nimport albumentations as A\nimport mmdet\nimport mmcv\nfrom albumentations.pytorch import ToTensorV2\nimport seaborn as sns\nimport glob\nfrom pathlib import Path\nimport pycocotools\nfrom pycocotools import mask\nimport numpy.random\nimport random\nimport cv2\nimport re\nfrom mmdet.datasets import build_dataset\nfrom mmdet.models import build_detector\nfrom mmdet.apis import train_detector\nfrom mmdet.apis import inference_detector, init_detector, show_result_pyplot, set_random_seed\nfrom pycocotools.coco import COCO\nfrom pathlib import Path\nfrom PIL import Image\nimport PIL","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-19T19:41:56.473607Z","iopub.execute_input":"2023-03-19T19:41:56.473842Z","iopub.status.idle":"2023-03-19T19:42:16.041968Z","shell.execute_reply.started":"2023-03-19T19:41:56.473815Z","shell.execute_reply":"2023-03-19T19:42:16.041055Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd ..","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:16.043643Z","iopub.execute_input":"2023-03-19T19:42:16.043919Z","iopub.status.idle":"2023-03-19T19:42:16.052638Z","shell.execute_reply.started":"2023-03-19T19:42:16.043882Z","shell.execute_reply":"2023-03-19T19:42:16.050873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!git clone https://github.com/akarazniewicz/cocosplit","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:16.054311Z","iopub.execute_input":"2023-03-19T19:42:16.054714Z","iopub.status.idle":"2023-03-19T19:42:16.911032Z","shell.execute_reply.started":"2023-03-19T19:42:16.054649Z","shell.execute_reply":"2023-03-19T19:42:16.910151Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# !python ./cocosplit/cocosplit.py --having-annotations -s 0.9 /kaggle/input/uavvaste-dataset/uavvaste-github/annotations/annotations.json train.json val.json","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:16.912847Z","iopub.execute_input":"2023-03-19T19:42:16.914446Z","iopub.status.idle":"2023-03-19T19:42:16.919086Z","shell.execute_reply.started":"2023-03-19T19:42:16.914405Z","shell.execute_reply":"2023-03-19T19:42:16.917949Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!python ./cocosplit/cocosplit.py --having-annotations -s 0.9 /kaggle/input/fixed/annotations.json fixed_train.json fixed_val.json","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:16.920618Z","iopub.execute_input":"2023-03-19T19:42:16.920991Z","iopub.status.idle":"2023-03-19T19:42:18.410160Z","shell.execute_reply.started":"2023-03-19T19:42:16.920955Z","shell.execute_reply":"2023-03-19T19:42:18.409305Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **Data Visualizations**","metadata":{}},{"cell_type":"code","source":"dataDir = Path('/kaggle/input/uavvaste-dataset/uavvaste-github/images')\nannFile = Path('/kaggle/working/fixed_train.json')\ncoco = COCO(annFile)\nimgIds = coco.getImgIds()","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:18.412184Z","iopub.execute_input":"2023-03-19T19:42:18.412526Z","iopub.status.idle":"2023-03-19T19:42:18.442078Z","shell.execute_reply.started":"2023-03-19T19:42:18.412488Z","shell.execute_reply":"2023-03-19T19:42:18.441227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"imgs = coco.loadImgs(imgIds[-5:-3])\n_,axs = plt.subplots(len(imgs),2,figsize=(40,15 * len(imgs)))\nfor img, ax in zip(imgs, axs):\n    I = Image.open(dataDir/img['file_name'])\n    annIds = coco.getAnnIds(imgIds=[img['id']])\n    anns = coco.loadAnns(annIds)\n    ax[0].imshow(I)\n    ax[1].imshow(I)\n    plt.sca(ax[1])\n    coco.showAnns(anns, draw_bbox=True)","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:18.445031Z","iopub.execute_input":"2023-03-19T19:42:18.445402Z","iopub.status.idle":"2023-03-19T19:42:23.877673Z","shell.execute_reply.started":"2023-03-19T19:42:18.445362Z","shell.execute_reply":"2023-03-19T19:42:23.876582Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%writefile labels.txt\nrubbish","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:23.879089Z","iopub.execute_input":"2023-03-19T19:42:23.880804Z","iopub.status.idle":"2023-03-19T19:42:23.887204Z","shell.execute_reply.started":"2023-03-19T19:42:23.880751Z","shell.execute_reply":"2023-03-19T19:42:23.886554Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **Model Config**","metadata":{}},{"cell_type":"code","source":"from mmcv import Config\ncfg = Config.fromfile('/kaggle/working/mmdetection/configs/cascade_rcnn/cascade_mask_rcnn_x101_64x4d_fpn_20e_coco.py')\n# cfg = Config.fromfile('/kaggle/working/mmdetection/configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_20e_coco.py')","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:23.888578Z","iopub.execute_input":"2023-03-19T19:42:23.889014Z","iopub.status.idle":"2023-03-19T19:42:23.933164Z","shell.execute_reply.started":"2023-03-19T19:42:23.888980Z","shell.execute_reply":"2023-03-19T19:42:23.932557Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(cfg.pretty_text)","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:23.934399Z","iopub.execute_input":"2023-03-19T19:42:23.934826Z","iopub.status.idle":"2023-03-19T19:42:24.565722Z","shell.execute_reply.started":"2023-03-19T19:42:23.934792Z","shell.execute_reply":"2023-03-19T19:42:24.564939Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cfg.dataset_type = 'CocoDataset'\ncfg.classes = '/kaggle/working/labels.txt'\ncfg.data_root = '/kaggle/working'\n\nfor head in cfg.model.roi_head.bbox_head:\n    head.num_classes = 1\n    \ncfg.model.roi_head.mask_head.num_classes=1\n\ncfg.data.test.type = 'CocoDataset'\ncfg.data.test.classes = 'labels.txt'\ncfg.data.test.data_root = '/kaggle/working'\ncfg.data.test.ann_file = 'fixed_val.json'\n# cfg.data.test.ann_file = '/kaggle/input/uavvaste-dataset/uavvaste-github/annotations/annotations.json'\ncfg.data.test.img_prefix = '/kaggle/input/uavvaste-dataset/uavvaste-github/images'\n\ncfg.data.train.type = 'CocoDataset'\ncfg.data.train.data_root = '/kaggle/working'\n# cfg.data.train.ann_file = '/kaggle/input/fixed/annotations.json'\ncfg.data.train.ann_file = 'fixed_train.json'\n# cfg.data.train.ann_file = '/kaggle/input/uavvaste-dataset/uavvaste-github/annotations/annotations.json'\ncfg.data.train.img_prefix = '/kaggle/input/uavvaste-dataset/uavvaste-github/images'\ncfg.data.train.classes = 'labels.txt'\n\ncfg.data.val.type = 'CocoDataset'\ncfg.data.val.data_root = '/kaggle/working'\ncfg.data.val.ann_file = 'fixed_val.json'\n# cfg.data.val.ann_file = '/kaggle/input/uavvaste-dataset/uavvaste-github/annotations/annotations.json'\ncfg.data.val.img_prefix = '/kaggle/input/uavvaste-dataset/uavvaste-github/images'\ncfg.data.val.classes = 'labels.txt'\n\nalbu_train_transforms = [\n    dict(type='ShiftScaleRotate', shift_limit=0.0625,\n         scale_limit=0.15, rotate_limit=15, p=0.4),\n    dict(type='RandomBrightnessContrast', brightness_limit=0.2,\n         contrast_limit=0.2, p=0.5),\n#     dict(type='IAAAffine', shear=(-10.0, 10.0), p=0.4),\n#     dict(type='CLAHE', p=0.5),\n    dict(\n        type=\"OneOf\",\n        transforms=[\n            dict(type=\"GaussianBlur\", p=1.0, blur_limit=7),\n            dict(type=\"MedianBlur\", p=1.0, blur_limit=7),\n        ],\n        p=0.4,\n    ),\n]\n\ncfg.train_pipeline = [\n    dict(type='LoadImageFromFile'),\n    dict(type='LoadAnnotations', with_bbox=True, with_mask=True),\n#     dict(type='Resize', img_scale=[(440, 596), (480, 650), (520, 704), (580, 785), (620, 839)], multiscale_mode='value', keep_ratio=True),\n#     dict(type='Resize', img_scale=[(880, 1192), (960, 130), (1040, 1408), (1160, 1570), (1240, 1678)], multiscale_mode='value', keep_ratio=True),\n#     dict(type='Resize', img_scale=[(1333, 800), (1690, 960)]),\n    dict(type='Resize', img_scale=(1333, 800)),\n    \n    \n\n    dict(type='RandomFlip', flip_ratio=0.5),\n\n#     dict(\n#         type='Albu',\n#         transforms=albu_train_transforms,\n#         bbox_params=dict(\n#         type='BboxParams',\n#         format='pascal_voc',\n#         label_fields=['gt_labels'],\n#         min_visibility=0.0,\n#         filter_lost_elements=True),\n#         keymap=dict(img='image', gt_bboxes='bboxes', gt_masks='masks'),\n#         update_pad_shape=False,\n#         skip_img_without_anno=True),\n    dict(\n        type='Normalize',\n        mean=[128, 128, 128],\n        std=[11.58, 11.58, 11.58],\n        to_rgb=True),\n    dict(type='Pad', size_divisor=32),\n    dict(type='DefaultFormatBundle'), \n    dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_masks', 'gt_labels'])\n]\n\ncfg.val_pipeline = [\n    dict(type='LoadImageFromFile'),\n    dict(\n        type='MultiScaleFlipAug',\n#         img_scale=[(880, 1192), (960, 130), (1040, 1408), (1160, 1570), (1240, 1678)],\n#         img_scale = [(1333, 800), (1690, 960)],\n        img_scale=(1333, 800),\n#         img_scale = (520, 704),\n        flip=False,\n        transforms=[\n            dict(type='Resize', keep_ratio=True),\n            dict(type='RandomFlip'),\n            dict(\n                type='Normalize',\n                mean=[128, 128, 128],\n                std=[11.58, 11.58, 11.58],\n                to_rgb=True),\n            dict(type='Pad', size_divisor=32),\n            dict(type='ImageToTensor', keys=['img']),\n            dict(type='Collect', keys=['img'])\n        ])\n]\n\n\ncfg.test_pipeline = [\n    dict(type='LoadImageFromFile'),\n    dict(\n        type='MultiScaleFlipAug',\n        img_scale=[(1333, 800), (1690, 960)],\n#         img_scale=(1333, 800),\n        \n#         img_scale = (520, 704),\n        flip=False,\n        transforms=[\n            dict(type='Resize', keep_ratio=True),\n            dict(type='RandomFlip'),\n            dict(\n                type='Normalize',\n                mean=[128, 128, 128],\n                std=[11.58, 11.58, 11.58],\n                to_rgb=True),\n            dict(type='Pad', size_divisor=32),\n            dict(type='ImageToTensor', keys=['img']),\n            dict(type='Collect', keys=['img'])\n        ])\n]\n\ncfg.data.train.pipeline = cfg.train_pipeline\ncfg.data.val.pipeline = cfg.val_pipeline\ncfg.data.test.pipeline = cfg.test_pipeline\n\n\n# cfg.model.test_cfg.rcnn.max_per_img = 400\n\ncfg.load_from = '../input/cascade-mask-rcnn-mmdet/cascade_mask_rcnn_x101_64x4d_fpn_20e_coco_20200512_161033-bdb5126a.pth'\n\ncfg.work_dir = '/kaggle/working/model_output'\n\ncfg.optimizer.lr = 0.02 / 8\ncfg.lr_config = dict(\n    policy='CosineAnnealing', \n    by_epoch=False,\n    warmup='linear', \n    warmup_iters=125, \n    warmup_ratio=0.001,\n    min_lr=1e-07)\n\ncfg.data.samples_per_gpu = 2\ncfg.data.workers_per_gpu = 1\n\ncfg.evaluation.metric = 'segm'\ncfg.evaluation.interval = 1\n\ncfg.checkpoint_config.interval = 1\ncfg.runner.max_epochs = 12\ncfg.log_config.interval = 50\n\ncfg.seed = 0\nset_random_seed(0, deterministic=False)\ncfg.gpu_ids = range(1)\ncfg.fp16 = dict(loss_scale=512.0)\nmeta = dict()\nmeta['config'] = cfg.pretty_text\n\n\n\nprint(f'Config:\\n{cfg.pretty_text}')","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:24.567180Z","iopub.execute_input":"2023-03-19T19:42:24.567738Z","iopub.status.idle":"2023-03-19T19:42:25.638942Z","shell.execute_reply.started":"2023-03-19T19:42:24.567674Z","shell.execute_reply":"2023-03-19T19:42:25.637979Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **Training**","metadata":{}},{"cell_type":"code","source":"datasets = [build_dataset(cfg.data.train)]\nmodel = build_detector(cfg.model, train_cfg=cfg.get('train_cfg'), test_cfg=cfg.get('test_cfg'))\nmodel.CLASSES = datasets[0].CLASSES\n\nmmcv.mkdir_or_exist(os.path.abspath(cfg.work_dir))\ntrain_detector(model, datasets, cfg, distributed=False, validate=True, meta=meta)","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:42:25.641714Z","iopub.execute_input":"2023-03-19T19:42:25.641931Z","iopub.status.idle":"2023-03-19T19:59:09.181549Z","shell.execute_reply.started":"2023-03-19T19:42:25.641905Z","shell.execute_reply":"2023-03-19T19:59:09.178543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **Debugging**","metadata":{}},{"cell_type":"code","source":"dataDir = Path('/kaggle/input/uavvaste-dataset/uavvaste-github/images')\nannFile = Path('/kaggle/working/fixed_train.json')\ncoco = COCO(annFile)\nimgIds = coco.getImgIds()\nimgs = coco.loadImgs(imgIds[0:2])\n_,axs = plt.subplots(len(imgs),2,figsize=(40,15 * len(imgs)))\nfor img, ax in zip(imgs, axs):\n    I = Image.open(dataDir/img['file_name'])\n    annIds = coco.getAnnIds(imgIds=[img['id']])\n    anns = coco.loadAnns(annIds)\n    ax[0].imshow(I)\n    ax[1].imshow(I)\n    plt.sca(ax[1])\n    coco.showAnns(anns, draw_bbox=True)","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:59:09.183083Z","iopub.status.idle":"2023-03-19T19:59:09.183419Z","shell.execute_reply.started":"2023-03-19T19:59:09.183236Z","shell.execute_reply":"2023-03-19T19:59:09.183268Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Mistakes in annotating checked:**\n\nMismatching image sizes between image_info and actual images\nBboxes being greater than img size","metadata":{}},{"cell_type":"code","source":"dataDir = Path('/kaggle/input/uavvaste-dataset/uavvaste-github/images')\nannFile = Path('/kaggle/working/fixed_train.json')\ncoco = COCO(annFile)\nimgIds = coco.getImgIds()\nimgs = coco.loadImgs(imgIds)\nfor img in imgs:\n#     annIds = coco.getAnnIds(imgIds=[img['id']])\n    anns = coco.loadAnns(annIds)\n#     print(img)\n    I = Image.open(dataDir/img['file_name'])\n    width, height = I.size\n    for ann in anns:\n        if ann['bbox'][0] + ann['bbox'][2] > width:\n            print(img['file_name'])\n        if ann['bbox'][1] + ann['bbox'][3] > height:\n            print(img['file_name'])\n#     if I.size != (img['width'], img['height']):\n#         print(img['file_name'])","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:59:09.184654Z","iopub.status.idle":"2023-03-19T19:59:09.185303Z","shell.execute_reply.started":"2023-03-19T19:59:09.185043Z","shell.execute_reply":"2023-03-19T19:59:09.185069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"im_list = []\nfor filename in glob.glob('/kaggle/input/uavvaste-dataset/uavvaste-github/images/*.jpg'):\n    try:\n        im = Image.open(filename)\n        im_list.append(im.size)\n    except IOError:\n        print(filename)","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:59:09.186488Z","iopub.status.idle":"2023-03-19T19:59:09.187270Z","shell.execute_reply.started":"2023-03-19T19:59:09.187000Z","shell.execute_reply":"2023-03-19T19:59:09.187025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"im_list = []\nfor filename in glob.glob('/kaggle/input/uavvaste-dataset/uavvaste-github/images/*.jpg'):\n    try:\n        im = Image.open(filename)\n        if im.size == (4032, 3024):\n            print(filename)\n    except IOError:\n#         print(filename)\n        print(\"Failed\")","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:59:09.188479Z","iopub.status.idle":"2023-03-19T19:59:09.189118Z","shell.execute_reply.started":"2023-03-19T19:59:09.188848Z","shell.execute_reply":"2023-03-19T19:59:09.188879Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"set(im_list)","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:59:09.190485Z","iopub.status.idle":"2023-03-19T19:59:09.191007Z","shell.execute_reply.started":"2023-03-19T19:59:09.190721Z","shell.execute_reply":"2023-03-19T19:59:09.190795Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"i=0\nfor im in im_list:\n    if im == (4032, 3024):\n        i += 1","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:59:09.193779Z","iopub.status.idle":"2023-03-19T19:59:09.194357Z","shell.execute_reply.started":"2023-03-19T19:59:09.194103Z","shell.execute_reply":"2023-03-19T19:59:09.194127Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"i","metadata":{"execution":{"iopub.status.busy":"2023-03-19T19:59:09.195927Z","iopub.status.idle":"2023-03-19T19:59:09.196661Z","shell.execute_reply.started":"2023-03-19T19:59:09.196424Z","shell.execute_reply":"2023-03-19T19:59:09.196449Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}