Skip to content

Commit

Permalink
Update tutorial notebook to document worm lighter than background fea…
Browse files Browse the repository at this point in the history
…ture
  • Loading branch information
iteal committed Dec 10, 2020
1 parent fb9e5ce commit a92c045
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
10 changes: 7 additions & 3 deletions examples/check_dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,14 @@
"# for Tierpsy tracker data this will be the root path of a folder containing subfolders for each videos\n",
"dataset_path = \"wormpose_data/datasets/sample_data\"\n",
"\n",
"# Set if the worm is lighter than the background in the image\n",
"# In the sample data, the worm is darker so we set this variable to False\n",
"worm_is_lighter = False\n",
"\n",
"# This function loads the dataset\n",
"# optional fields: there is an optional resize parameter to resize the images\n",
"# also you can select specific videos from the dataset instead of loading them all\n",
"dataset = load_dataset(dataset_loader, dataset_path)"
"dataset = load_dataset(dataset_loader, dataset_path, worm_is_lighter=worm_is_lighter)"
]
},
{
Expand Down Expand Up @@ -310,9 +314,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
26 changes: 19 additions & 7 deletions examples/tutorial_sample_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,14 @@
"dataset_root_name = os.path.basename(os.path.normpath(dataset_path))\n",
"project_dir = os.path.join(default_paths.WORK_DIR, dataset_root_name)\n",
"\n",
"# Set if the worm is lighter than the background in the image\n",
"# in the sample data, the worm is darker so we set this variable to False\n",
"worm_is_lighter = False\n",
"\n",
"# This function loads the dataset\n",
"# optional fields: there is an optional resize parameter to resize the images\n",
"# also you can select specific videos from the dataset instead of loading them all\n",
"dataset = load_dataset(dataset_loader, dataset_path)"
"dataset = load_dataset(dataset_loader, dataset_path, worm_is_lighter=worm_is_lighter)"
]
},
{
Expand Down Expand Up @@ -153,7 +157,9 @@
"from wormpose.demo.synthetic_simple_visualizer import SyntheticSimpleVisualizer\n",
"from ipython_utils import ImagesViewer, display_as_slider\n",
"\n",
"synth_viz = SyntheticSimpleVisualizer(dataset_loader, dataset_path).generate()\n",
"synth_viz = SyntheticSimpleVisualizer(dataset_loader,\n",
" dataset_path, \n",
" worm_is_lighter=worm_is_lighter).generate()\n",
"img_viewer, img_viewer_plot = ImagesViewer(), ImagesViewer()\n",
"num_images = 50\n",
"\n",
Expand Down Expand Up @@ -194,7 +200,9 @@
"from wormpose.demo.real_simple_visualizer import RealSimpleVisualizer\n",
"from ipython_utils import ImagesViewer, display_as_slider\n",
"\n",
"viz = RealSimpleVisualizer(dataset_loader, dataset_path).generate()\n",
"viz = RealSimpleVisualizer(dataset_loader, \n",
" dataset_path, \n",
" worm_is_lighter=worm_is_lighter).generate()\n",
"orig_img_viewer, processed_img_viewer = ImagesViewer(), ImagesViewer()\n",
"\n",
"max_viz = 100\n",
Expand Down Expand Up @@ -234,7 +242,10 @@
"from wormpose.commands import calibrate\n",
"from ipython_utils import ImagesViewer\n",
"\n",
"video_name, result_file = next(calibrate(dataset_loader, dataset_path, save_images=True))\n",
"video_name, result_file = next(calibrate(dataset_loader, \n",
" dataset_path, \n",
" worm_is_lighter=worm_is_lighter,\n",
" save_images=True))\n",
"\n",
"VIEW_SCORES = 5\n",
"\n",
Expand Down Expand Up @@ -285,7 +296,8 @@
"display(fp)\n",
"\n",
"gen_progress = generate(dataset_loader,\n",
" dataset_path, \n",
" dataset_path,\n",
" worm_is_lighter=worm_is_lighter,\n",
" num_train_samples=1000)\n",
"for progress_value in gen_progress:\n",
" fp.value = progress_value"
Expand Down Expand Up @@ -447,9 +459,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}

0 comments on commit a92c045

Please sign in to comment.