{"cells": [{"cell_type": "markdown", "id": "7433a65e", "metadata": {}, "source": "# State Farm Distracted Driver Detection - Tutorial Notebook\n\nThis notebook is beginner-friendly and explains each step of an end-to-end image classification pipeline.\n\nYou will learn:\n- how to inspect the dataset,\n- how to build a leakage-safe validation split,\n- how transfer learning with EfficientNet works,\n- how training/evaluation/inference connect,\n- how to generate a valid Kaggle submission.\n"}, {"cell_type": "code", "execution_count": 1, "id": "d2d00e38", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:33:11.869329Z", "iopub.status.busy": "2026-06-12T13:33:11.869215Z", "iopub.status.idle": "2026-06-12T13:33:15.263664Z", "shell.execute_reply": "2026-06-12T13:33:15.263075Z"}}, "outputs": [], "source": "import gc\nimport random\nfrom pathlib import Path\n\nimport numpy as np\nimport pandas as pd\nfrom PIL import Image\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom tqdm.auto import tqdm\n\nimport torch\nfrom torch import nn\nfrom torch.utils.data import DataLoader, Dataset\nfrom torchvision import models, transforms\n\nfrom sklearn.metrics import accuracy_score, confusion_matrix, f1_score, log_loss\nfrom sklearn.model_selection import StratifiedGroupKFold\n\ndef seed_everything(seed: int = 42) -> None:\n    random.seed(seed)\n    np.random.seed(seed)\n    torch.manual_seed(seed)\n    torch.cuda.manual_seed_all(seed)\n    torch.backends.cudnn.deterministic = True\n    torch.backends.cudnn.benchmark = False\n\nseed_everything(42)\nsns.set_theme(style='whitegrid')\n\nIS_KAGGLE = Path('/kaggle').exists()\nuse_cuda = torch.cuda.is_available() and IS_KAGGLE\nif use_cuda:\n    major, minor = torch.cuda.get_device_capability(0)\n    if major < 7:\n        print(f\"Detected CUDA capability sm_{major}{minor} unsupported by current PyTorch build; falling back to CPU.\")\n        use_cuda = False\ndevice = torch.device('cuda' if use_cuda else 'cpu')\nprint(f\"Device: {device}\")\n"}, {"cell_type": "markdown", "id": "a7ee3183", "metadata": {}, "source": "## 1. Resolve dataset paths and verify files\n\nThe notebook supports Kaggle paths and local fallback paths. We assert every required path so execution fails early if something is missing.\n"}, {"cell_type": "code", "execution_count": 2, "id": "aabf7823", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:33:15.265205Z", "iopub.status.busy": "2026-06-12T13:33:15.264990Z", "iopub.status.idle": "2026-06-12T13:33:15.268803Z", "shell.execute_reply": "2026-06-12T13:33:15.268306Z"}}, "outputs": [], "source": "CANDIDATE_ROOTS = [\n    Path('/kaggle/input/competitions/state-farm-distracted-driver-detection'),\n    Path('/kaggle/input/state-farm-distracted-driver-detection'),\n    Path.cwd() / 'data' / 'raw',\n]\nDATA_ROOT = next((p for p in CANDIDATE_ROOTS if p.exists()), None)\nassert DATA_ROOT is not None, 'Dataset root not found.'\n\nTRAIN_CSV = DATA_ROOT / 'driver_imgs_list.csv'\nSAMPLE_SUB_CSV = DATA_ROOT / 'sample_submission.csv'\nTRAIN_IMG_DIR = DATA_ROOT / 'imgs' / 'train'\nTEST_IMG_DIR = DATA_ROOT / 'imgs' / 'test'\n\nfor p in [TRAIN_CSV, SAMPLE_SUB_CSV, TRAIN_IMG_DIR, TEST_IMG_DIR]:\n    assert p.exists(), f'Missing required path: {p}'\n\nWORK_DIR = Path('/kaggle/working') if Path('/kaggle/working').exists() else Path.cwd()\nWORK_DIR.mkdir(parents=True, exist_ok=True)\n\nprint(f'DATA_ROOT: {DATA_ROOT}')\nprint(f'WORK_DIR: {WORK_DIR}')\n"}, {"cell_type": "markdown", "id": "60a7dacf", "metadata": {}, "source": "## 2. EDA: metadata, class balance, and sample images\n"}, {"cell_type": "code", "execution_count": 3, "id": "d20f1142", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:33:15.269932Z", "iopub.status.busy": "2026-06-12T13:33:15.269835Z", "iopub.status.idle": "2026-06-12T13:33:15.551180Z", "shell.execute_reply": "2026-06-12T13:33:15.550454Z"}}, "outputs": [], "source": "meta = pd.read_csv(TRAIN_CSV)\nmeta['label'] = meta['classname'].str.replace('c', '', regex=False).astype(int)\nmeta['image_path'] = meta.apply(lambda r: str(TRAIN_IMG_DIR / r['classname'] / r['img']), axis=1)\n\nprint(meta.head())\nprint(f\"Rows: {len(meta):,}\")\nprint(f\"Unique drivers: {meta['subject'].nunique():,}\")\nprint(f\"Classes: {sorted(meta['classname'].unique())}\")\n"}, {"cell_type": "code", "execution_count": 4, "id": "37b3a21c", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:33:15.552640Z", "iopub.status.busy": "2026-06-12T13:33:15.552524Z", "iopub.status.idle": "2026-06-12T13:33:15.706501Z", "shell.execute_reply": "2026-06-12T13:33:15.705644Z"}}, "outputs": [], "source": "class_counts = meta['classname'].value_counts().sort_index()\nplt.figure(figsize=(10, 4))\nsns.barplot(x=class_counts.index, y=class_counts.values, color='#1f77b4')\nplt.title('Class Distribution (c0-c9)')\nplt.xlabel('Class')\nplt.ylabel('Count')\nplt.show()\n"}, {"cell_type": "code", "execution_count": 5, "id": "bdfebc85", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:33:15.707915Z", "iopub.status.busy": "2026-06-12T13:33:15.707776Z", "iopub.status.idle": "2026-06-12T13:33:16.589576Z", "shell.execute_reply": "2026-06-12T13:33:16.588937Z"}}, "outputs": [], "source": "fig, axes = plt.subplots(2, 5, figsize=(16, 6))\naxes = axes.flatten()\n\nfor i in range(10):\n    cls = f'c{i}'\n    sample_row = meta[meta['classname'] == cls].iloc[0]\n    img = Image.open(sample_row['image_path']).convert('RGB')\n    axes[i].imshow(img)\n    axes[i].set_title(cls)\n    axes[i].axis('off')\n\nplt.tight_layout()\nplt.show()\n"}, {"cell_type": "markdown", "id": "c75e6e14", "metadata": {}, "source": "## 3. Validation strategy\n\nWe split by **driver ID (`subject`)** using `StratifiedGroupKFold`.\n\nWhy this matters:\n- the same driver appears in many images,\n- random split can leak driver identity,\n- group split gives a more realistic estimate.\n"}, {"cell_type": "code", "execution_count": 6, "id": "eb618656", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:33:16.596991Z", "iopub.status.busy": "2026-06-12T13:33:16.596802Z", "iopub.status.idle": "2026-06-12T13:33:16.623810Z", "shell.execute_reply": "2026-06-12T13:33:16.623017Z"}}, "outputs": [], "source": "sgkf = StratifiedGroupKFold(n_splits=5, shuffle=True, random_state=42)\ntrain_idx, val_idx = next(sgkf.split(meta, y=meta['label'], groups=meta['subject']))\n\ntrain_df = meta.iloc[train_idx].reset_index(drop=True)\nval_df = meta.iloc[val_idx].reset_index(drop=True)\n\nprint(f\"Train rows: {len(train_df):,}\")\nprint(f\"Val rows: {len(val_df):,}\")\nprint(f\"Train drivers: {train_df['subject'].nunique():,}\")\nprint(f\"Val drivers: {val_df['subject'].nunique():,}\")\n"}, {"cell_type": "markdown", "id": "cf345019", "metadata": {}, "source": "## 4. Datasets, transforms, and dataloaders\n\nWe use transfer-learning style preprocessing (ImageNet normalization) with augmentation on the train split.\n"}, {"cell_type": "code", "execution_count": 7, "id": "5de51fe8", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:33:16.625283Z", "iopub.status.busy": "2026-06-12T13:33:16.625140Z", "iopub.status.idle": "2026-06-12T13:33:16.633266Z", "shell.execute_reply": "2026-06-12T13:33:16.632615Z"}}, "outputs": [], "source": "class DriverDataset(Dataset):\n    def __init__(self, df: pd.DataFrame, transform=None, is_test: bool = False):\n        self.df = df.reset_index(drop=True)\n        self.transform = transform\n        self.is_test = is_test\n\n    def __len__(self):\n        return len(self.df)\n\n    def __getitem__(self, idx):\n        row = self.df.iloc[idx]\n        if self.is_test:\n            img = Image.open(TEST_IMG_DIR / row['img']).convert('RGB')\n            if self.transform:\n                img = self.transform(img)\n            return img, row['img']\n\n        img = Image.open(row['image_path']).convert('RGB')\n        label = int(row['label'])\n        if self.transform:\n            img = self.transform(img)\n        return img, label\n\ntrain_tfms = transforms.Compose([\n    transforms.Resize((256, 256)),\n    transforms.RandomResizedCrop(224, scale=(0.8, 1.0)),\n    transforms.RandomHorizontalFlip(0.5),\n    transforms.ColorJitter(brightness=0.25, contrast=0.2, saturation=0.2, hue=0.05),\n    transforms.ToTensor(),\n    transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),\n])\n\nvalid_tfms = transforms.Compose([\n    transforms.Resize((224, 224)),\n    transforms.ToTensor(),\n    transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),\n])\n\nIS_KAGGLE = Path('/kaggle').exists()\nBATCH_SIZE = 64 if device.type == 'cuda' else 16\nEPOCHS = 3 if IS_KAGGLE else 1\nPATIENCE = 2\n\n# Keep local dry-runs fast; Kaggle uses full split automatically.\nif (not IS_KAGGLE) or (device.type != 'cuda'):\n    train_df = train_df.sample(min(4000, len(train_df)), random_state=42).reset_index(drop=True)\n    val_df = val_df.sample(min(1200, len(val_df)), random_state=42).reset_index(drop=True)\n\ntrain_loader = DataLoader(\n    DriverDataset(train_df, transform=train_tfms),\n    batch_size=BATCH_SIZE,\n    shuffle=True,\n    num_workers=4 if IS_KAGGLE else 0,\n    pin_memory=(device.type == 'cuda'),\n)\nval_loader = DataLoader(\n    DriverDataset(val_df, transform=valid_tfms),\n    batch_size=BATCH_SIZE,\n    shuffle=False,\n    num_workers=4 if IS_KAGGLE else 0,\n    pin_memory=(device.type == 'cuda'),\n)\n\nprint(f\"Train batches: {len(train_loader)}, Val batches: {len(val_loader)}\")\n"}, {"cell_type": "markdown", "id": "f5fc51f4", "metadata": {}, "source": "## 5. Transfer-learning model (EfficientNet-B0)\n\nWe fine-tune the classifier head for 10 classes, with early stopping and checkpointing.\n"}, {"cell_type": "code", "execution_count": 8, "id": "bf75e21b", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:33:16.634573Z", "iopub.status.busy": "2026-06-12T13:33:16.634460Z", "iopub.status.idle": "2026-06-12T13:36:48.083629Z", "shell.execute_reply": "2026-06-12T13:36:48.082854Z"}}, "outputs": [], "source": "model = models.efficientnet_b0(weights=models.EfficientNet_B0_Weights.DEFAULT)\nmodel.classifier[1] = nn.Linear(model.classifier[1].in_features, 10)\nmodel = model.to(device)\n\ncriterion = nn.CrossEntropyLoss(label_smoothing=0.05)\noptimizer = torch.optim.AdamW(model.parameters(), lr=3e-4, weight_decay=1e-4)\nscheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=max(EPOCHS, 1))\n\nbest_ckpt = WORK_DIR / 'tutorial_best_statefarm_efficientnet_b0.pth'\n\ndef run_epoch(loader, is_train: bool):\n    model.train(is_train)\n    total_loss = 0.0\n    all_y, all_pred, all_prob = [], [], []\n\n    for images, labels in tqdm(loader, total=len(loader), leave=False):\n        images = images.to(device, non_blocking=True)\n        labels = labels.to(device, non_blocking=True)\n\n        if is_train:\n            optimizer.zero_grad(set_to_none=True)\n\n        with torch.set_grad_enabled(is_train):\n            with torch.autocast(device_type='cuda', dtype=torch.float16, enabled=(device.type == 'cuda')):\n                logits = model(images)\n                loss = criterion(logits, labels)\n            if is_train:\n                loss.backward()\n                optimizer.step()\n\n        probs = torch.softmax(logits.detach(), dim=1)\n        preds = probs.argmax(dim=1)\n\n        total_loss += loss.item() * images.size(0)\n        all_y.extend(labels.detach().cpu().numpy().tolist())\n        all_pred.extend(preds.detach().cpu().numpy().tolist())\n        all_prob.extend(probs.detach().cpu().numpy().tolist())\n\n    loss = total_loss / len(loader.dataset)\n    acc = accuracy_score(all_y, all_pred)\n    f1m = f1_score(all_y, all_pred, average='macro')\n    ll = log_loss(all_y, np.array(all_prob), labels=list(range(10)))\n    return loss, acc, f1m, ll, np.array(all_y), np.array(all_pred)\n\nhistory = []\nbest_val_logloss = float('inf')\npatience_left = PATIENCE\nbest_targets = None\nbest_preds = None\n\nfor epoch in range(1, EPOCHS + 1):\n    tr_loss, tr_acc, tr_f1, tr_ll, _, _ = run_epoch(train_loader, True)\n    va_loss, va_acc, va_f1, va_ll, va_y, va_pred = run_epoch(val_loader, False)\n    scheduler.step()\n\n    row = {\n        'epoch': epoch,\n        'train_loss': tr_loss,\n        'train_acc': tr_acc,\n        'train_f1_macro': tr_f1,\n        'train_logloss': tr_ll,\n        'val_loss': va_loss,\n        'val_acc': va_acc,\n        'val_f1_macro': va_f1,\n        'val_logloss': va_ll,\n    }\n    history.append(row)\n    print(row)\n\n    if va_ll < best_val_logloss:\n        best_val_logloss = va_ll\n        patience_left = PATIENCE\n        best_targets = va_y.copy()\n        best_preds = va_pred.copy()\n        torch.save({'model_state_dict': model.state_dict()}, best_ckpt)\n    else:\n        patience_left -= 1\n        if patience_left == 0:\n            print('Early stopping triggered.')\n            break\n\nhistory_df = pd.DataFrame(history)\ndisplay(history_df)\n"}, {"cell_type": "code", "execution_count": 9, "id": "5252b97f", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:36:48.084923Z", "iopub.status.busy": "2026-06-12T13:36:48.084816Z", "iopub.status.idle": "2026-06-12T13:36:48.298754Z", "shell.execute_reply": "2026-06-12T13:36:48.298285Z"}}, "outputs": [], "source": "plt.figure(figsize=(10, 4))\nplt.plot(history_df['epoch'], history_df['train_logloss'], label='Train log-loss')\nplt.plot(history_df['epoch'], history_df['val_logloss'], label='Val log-loss')\nplt.xlabel('Epoch')\nplt.ylabel('Log-loss')\nplt.title('Training Curve')\nplt.legend()\nplt.show()\n\ncm = confusion_matrix(best_targets, best_preds)\nplt.figure(figsize=(8, 6))\nsns.heatmap(cm, cmap='Blues', annot=False)\nplt.title('Validation Confusion Matrix (best epoch)')\nplt.xlabel('Predicted')\nplt.ylabel('True')\nplt.show()\n"}, {"cell_type": "markdown", "id": "dd7f3364", "metadata": {}, "source": "## 6. Inference and submission generation\n\nWe load the best checkpoint, predict probabilities for test images, and write a valid submission file.\n"}, {"cell_type": "code", "execution_count": 10, "id": "baf0e0e3", "metadata": {"execution": {"iopub.execute_input": "2026-06-12T13:36:48.300665Z", "iopub.status.busy": "2026-06-12T13:36:48.300556Z", "iopub.status.idle": "2026-06-12T13:37:49.314122Z", "shell.execute_reply": "2026-06-12T13:37:49.313273Z"}}, "outputs": [], "source": "model.load_state_dict(torch.load(best_ckpt, map_location=device)['model_state_dict'])\nmodel.eval()\n\nsample_submission = pd.read_csv(SAMPLE_SUB_CSV)\nif (not IS_KAGGLE) or (device.type != 'cuda'):\n    sample_submission = sample_submission.head(5000).copy()\ntest_ds = DriverDataset(sample_submission[['img']].copy(), transform=valid_tfms, is_test=True)\ntest_loader = DataLoader(\n    test_ds,\n    batch_size=BATCH_SIZE,\n    shuffle=False,\n    num_workers=4 if IS_KAGGLE else 0,\n    pin_memory=(device.type == 'cuda'),\n)\n\nimg_names = []\nprobs_list = []\n\nwith torch.no_grad():\n    for images, names in tqdm(test_loader, total=len(test_loader)):\n        images = images.to(device, non_blocking=True)\n        with torch.autocast(device_type='cuda', dtype=torch.float16, enabled=(device.type == 'cuda')):\n            logits = model(images)\n        probs = torch.softmax(logits, dim=1).cpu().numpy()\n        probs_list.append(probs)\n        img_names.extend(list(names))\n\nprobs = np.concatenate(probs_list, axis=0)\npred_df = pd.DataFrame(probs, columns=[f'c{i}' for i in range(10)])\nsubmission = pd.concat([pd.DataFrame({'img': img_names}), pred_df], axis=1)\nsubmission = submission[['img'] + [f'c{i}' for i in range(10)]].sort_values('img').reset_index(drop=True)\n\nsample_sorted = sample_submission[['img']].sort_values('img').reset_index(drop=True)\nassert submission['img'].equals(sample_sorted['img']), 'Image order mismatch.'\n\ntutorial_submission_path = WORK_DIR / 'tutorial_submission.csv'\nsubmission.to_csv(tutorial_submission_path, index=False)\n\nprint(f\"Saved tutorial submission to: {tutorial_submission_path}\")\ndisplay(submission.head())\n"}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.10"}, "widgets": {"application/vnd.jupyter.widget-state+json": {"state": {"0922e660ca9e4e4c92f416e9407ffc07": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null}}, "0ba0f2c67f6749ffb42d1b4ec3cd2e8e": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "FloatProgressModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_2f73ba8d4f3742ef85754f63558f8141", "max": 313.0, "min": 0.0, "orientation": "horizontal", "style": "IPY_MODEL_375ebc6f951141a187ff27b0000e7b71", "tabbable": null, "tooltip": null, "value": 313.0}}, "0c12bfb16ee348b3888a75ae661f6ded": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "13f0808f51a94920887bc850741c50af": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "1479735d72f24e219ae3927292341269": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "FloatProgressModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_ffef613e7ff545b091d6e426c9ea4838", "max": 75.0, "min": 0.0, "orientation": "horizontal", "style": "IPY_MODEL_94c6f4ab7be1433886aa01afc4d025dd", "tabbable": null, "tooltip": null, "value": 75.0}}, "18155d998625431d8c0697467af0529a": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": ["IPY_MODEL_fd01b91376c7498a84689a10c314a3bf", "IPY_MODEL_0ba0f2c67f6749ffb42d1b4ec3cd2e8e", "IPY_MODEL_71aa50fb8f4f42f7a9c4bc6bf2721ea7"], "layout": "IPY_MODEL_636cd20bfc4b497c82caf31c6abd4a93", "tabbable": null, "tooltip": null}}, "1b8232bdf1e24e36be0351383d7df596": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "2f73ba8d4f3742ef85754f63558f8141": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "329b2e761fb643e0a5b988d1d8eece28": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "32c225529bbe4d7795851f569abfcea7": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": "hidden", "width": null}}, "375ebc6f951141a187ff27b0000e7b71": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "ProgressStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "bar_color": null, "description_width": ""}}, "4dc16f44c3a24f03b3dd29686ec9b184": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "4ea13f7e513949c08c72048c3e4ab215": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_1b8232bdf1e24e36be0351383d7df596", "placeholder": "\u200b", "style": "IPY_MODEL_4dc16f44c3a24f03b3dd29686ec9b184", "tabbable": null, "tooltip": null, "value": "100%"}}, "5598b6da80924978a4006fc9f23856ff": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "63574f0f25264ff9959dcbeeab7d0cf2": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "FloatProgressModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "ProgressView", "bar_style": "", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_bc3dd2853003496998a8a3a05bfd12e8", "max": 250.0, "min": 0.0, "orientation": "horizontal", "style": "IPY_MODEL_b6ccc1013c43463f8d06f7c3c5eb7010", "tabbable": null, "tooltip": null, "value": 250.0}}, "636cd20bfc4b497c82caf31c6abd4a93": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "6c5d44fda9c944e3bd8fd7fe2a9552fe": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_e6f3e099a0da4b1bbd7deef0ecad4e6b", "placeholder": "\u200b", "style": "IPY_MODEL_9cdc452ebd374e9d97e6b545337dc481", "tabbable": null, "tooltip": null, "value": "100%"}}, "71aa50fb8f4f42f7a9c4bc6bf2721ea7": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_5598b6da80924978a4006fc9f23856ff", "placeholder": "\u200b", "style": "IPY_MODEL_dc23078d2dcf412b95ee3203ee41b6c6", "tabbable": null, "tooltip": null, "value": "\u2007313/313\u2007[01:00&lt;00:00,\u2007\u20075.48it/s]"}}, "8509f3a1fb7246e6b370a533947c8a9a": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": ["IPY_MODEL_6c5d44fda9c944e3bd8fd7fe2a9552fe", "IPY_MODEL_1479735d72f24e219ae3927292341269", "IPY_MODEL_9fdf8910697d41d4ac0338db29ad8188"], "layout": "IPY_MODEL_32c225529bbe4d7795851f569abfcea7", "tabbable": null, "tooltip": null}}, "94c6f4ab7be1433886aa01afc4d025dd": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "ProgressStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "bar_color": null, "description_width": ""}}, "956be47b6e854a63bf13f8c458db79a0": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "9cdc452ebd374e9d97e6b545337dc481": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "9fdf8910697d41d4ac0338db29ad8188": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_ed8d52fa47494c8c98ed60dec3328fc9", "placeholder": "\u200b", "style": "IPY_MODEL_0c12bfb16ee348b3888a75ae661f6ded", "tabbable": null, "tooltip": null, "value": "\u200775/75\u2007[00:14&lt;00:00,\u2007\u20075.28it/s]"}}, "aa35b9791a664a9a9a2a34e5e61ad4b9": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_329b2e761fb643e0a5b988d1d8eece28", "placeholder": "\u200b", "style": "IPY_MODEL_d0c2217ea7224e1da35fdfbee4a89804", "tabbable": null, "tooltip": null, "value": "\u2007250/250\u2007[03:16&lt;00:00,\u2007\u20071.45it/s]"}}, "b6ccc1013c43463f8d06f7c3c5eb7010": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "ProgressStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "bar_color": null, "description_width": ""}}, "bc3dd2853003496998a8a3a05bfd12e8": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "d0c2217ea7224e1da35fdfbee4a89804": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "dc23078d2dcf412b95ee3203ee41b6c6": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLStyleModel", "state": {"_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "StyleView", "background": null, "description_width": "", "font_size": null, "text_color": null}}, "e5366b2a55304c3eb05c4c193338f6a2": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HBoxModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HBoxView", "box_style": "", "children": ["IPY_MODEL_4ea13f7e513949c08c72048c3e4ab215", "IPY_MODEL_63574f0f25264ff9959dcbeeab7d0cf2", "IPY_MODEL_aa35b9791a664a9a9a2a34e5e61ad4b9"], "layout": "IPY_MODEL_0922e660ca9e4e4c92f416e9407ffc07", "tabbable": null, "tooltip": null}}, "e6f3e099a0da4b1bbd7deef0ecad4e6b": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "ed8d52fa47494c8c98ed60dec3328fc9": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}, "fd01b91376c7498a84689a10c314a3bf": {"model_module": "@jupyter-widgets/controls", "model_module_version": "2.0.0", "model_name": "HTMLModel", "state": {"_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "2.0.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "2.0.0", "_view_name": "HTMLView", "description": "", "description_allow_html": false, "layout": "IPY_MODEL_956be47b6e854a63bf13f8c458db79a0", "placeholder": "\u200b", "style": "IPY_MODEL_13f0808f51a94920887bc850741c50af", "tabbable": null, "tooltip": null, "value": "100%"}}, "ffef613e7ff545b091d6e426c9ea4838": {"model_module": "@jupyter-widgets/base", "model_module_version": "2.0.0", "model_name": "LayoutModel", "state": {"_model_module": "@jupyter-widgets/base", "_model_module_version": "2.0.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "2.0.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border_bottom": null, "border_left": null, "border_right": null, "border_top": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null}}}, "version_major": 2, "version_minor": 0}}}, "nbformat": 4, "nbformat_minor": 5}