{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Minerva Experimental API\n", "\n", "This notebook is still in development and is not yet ready." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/usr/local/lib/python3.10/dist-packages/_distutils_hack/__init__.py:53: UserWarning: Reliance on distutils from stdlib is deprecated. Users must rely on setuptools to provide the distutils module. Avoid importing distutils or import setuptools first, and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. Register concerns at https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml\n", " warnings.warn(\n" ] } ], "source": [ "from minerva.pipelines.experiment import (\n", " ModelInstantiator,\n", " ModelInformation,\n", " ModelConfig,\n", " Experiment,\n", ")\n", "from minerva.data.data_modules.base import MinervaDataModule\n", "\n", "from pathlib import Path\n", "from typing import Dict, Tuple, Optional\n", "\n", "import numpy as np\n", "\n", "from minerva.data.datasets.supervised_dataset import SimpleDataset\n", "from minerva.data.readers import TiffReader, PNGReader\n", "from minerva.transforms.transform import (\n", " _Transform,\n", " TransformPipeline,\n", " Transpose,\n", " PadCrop,\n", " CastTo,\n", " Unsqueeze,\n", " Squeeze,\n", " Identity,\n", ")\n", "from minerva.utils.typing import PathLike\n", "import pandas as pd\n", "\n", "import torchvision.transforms as T" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "class NumberChannels(_Transform):\n", " def __init__(self, num_channels: int):\n", " self.num_channels = num_channels\n", " assert self.num_channels in [1, 3], \"Number of channels must be 1 or 3\"\n", "\n", " def __call__(self, data: np.ndarray) -> np.ndarray:\n", " if data.ndim != 3:\n", " raise ValueError(\n", " f\"Data must have 3 dimensions, but got {data.ndim}\"\n", " )\n", "\n", " if data.shape[0] != 3:\n", " raise ValueError(\n", " f\"Data must have 3 channels, but got {data.shape[0]}\"\n", " )\n", "\n", " if self.num_channels == 1:\n", " return data[0, :, :].reshape(1, data.shape[1], data.shape[2])\n", " else:\n", " return data\n", "\n", " def __str__(self):\n", " return f\"NumberChannels(num_channels={self.num_channels})\"\n", "\n", " def __repr__(self):\n", " return str(self)\n", " \n", " \n", "class MinMaxNormalize(_Transform):\n", " def __call__(self, data: np.ndarray) -> np.ndarray:\n", " return (data - data.min()) / (data.max() - data.min())\n", " \n", " def __str__(self):\n", " return \"MinMaxNormalize()\"\n", "\n", "\n", "def get_paihaka_data_module(\n", " root_data_dir: Path,\n", " root_annotation_dir: Path,\n", " img_size: Tuple[int, int, int] = (3, 1006, 590),\n", " label_size: Optional[Tuple[int, int, int]] = None,\n", " batch_size: int = 1,\n", " seed: int = 42,\n", " padding_mode: str = \"reflect\",\n", " padding_input_constant: int = 0,\n", " padding_label_constant: int = 0,\n", " normalize: bool = False,\n", " pad_test: bool = False,\n", ") -> MinervaDataModule:\n", " name = f\"seam_ai_padding_{padding_mode}\"\n", " label_size = label_size or img_size\n", "\n", " return MinervaDataModule(\n", " name=name,\n", " predict_split=\"test\",\n", " batch_size=batch_size,\n", " drop_last=True,\n", " shuffle_train=True,\n", " additional_test_dataloader_kwargs={\n", " \"drop_last\": False,\n", " },\n", " # Train dataset is a SimpleDataset with two readers\n", " # (TiffReader and PNGReader) with root path at \"/train\"\n", " train_dataset=SimpleDataset(\n", " readers=[\n", " TiffReader(\n", " path=root_data_dir / \"train\",\n", " sort_method=[\"text\", \"numeric\"],\n", " delimiter=\"_\",\n", " key_index=[0, 1],\n", " ),\n", " PNGReader(\n", " path=root_annotation_dir / \"train\",\n", " sort_method=[\"text\", \"numeric\"],\n", " delimiter=\"_\",\n", " key_index=[0, 1],\n", " ),\n", " ],\n", " transforms=[\n", " TransformPipeline(\n", " [\n", " Transpose([2, 0, 1]),\n", " MinMaxNormalize() if normalize else Identity(),\n", " PadCrop(\n", " target_h_size=img_size[1],\n", " target_w_size=img_size[2],\n", " padding_mode=padding_mode,\n", " constant_values=padding_input_constant,\n", " seed=seed,\n", " ),\n", " NumberChannels(num_channels=img_size[0]),\n", " CastTo(\"float32\"),\n", " ]\n", " ),\n", " TransformPipeline(\n", " [\n", " Unsqueeze(0),\n", " PadCrop(\n", " target_h_size=label_size[1],\n", " target_w_size=label_size[2],\n", " padding_mode=padding_mode,\n", " constant_values=padding_label_constant,\n", " seed=seed,\n", " ),\n", " CastTo(\"int32\"),\n", " ]\n", " ),\n", " ],\n", " ),\n", " # Validation dataset is a SimpleDataset with two readers\n", " # (TiffReader and PNGReader) with root path at \"/val\". Same transforms as\n", " # train dataset\n", " val_dataset=SimpleDataset(\n", " readers=[\n", " TiffReader(\n", " path=root_data_dir / \"val\",\n", " sort_method=[\"text\", \"numeric\"],\n", " delimiter=\"_\",\n", " key_index=[0, 1],\n", " ),\n", " PNGReader(\n", " path=root_annotation_dir / \"val\",\n", " sort_method=[\"text\", \"numeric\"],\n", " delimiter=\"_\",\n", " key_index=[0, 1],\n", " ),\n", " ],\n", " transforms=[\n", " TransformPipeline(\n", " [\n", " Transpose([2, 0, 1]),\n", " MinMaxNormalize() if normalize else Identity(),\n", " PadCrop(\n", " target_h_size=img_size[1],\n", " target_w_size=img_size[2],\n", " padding_mode=padding_mode,\n", " constant_values=padding_input_constant,\n", " seed=seed,\n", " ),\n", " NumberChannels(num_channels=img_size[0]),\n", " CastTo(\"float32\"),\n", " ]\n", " ),\n", " TransformPipeline(\n", " [\n", " Unsqueeze(0),\n", " PadCrop(\n", " target_h_size=label_size[1],\n", " target_w_size=label_size[2],\n", " padding_mode=padding_mode,\n", " constant_values=padding_label_constant,\n", " seed=seed,\n", " ),\n", " CastTo(\"int32\"),\n", " ]\n", " ),\n", " ],\n", " ),\n", " # Test dataset is a SimpleDataset with two readers\n", " # (TiffReader and PNGReader) with root path at \"/test\". The transforms are\n", " # the same as the train dataset, except for the label, which is squeezed\n", " # instead of unsqueezed\n", " test_dataset=SimpleDataset(\n", " readers=[\n", " TiffReader(\n", " path=root_data_dir / \"test\",\n", " sort_method=[\"text\", \"numeric\"],\n", " delimiter=\"_\",\n", " key_index=[0, 1],\n", " ),\n", " PNGReader(\n", " path=root_annotation_dir / \"test\",\n", " sort_method=[\"text\", \"numeric\"],\n", " delimiter=\"_\",\n", " key_index=[0, 1],\n", " ),\n", " ],\n", " transforms=[\n", " TransformPipeline(\n", " [ # Transforms for image reader (TIFF)\n", " Transpose([2, 0, 1]),\n", " MinMaxNormalize() if normalize else Identity(),\n", " PadCrop(\n", " target_h_size=img_size[1],\n", " target_w_size=img_size[2],\n", " padding_mode=padding_mode,\n", " constant_values=padding_input_constant,\n", " seed=seed,\n", " ) if pad_test else Identity(),\n", " NumberChannels(num_channels=img_size[0]),\n", " CastTo(\"float32\"),\n", " ]\n", " ),\n", " TransformPipeline(\n", " [ # Transforms for label reader (PNG)\n", " Unsqueeze(0),\n", " CastTo(\"int32\"),\n", " Squeeze(0),\n", " ]\n", " ),\n", " ],\n", " ),\n", " )\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "==================================================\n", " 🆔 seam_ai_padding_reflect\n", "==================================================\n", "├── Predict Split: test\n", "└── Dataloader class: \n", "📂 Datasets:\n", " ├── Train Dataset:\n", " │ ==================================================\n", " │ 📂 SimpleDataset Information \n", " │ ==================================================\n", " │ 📌 Dataset Type: SimpleDataset\n", " │ └── Reader 0: TiffReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/images/train' (1121 files)\n", " │ │ └── Transform: TransformPipeline(transforms=[Transpose(axes=[2, 0, 1]), Identity(), PadCrop(target_h_size=1006, target_w_size=590, padding_mode=reflect, constant_values=0, seed=42), NumberChannels(num_channels=3), CastTo(dtype=float32)])\n", " │ └── Reader 1: PNGReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/annotations/train' (1121 files)\n", " │ │ └── Transform: TransformPipeline(transforms=[Unsqueeze(axis=0), PadCrop(target_h_size=1006, target_w_size=590, padding_mode=reflect, constant_values=0, seed=42), CastTo(dtype=int32)])\n", " │ │\n", " │ └── Total Readers: 2\n", " │ ==================================================\n", " ├── Val Dataset:\n", " │ ==================================================\n", " │ 📂 SimpleDataset Information \n", " │ ==================================================\n", " │ 📌 Dataset Type: SimpleDataset\n", " │ └── Reader 0: TiffReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/images/val' (51 files)\n", " │ │ └── Transform: TransformPipeline(transforms=[Transpose(axes=[2, 0, 1]), Identity(), PadCrop(target_h_size=1006, target_w_size=590, padding_mode=reflect, constant_values=0, seed=42), NumberChannels(num_channels=3), CastTo(dtype=float32)])\n", " │ └── Reader 1: PNGReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/annotations/val' (51 files)\n", " │ │ └── Transform: TransformPipeline(transforms=[Unsqueeze(axis=0), PadCrop(target_h_size=1006, target_w_size=590, padding_mode=reflect, constant_values=0, seed=42), CastTo(dtype=int32)])\n", " │ │\n", " │ └── Total Readers: 2\n", " │ ==================================================\n", " └── Test Dataset:\n", " ==================================================\n", " 📂 SimpleDataset Information \n", " ==================================================\n", " 📌 Dataset Type: SimpleDataset\n", " └── Reader 0: TiffReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/images/test' (200 files)\n", " │ └── Transform: TransformPipeline(transforms=[Transpose(axes=[2, 0, 1]), Identity(), Identity(), NumberChannels(num_channels=3), CastTo(dtype=float32)])\n", " └── Reader 1: PNGReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/annotations/test' (200 files)\n", " │ └── Transform: TransformPipeline(transforms=[Unsqueeze(axis=0), CastTo(dtype=int32), Squeeze(axis=0)])\n", " │\n", " └── Total Readers: 2\n", " ==================================================\n", "\n", "🛠 **Dataloader Configurations:**\n", " ├── Train Dataloader Kwargs:\n", " ├── batch_size: 8\n", " ├── num_workers: 0\n", " ├── shuffle: true\n", " ├── drop_last: true\n", " ├── Val Dataloader Kwargs:\n", " ├── batch_size: 8\n", " ├── num_workers: 0\n", " ├── shuffle: false\n", " ├── drop_last: true\n", " └── Test Dataloader Kwargs:\n", " ├── batch_size: 8\n", " ├── num_workers: 0\n", " ├── shuffle: false\n", " ├── drop_last: false\n", "==================================================\n" ] } ], "source": [ "data_module = get_paihaka_data_module(\n", " root_data_dir=Path(\"/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/images/\"),\n", " root_annotation_dir=Path(\"/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/annotations/\"),\n", " img_size=(3, 1006, 590),\n", " batch_size=8,\n", " seed=42,\n", " padding_mode=\"reflect\",\n", " pad_test=False,\n", " normalize=False,\n", ")\n", "\n", "print(data_module)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/usr/local/lib/python3.10/dist-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "from minerva.models.nets.image.deeplabv3 import DeepLabV3\n", "import lightning as L\n", "import torch\n", "from minerva.models.loaders import FromPretrained\n", "from minerva.losses.weighted_dice_loss import WeightedDiceLoss\n", "\n", "\n", "class DeepLabV3Instantiator(ModelInstantiator):\n", " def __init__(\n", " self,\n", " num_classes: int = 6,\n", " epochs: int = 100,\n", " loss: str = \"ce\",\n", " optimizer=\"adamw\",\n", " learning_rate=1e-4,\n", " ):\n", " self.num_classes = num_classes\n", " self.epochs = epochs\n", " self.loss = loss\n", " self.optimizer = optimizer\n", " self.learning_rate = learning_rate\n", " if self.loss == \"ce\":\n", " self.loss_fn = torch.nn.CrossEntropyLoss()\n", " elif self.loss == \"wdice\":\n", " self.loss_fn = WeightedDiceLoss(num_classes=num_classes)\n", " else:\n", " raise ValueError(f\"Loss {self.loss} not supported\")\n", "\n", " def create_model_randomly_initialized(self) -> L.LightningModule:\n", " return DeepLabV3(\n", " num_classes=self.num_classes,\n", " loss_fn=self.loss_fn,\n", " epochs=self.epochs,\n", " optimizer=self.optimizer,\n", " learning_rate=self.learning_rate,\n", " )\n", "\n", " def create_model_and_load_backbone(self, backbone_checkpoint_path):\n", " model = self.create_model_randomly_initialized()\n", " model = FromPretrained(\n", " model,\n", " ckpt_path=backbone_checkpoint_path,\n", " strict=False,\n", " ckpt_key=None,\n", " keys_to_rename={\"\": \"backbone.RN50model.\"},\n", " error_on_missing_keys=False,\n", " )\n", " return model\n", "\n", " def load_model_from_checkpoint(\n", " self, checkpoint_path: PathLike\n", " ) -> L.LightningModule:\n", " model = self.create_model_randomly_initialized()\n", " return FromPretrained(model, ckpt_path=checkpoint_path, strict=False)\n", "\n", "\n", "deeplabv3_config = ModelConfig(\n", " instantiator=DeepLabV3Instantiator(\n", " num_classes=6,\n", " optimizer=\"adam+lr_scheduler\",\n", " loss=\"wdice\",\n", " epochs=100,\n", " learning_rate=1e-5,\n", " ),\n", " information=ModelInformation(\n", " name=\"DeepLabV3\",\n", " input_shape=(3, 1006, 590),\n", " output_shape=(6, 1006, 590),\n", " num_classes=6,\n", " return_logits=True,\n", " ),\n", ")\n", "\n", "print(deeplabv3_config)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "================================================================================\n", " 🚀 Experiment: test 🚀\n", "================================================================================\n", "\n", "🛠 **Execution Details:**\n", " ├── Execution ID: 0\n", " ├── Log Dir: test_logs/DeepLabV3/seam_ai_padding_reflect/test/0\n", " ├── Seed: 42\n", " ├── Accelerator: gpu\n", " ├── Devices: 1\n", " └── Max Epochs: 3\n", "\n", "🧠 **Model Information:**\n", " ├── Model Name: DeepLabV3\n", " ├── Input Shape: (3, 1006, 590)\n", " ├── Output Shape: (6, 1006, 590)\n", " └── Num Classes: 6\n", "\n", "📂 **Dataset Information:**\n", " ==================================================\n", " 🆔 seam_ai_padding_reflect\n", " ==================================================\n", " ├── Predict Split: test\n", " └── Dataloader class: \n", " 📂 Datasets:\n", " ├── Train Dataset:\n", " │ ==================================================\n", " │ 📂 SimpleDataset Information \n", " │ ==================================================\n", " │ 📌 Dataset Type: SimpleDataset\n", " │ └── Reader 0: TiffReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/images/train' (1121 files)\n", " │ │ └── Transform: TransformPipeline(transforms=[Transpose(axes=[2, 0, 1]), Identity(), PadCrop(target_h_size=1006, target_w_size=590, padding_mode=reflect, constant_values=0, seed=42), NumberChannels(num_channels=3), CastTo(dtype=float32)])\n", " │ └── Reader 1: PNGReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/annotations/train' (1121 files)\n", " │ │ └── Transform: TransformPipeline(transforms=[Unsqueeze(axis=0), PadCrop(target_h_size=1006, target_w_size=590, padding_mode=reflect, constant_values=0, seed=42), CastTo(dtype=int32)])\n", " │ │\n", " │ └── Total Readers: 2\n", " │ ==================================================\n", " ├── Val Dataset:\n", " │ ==================================================\n", " │ 📂 SimpleDataset Information \n", " │ ==================================================\n", " │ 📌 Dataset Type: SimpleDataset\n", " │ └── Reader 0: TiffReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/images/val' (51 files)\n", " │ │ └── Transform: TransformPipeline(transforms=[Transpose(axes=[2, 0, 1]), Identity(), PadCrop(target_h_size=1006, target_w_size=590, padding_mode=reflect, constant_values=0, seed=42), NumberChannels(num_channels=3), CastTo(dtype=float32)])\n", " │ └── Reader 1: PNGReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/annotations/val' (51 files)\n", " │ │ └── Transform: TransformPipeline(transforms=[Unsqueeze(axis=0), PadCrop(target_h_size=1006, target_w_size=590, padding_mode=reflect, constant_values=0, seed=42), CastTo(dtype=int32)])\n", " │ │\n", " │ └── Total Readers: 2\n", " │ ==================================================\n", " └── Test Dataset:\n", " ==================================================\n", " 📂 SimpleDataset Information \n", " ==================================================\n", " 📌 Dataset Type: SimpleDataset\n", " └── Reader 0: TiffReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/images/test' (200 files)\n", " │ └── Transform: TransformPipeline(transforms=[Transpose(axes=[2, 0, 1]), Identity(), Identity(), NumberChannels(num_channels=3), CastTo(dtype=float32)])\n", " └── Reader 1: PNGReader at '/workspaces/HIAAC-KR-Dev-Container/shared_data/seam_ai_datasets/seam_ai/annotations/test' (200 files)\n", " │ └── Transform: TransformPipeline(transforms=[Unsqueeze(axis=0), CastTo(dtype=int32), Squeeze(axis=0)])\n", " │\n", " └── Total Readers: 2\n", " ==================================================\n", "\n", " 🛠 **Dataloader Configurations:**\n", " ├── Train Dataloader Kwargs:\n", " ├── batch_size: 8\n", " ├── num_workers: 0\n", " ├── shuffle: true\n", " ├── drop_last: true\n", " ├── Val Dataloader Kwargs:\n", " ├── batch_size: 8\n", " ├── num_workers: 0\n", " ├── shuffle: false\n", " ├── drop_last: true\n", " └── Test Dataloader Kwargs:\n", " ├── batch_size: 8\n", " ├── num_workers: 0\n", " ├── shuffle: false\n", " ├── drop_last: false\n", " ==================================================\n", "\n" ] } ], "source": [ "from torchmetrics import JaccardIndex\n", "\n", "experiment = Experiment(\n", " experiment_name=\"test\",\n", " model_config=deeplabv3_config,\n", " data_module=data_module,\n", " \n", " root_log_dir=\"test_logs\",\n", " max_epochs=3,\n", " seed=42, \n", " checkpoint_metrics=[\n", " {\"mode\": \"min\", \"monitor\": \"train_loss\", \"filename\": \"min_train_loss\"},\n", " {\"mode\": \"min\", \"monitor\": \"val_loss\", \"filename\": \"min_val_loss\"},\n", " ],\n", " \n", " limit_train_batches=10,\n", " limit_val_batches=10,\n", " \n", " evaluation_metrics={\n", " \"miou-macro\": JaccardIndex(task=\"multiclass\", num_classes=6, average=\"macro\"),\n", " \"miou-micro\": JaccardIndex(task=\"multiclass\", num_classes=6, average=\"micro\"),\n", " \"miou-weighted\": JaccardIndex(task=\"multiclass\", num_classes=6, average=\"weighted\"),\n", " },\n", " save_predictions=False\n", ")\n", "\n", "print(experiment)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Experiment at 'test_logs/DeepLabV3/seam_ai_padding_reflect/test/0' cleaned up.\n" ] } ], "source": [ "experiment.cleanup()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'experiment_name': 'test',\n", " 'log_dir': PosixPath('test_logs/DeepLabV3/seam_ai_padding_reflect/test/0'),\n", " 'checkpoints': {},\n", " 'training_metrics': None,\n", " 'prediction_paths': {},\n", " 'results_paths': {},\n", " 'state': 'not executed'}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "experiment.status" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "** Seed set to: 42 **\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "GPU available: True (cuda), used: True\n", "TPU available: False, using: 0 TPU cores\n", "HPU available: False, using: 0 HPUs\n", "LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "================================================================================\n", " Experiment: test \n", "================================================================================\n", "🧠 Model\n", " ├── Name: DeepLabV3\n", " ├── Finetune: No\n", " ├── Resumed From: Beginning\n", " ├── Expected Input Shape: (3, 1006, 590)\n", " ├── Expected Output Shape: (6, 1006, 590)\n", " ├── Total Params: 41,684,014\n", " └── Trainable Params: 41,684,014 (100.00%)\n", "\n", "📊 Dataset\n", " ├── Train Samples: 1121\n", " | ├── Input Shape: (3, 1006, 590)\n", " | └── Label Shape: (1, 1006, 590)\n", " └── Val Samples: 51\n", " ├── Input Shape: (3, 1006, 590)\n", " └── Label Shape: (1, 1006, 590)\n", "\n", "💾 Logging & Checkpoints\n", " ├── Log Dir: test_logs/DeepLabV3/seam_ai_padding_reflect/test/0\n", " ├── Metrics Path: test_logs/DeepLabV3/seam_ai_padding_reflect/test/0/metrics.csv\n", " └── Checkpoints Dir: test_logs/DeepLabV3/seam_ai_padding_reflect/test/0/checkpoints\n", " └── Files: min_train_loss.ckpt, min_val_loss.ckpt, last.ckpt\n", "\n", "⚙️ Trainer Config\n", " ├── Max Epochs: 3\n", " ├── Train Batches: 10\n", " ├── Accelerator: gpu\n", " ├── Strategy: auto\n", " ├── Devices: 1\n", " ├── Num Nodes: 1\n", " └── Seed: 42\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", " | Name | Type | Params | Mode \n", "-------------------------------------------------------------\n", "0 | backbone | DeepLabV3Backbone | 25.6 M | train\n", "1 | fc | DeepLabV3PredictionHead | 16.1 M | train\n", "2 | loss_fn | WeightedDiceLoss | 0 | train\n", "-------------------------------------------------------------\n", "41.7 M Trainable params\n", "0 Non-trainable params\n", "41.7 M Total params\n", "166.736 Total estimated model params size (MB)\n", "186 Modules in train mode\n", "0 Modules in eval mode\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Sanity Checking: | | 0/? [00:00here for more info. \n", "\u001b[1;31mView Jupyter log for further details." ] } ], "source": [ "result = experiment.run(task=\"fit-evaluate\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "experiment.status" ] } ], "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.10.12" } }, "nbformat": 4, "nbformat_minor": 2 }