Skip to content

Commit

Permalink
rarrange code
Browse files Browse the repository at this point in the history
  • Loading branch information
davidackerman committed Feb 9, 2024
1 parent 150b293 commit f722326
Showing 1 changed file with 47 additions and 44 deletions.
91 changes: 47 additions & 44 deletions examples/distance_task/finetune_liver.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
" ResampledArrayConfig,\n",
" ZarrArrayConfig,\n",
")\n",
"from dacapo.experiments.datasplits.datasets import RawGTDatasetConfig\n",
"from dacapo.experiments.datasplits import TrainValidateDataSplitConfig\n",
"from dacapo.experiments.tasks import DistanceTaskConfig\n",
"from dacapo.experiments.architectures import CNNectomeUNetConfig\n",
"from dacapo.experiments.trainers import GunpowderTrainerConfig\n",
"from dacapo.experiments.trainers.gp_augments import (\n",
Expand All @@ -39,7 +38,10 @@
" IntensityAugmentConfig,\n",
" IntensityScaleShiftAugmentConfig,\n",
")\n",
"from dacapo.experiments.tasks import DistanceTaskConfig"
"from dacapo.experiments.datasplits import TrainValidateDataSplitConfig\n",
"from dacapo.experiments.datasplits.datasets import RawGTDatasetConfig\n",
"from dacapo.experiments.starts import StartConfig\n",
"from dacapo.experiments import RunConfig"
]
},
{
Expand Down Expand Up @@ -82,6 +84,36 @@
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Architecture"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"architecture_config = CNNectomeUNetConfig(\n",
" name=\"example_upsample-unet\",\n",
" input_shape=(216, 216, 216),\n",
" fmaps_out=72,\n",
" fmaps_in=1,\n",
" num_fmaps=12,\n",
" fmap_inc_factor=6,\n",
" downsample_factors=[(2, 2, 2), (3, 3, 3), (3, 3, 3)],\n",
" kernel_size_down=None,\n",
" kernel_size_up=None,\n",
" eval_shape_increase=(72, 72, 72),\n",
" upsample_factors=[(2, 2, 2)],\n",
" constant_upsample=True,\n",
" padding=\"valid\",\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -90,7 +122,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -118,37 +150,6 @@
")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Architecture"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"architecture_config = CNNectomeUNetConfig(\n",
" name=\"example_upsample-unet\",\n",
" input_shape=(216, 216, 216),\n",
" fmaps_out=72,\n",
" fmaps_in=1,\n",
" num_fmaps=12,\n",
" fmap_inc_factor=6,\n",
" downsample_factors=[(2, 2, 2), (3, 3, 3), (3, 3, 3)],\n",
" kernel_size_down=None,\n",
" kernel_size_up=None,\n",
" eval_shape_increase=(72, 72, 72),\n",
" upsample_factors=[(2, 2, 2)],\n",
" constant_upsample=True,\n",
" padding=\"valid\",\n",
")"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down Expand Up @@ -1638,15 +1639,10 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"from dacapo.experiments import RunConfig\n",
"from dacapo.experiments.starts import StartConfig\n",
"from dacapo.store.create_store import create_config_store\n",
"\n",
"config_store = create_config_store()\n",
"start_config = StartConfig(\n",
" \"finetuned_3d_lsdaffs_nuclearpores_6-28_weights_upsample-unet_default_v2_weights__test_3\",\n",
" \"145000\",\n",
Expand All @@ -1661,16 +1657,16 @@
" \"example\",\n",
" \"scratch\" if start_config is None else \"finetuned\",\n",
" task_config.name,\n",
" datasplit_config.name,\n",
" architecture_config.name,\n",
" trainer_config.name,\n",
" datasplit_config.name,\n",
" ]\n",
" )\n",
" + f\"__{i}\",\n",
" task_config=task_config,\n",
" datasplit_config=datasplit_config,\n",
" architecture_config=architecture_config,\n",
" trainer_config=trainer_config,\n",
" datasplit_config=datasplit_config,\n",
" num_iterations=iterations,\n",
" validation_interval=validation_interval,\n",
" repetition=i,\n",
Expand All @@ -1687,7 +1683,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -1700,6 +1696,13 @@
"config_store.store_datasplit_config(datasplit_config)\n",
"config_store.store_run_config(run_config)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit f722326

Please sign in to comment.