|
|
|
@ -504,10 +504,14 @@ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"metadata": { |
|
|
|
|
"id": "BLk3J0h3MtON" |
|
|
|
|
"id": "BLk3J0h3MtON", |
|
|
|
|
"cellView": "form" |
|
|
|
|
}, |
|
|
|
|
"outputs": [], |
|
|
|
|
"source": [ |
|
|
|
|
"#@title ### 1.4 Define Midas functions\n", |
|
|
|
|
"\n", |
|
|
|
|
"\n", |
|
|
|
|
"from midas.dpt_depth import DPTDepthModel\n", |
|
|
|
|
"from midas.midas_net import MidasNet\n", |
|
|
|
|
"from midas.midas_net_custom import MidasNet_small\n", |
|
|
|
@ -618,7 +622,7 @@ |
|
|
|
|
}, |
|
|
|
|
"outputs": [], |
|
|
|
|
"source": [ |
|
|
|
|
"#@title 1.4 Define necessary functions\n", |
|
|
|
|
"#@title 1.5 Define necessary functions\n", |
|
|
|
|
"\n", |
|
|
|
|
"# https://gist.github.com/adefossez/0646dbe9ed4005480a2407c62aac8869\n", |
|
|
|
|
"\n", |
|
|
|
@ -1378,7 +1382,7 @@ |
|
|
|
|
}, |
|
|
|
|
"outputs": [], |
|
|
|
|
"source": [ |
|
|
|
|
"#@title 1.5 Define the secondary diffusion model\n", |
|
|
|
|
"#@title 1.6 Define the secondary diffusion model\n", |
|
|
|
|
"\n", |
|
|
|
|
"def append_dims(x, n):\n", |
|
|
|
|
" return x[(Ellipsis, *(None,) * (n - x.ndim))]\n", |
|
|
|
@ -1552,7 +1556,7 @@ |
|
|
|
|
}, |
|
|
|
|
"outputs": [], |
|
|
|
|
"source": [ |
|
|
|
|
"#@title 1.6 SuperRes Define\n", |
|
|
|
|
"#@title 1.7 SuperRes Define\n", |
|
|
|
|
"class DDIMSampler(object):\n", |
|
|
|
|
" def __init__(self, model, schedule=\"linear\", **kwargs):\n", |
|
|
|
|
" super().__init__()\n", |
|
|
|
@ -3094,4 +3098,4 @@ |
|
|
|
|
}, |
|
|
|
|
"nbformat": 4, |
|
|
|
|
"nbformat_minor": 0 |
|
|
|
|
} |
|
|
|
|
} |