{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Dynamic U-Net" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This module builds a dynamic [U-Net](https://arxiv.org/abs/1505.04597) from any backbone pretrained on ImageNet, automatically inferring the intermediate sizes." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "hide_input": true }, "outputs": [], "source": [ "from fastai.gen_doc.nbdoc import *\n", "from fastai.vision.models.unet import * " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "This is the original U-Net. The difference here is that the left part is a pretrained model." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "
class DynamicUnet[source]DynamicUnet(`encoder`:[`Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module), `n_classes`:`int`) :: [`Sequential`](https://pytorch.org/docs/stable/nn.html#torch.nn.Sequential)"
],
"text/plain": [
"class UnetBlock[source]UnetBlock(`up_in_c`:`int`, `x_in_c`:`int`, `hook`:[`Hook`](/callbacks.hooks.html#Hook)) :: [`Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)"
],
"text/plain": [
"forward[source]forward(`up_in`:`Tensor`) → `Tensor`\n",
"\n",
"Defines the computation performed at every call. Should be overridden by all subclasses.\n",
"\n",
".. note::\n",
" Although the recipe for forward pass needs to be defined within\n",
" this function, one should call the :class:`Module` instance afterwards\n",
" instead of this since the former takes care of running the\n",
" registered hooks while the latter silently ignores them. "
],
"text/plain": [
"