{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceType":"competition","sourceId":24800,"datasetId":1042002,"databundleVersionId":1831594},{"sourceType":"datasetVersion","sourceId":1832961,"datasetId":1089494,"databundleVersionId":1870583},{"sourceType":"datasetVersion","sourceId":1800067,"datasetId":1069810,"databundleVersionId":1837524},{"sourceType":"datasetVersion","sourceId":1800825,"datasetId":1070245,"databundleVersionId":1838284},{"sourceType":"datasetVersion","sourceId":1800777,"datasetId":1069787,"databundleVersionId":1838236},{"sourceType":"datasetVersion","sourceId":1800778,"datasetId":1070222,"databundleVersionId":1838237},{"sourceType":"kernelVersion","sourceId":52422980}],"dockerImageVersionId":30919,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# 💻 You Only Look Once (YOLO) Training and Cross Validation\n### Group: 4NN\n#### Dharani Palanisamy (z5260276)\n#### Faiyam Islam (z5258151)\n#### Pooja Saianand (z5312416)\n#### Priya Nandyal (z5312288)\n\n\nThe notebook computes loss function values, precision, recall, and mean average precision curves using cross validation of the dataset. We will also analyse the evaluation metrics such as mAP and IoU and instigate a conclusion on the accuracy of this object detection method.\n\nWe are running this notebook on GPU.\n\nWe've used the following sources which assisted our approach for YOLO:\n\nhttps://www.kaggle.com/code/kimse0ha/vinbigdata-eda-infer-analysis-with-yolov5\n\nhttps://www.kaggle.com/code/awsaf49/vinbigdata-cxr-ad-yolov5-14-class-infer/notebook\n\nhttps://www.kaggle.com/code/mrutyunjaybiswal/vbd-chest-x-ray-abnormalities-detection-eda/notebook\n\nhttps://www.kaggle.com/code/jamsilkaggle/quick-data-analysis-with-yolov5-at-a-glance","metadata":{}},{"cell_type":"markdown","source":"# Importing datasets and installing packages","metadata":{}},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\n# import numpy as np # linear algebra\n# import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\n# import os\n# for dirname, _, filenames in os.walk('/kaggle/input'):\n#     for filename in filenames:\n#         print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# ! nvidia-smi -L","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install --upgrade seaborn\n!pip install -U ultralytics\n!pip install albumentations\n# !pip install wandb","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import numpy as np, pandas as pd\nfrom glob import glob\nimport shutil, os\nimport matplotlib.pyplot as plt\nfrom sklearn.model_selection import GroupKFold\nfrom tqdm.notebook import tqdm\nimport seaborn as sns\nimport wandb\nfrom pathlib import Path\nimport yaml\nfrom albumentations import Compose, RandomRotate90, Flip, Transpose, ShiftScaleRotate, RandomBrightnessContrast\nfrom ultralytics import YOLO","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# wandb.login(key='98ee3ceb9e91d73155101914e05180de5743186e')\n\n# wandb.init(project='vincxr_yolov11m', name='50epoch')\n\n# # Paths to data directories\n# ROOT = Path(\"/kaggle/input/vinbigdata-512-image-dataset/vinbigdata\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# from typing import List\n# def ls(path: Path) -> List[Path]:\n#     return list(path.iterdir())\n\n# ls(ROOT)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Analyzing the train dataset and obtaining class information","metadata":{}},{"cell_type":"code","source":"dim = 512\nfold = 4\ntrain_df = pd.read_csv(f'../input/vinbigdata-{dim}-image-dataset/vinbigdata/train.csv')\ntrain_df.head()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\nimport cv2\nfrom tqdm import tqdm\n\n# Define the folder path containing the images\nimage_folder = \"/kaggle/input/vinbigdata-512-image-dataset/vinbigdata/train\"\n\n# Get a list of image paths\nimage_paths = [os.path.join(image_folder, filename) for filename in os.listdir(image_folder) if filename.endswith((\".jpg\", \".jpeg\", \".png\"))]\n\n# Apply CLAHE preprocessing with a loop and progress bar (adapt if using pandas progress_apply)\nfor image_path in tqdm(image_paths, desc=\"Applying CLAHE\"):\n  try:\n    # Load image using cv2.imread\n    image = cv2.imread(image_path)\n\n    # Convert to grayscale (adjust if working with color images)\n    image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n\n    # Create CLAHE object\n    clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))\n\n    # Apply CLAHE\n    image_eq = clahe.apply(image_gray)\n\n    # Extract filename and directory from image path\n    filename = os.path.basename(image_path)\n    image_dir = \"/kaggle/working/\"\n\n    # Create the \"preprocessing\" subfolder within the original image directory if it doesn't exist\n    output_dir = os.path.join(image_dir, \"preprocessing\")\n    os.makedirs(output_dir, exist_ok=True)\n\n    # Save preprocessed image to the subfolder with the same filename\n    output_path = os.path.join(output_dir, filename)\n    cv2.imwrite(output_path, image_eq)\n\n  except Exception as e:\n    print(f\"Error processing image {image_path}: {e}\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# train_df['image_path'] = f'/kaggle/input/vinbigdata-{dim}-image-dataset/vinbigdata/train/preprocessing'+ train_df.image_id+('.png' if dim!='original' else '.jpg')\n# train_df.head()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# train_df = train_df.sample(frac=0.1, random_state=42).reset_index(drop=True)\n\ntrain_df['image_path'] = f'/kaggle/working/preprocessing/'+ train_df.image_id+('.png' if dim!='original' else '.jpg')\ntrain_df.head()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Getting the number of classes \ntrain_df = train_df[train_df.class_id!=14].reset_index(drop = True)\ntrain_df.head()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"class_counts = train_df['class_name'].value_counts()\nprint(\"Instances per class:\\n\", class_counts)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# from sklearn.utils import resample, class_weight\n\n# # Oversample Minority Classes (Augment class_id = 12, 1, 4, 2)\n# minority_classes = [12, 1, 4, 2, 5, 6]\n# df_minority = train_df[train_df.class_id.isin(minority_classes)]\n\n# # Oversample each minority class to 1000 samples\n# df_minority_upsampled = df_minority.groupby('class_id', group_keys=False).apply(\n#     lambda x: resample(x, replace=True, n_samples=1500, random_state=42)\n# )\n\n# # Merge back to final dataset\n# train_df= pd.concat([train_df, df_minority_upsampled]).reset_index(drop=True)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Pre-processing the dataset by computing the values of x_min,x_max,x_mid,y_min,y_max,y_mid,height and width\n\ntrain_df['x_min'] = train_df.apply(lambda row: (row.x_min)/row.width, axis =1)\ntrain_df['x_max'] = train_df.apply(lambda row: (row.x_max)/row.width, axis =1)\ntrain_df['x_mid'] = train_df.apply(lambda row: (row.x_max+row.x_min)/2, axis =1)\n\ntrain_df['y_min'] = train_df.apply(lambda row: (row.y_min)/row.height, axis =1)\ntrain_df['y_max'] = train_df.apply(lambda row: (row.y_max)/row.height, axis =1)\ntrain_df['y_mid'] = train_df.apply(lambda row: (row.y_max+row.y_min)/2, axis =1)\n\ntrain_df['h'] = train_df.apply(lambda row: (row.y_max-row.y_min), axis =1) #height\ntrain_df['w'] = train_df.apply(lambda row: (row.x_max-row.x_min), axis =1) #width\n\ntrain_df['area'] = train_df['w']*train_df['h']\ntrain_df.head()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"class_counts = train_df['class_name'].value_counts()\nprint(\"Instances per class:\\n\", class_counts)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# The number of rows in the train_df for the feature columns\nfeatures = ['x_min', 'y_min', 'x_max', 'y_max', 'x_mid', 'y_mid', 'w', 'h', 'area']\ny = train_df['class_id']\nX = train_df[features]\nX.shape, y.shape","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# To get a list of the class names\nclass_ids, class_names = list(zip(*set(zip(train_df.class_id, train_df.class_name))))\nclass_list = list(np.array(class_names)[np.argsort(class_ids)])\nclass_list = list(map(lambda x: str(x), class_list))\nclass_list\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Splitting the dataset","metadata":{}},{"cell_type":"code","source":"# # Split the dataset and drop all the x-rays that do not contain any abnormality\n# fold = 4\n# gkf  = GroupKFold(n_splits = 5)\n# train_df['fold'] = -1\n# for fold, (train_idx, val_idx) in enumerate(gkf.split(train_df, groups = train_df.image_id.tolist())):\n#     train_df.loc[val_idx, 'fold'] = fold\n# train_df.head()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from sklearn.model_selection import StratifiedGroupKFold\n\nn_splits = 5\nsgkf = StratifiedGroupKFold(n_splits=n_splits, shuffle=True, random_state=42)\n\ntrain_df['fold'] = -1  # Initialize fold column\n\n# Assign folds ensuring class balance while keeping groups intact\nfor fold, (train_idx, val_idx) in enumerate(sgkf.split(train_df, train_df['class_id'], groups=train_df['image_id'])):\n    train_df.loc[val_idx, 'fold'] = fold\n\ntrain_df.tail()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"val_files   = []\ntrain_files = []\nval_files += list(train_df[train_df.fold==fold].image_path.unique())\ntrain_files += list(train_df[train_df.fold!=fold].image_path.unique())\nprint(len(train_files)) #size of train dataset\nprint(len(val_files)) # size of validation set","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(train_files[:10])","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\n\nprint(os.listdir('/kaggle/working/preprocessing/')[:10])  # List some files","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Creating directories and copying files","metadata":{}},{"cell_type":"code","source":"os.makedirs('/kaggle/working/vinbigdata/labels/train', exist_ok = True)\nos.makedirs('/kaggle/working/vinbigdata/labels/val', exist_ok = True)\nos.makedirs('/kaggle/working/vinbigdata/images/train', exist_ok = True)\nos.makedirs('/kaggle/working/vinbigdata/images/val', exist_ok = True)\nlabel_dir = '/kaggle/input/vinbigdata-yolo-labels-dataset/labels'\nfor file in tqdm(train_files): # we use tqdm to see the progress of the copying of files\n    shutil.copy(file, '/kaggle/working/vinbigdata/images/train')\n    filename = file.split('/')[-1].split('.')[0]\n    shutil.copy(os.path.join(label_dir, filename+'.txt'), '/kaggle/working/vinbigdata/labels/train')\n    \nfor file in tqdm(val_files):\n    shutil.copy(file, '/kaggle/working/vinbigdata/images/val')\n    filename = file.split('/')[-1].split('.')[0]\n    shutil.copy(os.path.join(label_dir, filename+'.txt'), '/kaggle/working/vinbigdata/labels/val')","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Setting up YOLOv5","metadata":{}},{"cell_type":"code","source":"import numpy as np\n\n# Example: Replace with actual class counts\nclass_counts = np.array([7162, 279, 960, 5427, 556, 1000, 1247, 2483, 2580, 2203, 2476, 4842, 226, 4655]) \n\n# Compute inverse frequency weights\nclass_weights = 1.0 / class_counts\nclass_weights /= class_weights.sum()  # Normalize\n\nprint(\"Computed class weights:\", class_weights)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Creating a yaml file \n# from os import listdir\nfrom os.path import isfile, join\nimport yaml\n# import albumentations as A\nfrom glob import glob\n\n\ncwd = '/kaggle/working/'\n\n# train_transforms = A.Compose([\n#     # Define your desired augmentations here, for example:\n#     A.CLAHE(clip_limit=2.0, tile_grid_size=(8, 8), p=1.0),  # Apply Contrast Limited Adaptive Histogram Equalization\n#     A.ShiftScaleRotate(shift_limit=0.0625, scale_limit=0.2, rotate_limit=30, p=0.2),  # Rotate less than 30 degrees\n# ])\n\nwith open(join( cwd , 'train.txt'), 'w') as f:\n    for path in glob('/kaggle/working/vinbigdata/images/train/*'):\n        f.write(path+'\\n')\n            \nwith open(join( cwd , 'val.txt'), 'w') as f:\n    for path in glob('/kaggle/working/vinbigdata/images/val/*'):\n        f.write(path+'\\n')\n\ndata = {\n    \"train\": join(cwd, \"train.txt\"),  # Path to training images\n    \"val\": join(cwd, \"val.txt\"),  # Path to validation images\n    \"nc\": 14,  # Number of classes\n    \"names\": class_list  # Class names\n}\n\nwith open(join( cwd , 'vinbigdata.yaml'), 'w') as outfile:\n    yaml.dump(data, outfile, default_flow_style=False)\n\nf = open(join( cwd , 'vinbigdata.yaml'), 'r')\nprint('\\nyaml contents:')\nprint(f.read())","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import torch\nfrom IPython.display import Image, clear_output  # to display images and clear outputs ","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import torch\nimport torch.nn as nn\n\n# Define Focal Loss\nclass FocalLoss(nn.Module):\n    def __init__(self, gamma=2, alpha=None, reduction='mean'):\n        super(FocalLoss, self).__init__()\n        self.gamma = gamma\n        self.alpha = alpha\n        self.reduction = reduction\n\n    def forward(self, inputs, targets):\n        BCE_loss = nn.functional.binary_cross_entropy_with_logits(inputs, targets, reduction='none')\n        pt = torch.exp(-BCE_loss)  # Probabilities\n        F_loss = (1 - pt) ** self.gamma * BCE_loss  # Apply focal factor\n\n        if self.alpha is not None:\n            alpha_t = self.alpha * targets + (1 - self.alpha) * (1 - targets)\n            F_loss = alpha_t * F_loss\n\n        return F_loss.mean() if self.reduction == 'mean' else F_loss.sum()\n","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from ultralytics.data.dataset import YOLODataset\nimport ultralytics.data.build as build\nimport numpy as np\n\nclass YOLOWeightedDataset(YOLODataset):\n    def __init__(self, *args, **kwargs):\n        super(YOLOWeightedDataset, self).__init__(*args, **kwargs)\n        self.train_mode = \"train\" in self.prefix\n\n        # Count class occurrences\n        self.count_instances()\n        self.class_weights = np.sum(self.counts) / self.counts  # Compute inverse frequency\n        self.agg_func = np.mean  # Aggregation function\n\n        self.weights = self.calculate_weights()\n        self.probabilities = self.calculate_probabilities()\n\n    def count_instances(self):\n        \"\"\" Count the number of instances per class \"\"\"\n        self.counts = [0 for _ in range(len(self.data[\"names\"]))]\n        for label in self.labels:\n            cls = label['cls'].reshape(-1).astype(int)\n            for id in cls:\n                self.counts[id] += 1\n\n        self.counts = np.array(self.counts)\n        self.counts = np.where(self.counts == 0, 1, self.counts)  # Avoid zero division\n\n    def calculate_weights(self):\n        \"\"\" Compute label-wise weights \"\"\"\n        weights = []\n        for label in self.labels:\n            cls = label['cls'].reshape(-1).astype(int)\n            if cls.size == 0:\n                weights.append(1)  # Default weight for background class\n                continue\n            weight = self.agg_func(self.class_weights[cls])\n            weights.append(weight)\n        return weights\n\n    def calculate_probabilities(self):\n        \"\"\" Compute probabilities for weighted sampling \"\"\"\n        total_weight = sum(self.weights)\n        return [w / total_weight for w in self.weights]\n\n    def __getitem__(self, index):\n        if not self.train_mode:\n            return self.transforms(self.get_image_and_label(index))\n        else:\n            index = np.random.choice(len(self.labels), p=self.probabilities)  # Weighted sampling\n            return self.transforms(self.get_image_and_label(index))\n\n# Monkey-patch YOLO Dataset\ndef patch_dataset(trainer):\n    build.YOLODataset = YOLOWeightedDataset","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from ultralytics import YOLO\n\nclass CustomYOLO11(YOLO):\n    def __init__(self, config_path):\n        super().__init__(config_path)\n        self.focal_loss = FocalLoss(gamma=2)  # Use Focal Loss\n\n    def compute_loss(self, outputs, targets):\n        return self.focal_loss(outputs, targets)  # Apply Focal Loss","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# !pip install ultralytics","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Training the dataset and cross validation","metadata":{}},{"cell_type":"code","source":"# # training and cross validating the dataset using yolov5 \n# !WANDB_MODE=\"dryrun\" python train.py --img 640 --batch 16 --epochs 30 --data /kaggle/working/vinbigdata.yaml --weights yolov5x.pt --cache","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# # Build a YOLOv9c model from scratch\n# # model = YOLO('yolov8n.yaml')\n\n# # Build a YOLOv9c model from pretrained weight\n# model = YOLO('yolo11m.pt')\n\n# # Display model information (optional)\n# model.info()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Create custom YOLOv8 model\nmodel = CustomYOLO11('yolo11m.yaml')\n\n# Apply dataset patching\nmodel.add_callback(\"on_pretrain_routine_start\", patch_dataset)\n\n# Start training with class-balanced dataset\nresults = model.train(\n    data='/kaggle/working/vinbigdata.yaml',  # Ensure the dataset YAML is correctly set\n    epochs=100,\n    batch = 16,\n    imgsz = 640,\n    mixup=0.5,\n    augment=True,\n    pretrained=True,\n    iou=0.5,\n    project = 'vin_yolo_11',\n)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# from ultralytics import RTDETR\n\n# model = RTDETR(\"rtdetr-l.pt\")\n\n# # Display model information (optional)\n# model.info()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# results = model.train(data='/kaggle/working/vinbigdata.yaml', batch = 8 ,epochs=120, imgsz = 640, optimizer='SGD', project = 'vin_RTDETR')","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# results = model.train(\n#     data='/kaggle/working/vinbigdata.yaml', \n#     batch = 16, \n#     epochs = 50, \n#     imgsz = 640,\n#     optimizer = 'SGD',\n#     lr0 = 0.0001,\n#     weight_decay = 0.0005, \n\n#     project = 'vin_yolo_11',\n# )","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"model.val(data='/kaggle/working/vinbigdata.yaml', conf=0.3)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\n# Load YOLOv8 training logs\nimport pandas as pd\nlog_path = '/kaggle/working/vin_yolo_11/train/results.csv'  # Change to your actual path\ndf = pd.read_csv(log_path)\n\n# Plot loss curves\nplt.figure(figsize=(10, 5))\nplt.plot(df['epoch'], df['train/box_loss'], label='Train Box Loss')\nplt.plot(df['epoch'], df['val/box_loss'], label='Val Box Loss')\nplt.xlabel('Epoch')\nplt.ylabel('Loss')\nplt.title('Training vs Validation Loss (Wd =0.0005 lr=0.0001 batch=16)')\nplt.legend()\nplt.show()","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Confusion matrix","metadata":{}},{"cell_type":"code","source":"# !zip -r /kaggle/working/vin_yolo_v8 /kaggle/working/.","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# !zip -r /kaggle/working/vin_yolo_v8 /kaggle/working/","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# A confusion matrix is produced when training the datasets\nplt.figure(figsize=(30,15))\nplt.axis('off')\nplt.imshow(plt.imread('/kaggle/working/vin_yolo_11/train/confusion_matrix_normalized.png'));","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# # A confusion matrix is produced when training the datasets\n# plt.figure(figsize=(30,15))\n# plt.axis('off')\n# plt.imshow(plt.imread('/kaggle/working/vin_yolo_v8/train22/confusion_matrix_normalized.png'));","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Plots for our model","metadata":{}},{"cell_type":"code","source":"# Training the data computes loss, precision, recall and mAP values for different thresholds\nplt.figure(figsize=(30,15))\nplt.axis('off')\nplt.title('(Wd =0.0005 lr=0.0001 batch=16)')\nplt.imshow(plt.imread('/kaggle/working/vin_yolo_11/train/results.png'));","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!zip -r /kaggle/working/vin_yolo_11_output.zip /kaggle/working/vin_yolo_11","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}