StyleGAN logbook generator and formatting
This commit is contained in:
parent
fb7d854abe
commit
1d40340e42
3 changed files with 286 additions and 199 deletions
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,22 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c08a9c8e-bcce-4b45-94ad-b422ad60bea9",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# This Place Does Exists - Utilities for Stylegan3\n",
|
||||
"\n",
|
||||
"This notebook contains utility functions for working with the models created by StyleGAN3. \n",
|
||||
"\n",
|
||||
"## Usage\n",
|
||||
"\n",
|
||||
"Include it in any notebook using `%run ThisPlaceDoesExist.ipynb`. After which everything from this notebook becomes available. Including a `runs` variable which is a list containing all the `Run` objects."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 35,
|
||||
"execution_count": 1,
|
||||
"id": "f4ee99c4-9c28-4fe4-9408-e130a0d446d3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
@ -52,7 +66,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 4,
|
||||
"id": "4c428611-8d75-4f9a-ae5a-7960e7b01470",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
@ -68,16 +82,6 @@
|
|||
"See [Snapshot_images.ipynb](Snapshot_images.ipynb) for examples of each run/snapshot."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "9a5c4a18-0389-4d36-989e-7a120db590ab",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# snapshot = runs[3].snapshots[70]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c3aa8404-aeb0-4f63-b4b4-c278f0cf3766",
|
||||
|
@ -90,7 +94,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 5,
|
||||
"id": "c180db45-9bf1-4f0a-ab55-62b476a5897c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
@ -115,22 +119,10 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 6,
|
||||
"id": "22c74f41-65e7-461a-9094-f0b3d8738c82",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'runs' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"\u001b[0;32m/tmp/ipykernel_1/862876608.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# def is_main():\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mplot\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mplot_runs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mruns\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mplot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlegend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbbox_to_anchor\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mloc\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"lower left\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mplot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||||
"\u001b[0;31mNameError\u001b[0m: name 'runs' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def is_main():\n",
|
||||
" plot = plot_runs(runs)\n",
|
||||
|
@ -449,11 +441,11 @@
|
|||
" runnr = snapshot.run.as_nr\n",
|
||||
" # !!python pbaylies_projector.py --network $snapshot_pkl --outdir out/projections/$runnr-$imagenr --target-image $image_filename --use-clip=False\n",
|
||||
" \n",
|
||||
" if replace_if_exists or not os.path.exists(f\"out/projections/{runnr}/{image_name}/proj.png\"):\n",
|
||||
" if replace_if_exists or not os.path.exists(f\"out/projections/{snapshot.id}/{image_name}/proj.png\"):\n",
|
||||
" process = subprocess.Popen([\n",
|
||||
" \"python\", \"pbaylies_projector.py\",\n",
|
||||
" \"--network\" , snapshot.pkl_path,\n",
|
||||
" \"--outdir\", f\"out/projections/{runnr}/{image_name}\",\n",
|
||||
" \"--outdir\", f\"out/projections/{snapshot.id}/{image_name}\",\n",
|
||||
" \"--target-image\", image_filename,\n",
|
||||
" \"--use-clip\", \"False\",\n",
|
||||
" \"--num-steps\", str(steps),\n",
|
||||
|
@ -469,10 +461,10 @@
|
|||
" loss, dist = (None, None)\n",
|
||||
"\n",
|
||||
" return {\n",
|
||||
" \"img\": f\"out/projections/{runnr}-{imagenr}/proj.png\",\n",
|
||||
" \"src_img\": f\"out/projections/{runnr}-{imagenr}/target.png\",\n",
|
||||
" \"img\": f\"out/projections/{snapshot.id}/{image_name}/proj.png\",\n",
|
||||
" \"src_img\": f\"out/projections/{snapshot.id}/{image_name}/target.png\",\n",
|
||||
" \"src\": image_filename,\n",
|
||||
" \"npz\": f\"out/projections/{runnr}-{imagenr}/projected_w.npz\",\n",
|
||||
" \"npz\": f\"out/projections/{snapshot.id}/{image_name}/projected_w.npz\",\n",
|
||||
" \"loss\": loss,\n",
|
||||
" \"dist\": dist\n",
|
||||
" }\n",
|
||||
|
@ -568,43 +560,6 @@
|
|||
" # output.release()\n",
|
||||
" writer.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 46,
|
||||
"id": "6ff4c6db-b48f-4ff4-b08c-e85138f0f307",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"id": "d0661104-72a7-4320-980a-1a702388659f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"True"
|
||||
]
|
||||
},
|
||||
"execution_count": 33,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "e2aa2c98-cf1e-465a-9455-fe4a02f145ad",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
<section id='cover'>
|
||||
<h1 class="title">This Place Does Exist</h1>
|
||||
<h2>Stylegan 3 Snapshots</h2>
|
||||
<div class='authors'>Ward Goes & Ruben van de Ven</div>
|
||||
</section>
|
||||
|
||||
<section id="introduction">
|
||||
{{introduction}}
|
||||
</section>
|
||||
|
||||
<section id="toc">
|
||||
|
|
Loading…
Reference in a new issue