Skip to content

Commit a92c045

Browse files
committed
Update tutorial notebook to document worm lighter than background feature
1 parent fb9e5ce commit a92c045

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

examples/check_dataset.ipynb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,14 @@
9090
"# for Tierpsy tracker data this will be the root path of a folder containing subfolders for each videos\n",
9191
"dataset_path = \"wormpose_data/datasets/sample_data\"\n",
9292
"\n",
93+
"# Set if the worm is lighter than the background in the image\n",
94+
"# In the sample data, the worm is darker so we set this variable to False\n",
95+
"worm_is_lighter = False\n",
96+
"\n",
9397
"# This function loads the dataset\n",
9498
"# optional fields: there is an optional resize parameter to resize the images\n",
9599
"# also you can select specific videos from the dataset instead of loading them all\n",
96-
"dataset = load_dataset(dataset_loader, dataset_path)"
100+
"dataset = load_dataset(dataset_loader, dataset_path, worm_is_lighter=worm_is_lighter)"
97101
]
98102
},
99103
{
@@ -310,9 +314,9 @@
310314
"name": "python",
311315
"nbconvert_exporter": "python",
312316
"pygments_lexer": "ipython3",
313-
"version": "3.7.4"
317+
"version": "3.8.6"
314318
}
315319
},
316320
"nbformat": 4,
317321
"nbformat_minor": 4
318-
}
322+
}

examples/tutorial_sample_data.ipynb

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,14 @@
9797
"dataset_root_name = os.path.basename(os.path.normpath(dataset_path))\n",
9898
"project_dir = os.path.join(default_paths.WORK_DIR, dataset_root_name)\n",
9999
"\n",
100+
"# Set if the worm is lighter than the background in the image\n",
101+
"# in the sample data, the worm is darker so we set this variable to False\n",
102+
"worm_is_lighter = False\n",
103+
"\n",
100104
"# This function loads the dataset\n",
101105
"# optional fields: there is an optional resize parameter to resize the images\n",
102106
"# also you can select specific videos from the dataset instead of loading them all\n",
103-
"dataset = load_dataset(dataset_loader, dataset_path)"
107+
"dataset = load_dataset(dataset_loader, dataset_path, worm_is_lighter=worm_is_lighter)"
104108
]
105109
},
106110
{
@@ -153,7 +157,9 @@
153157
"from wormpose.demo.synthetic_simple_visualizer import SyntheticSimpleVisualizer\n",
154158
"from ipython_utils import ImagesViewer, display_as_slider\n",
155159
"\n",
156-
"synth_viz = SyntheticSimpleVisualizer(dataset_loader, dataset_path).generate()\n",
160+
"synth_viz = SyntheticSimpleVisualizer(dataset_loader,\n",
161+
" dataset_path, \n",
162+
" worm_is_lighter=worm_is_lighter).generate()\n",
157163
"img_viewer, img_viewer_plot = ImagesViewer(), ImagesViewer()\n",
158164
"num_images = 50\n",
159165
"\n",
@@ -194,7 +200,9 @@
194200
"from wormpose.demo.real_simple_visualizer import RealSimpleVisualizer\n",
195201
"from ipython_utils import ImagesViewer, display_as_slider\n",
196202
"\n",
197-
"viz = RealSimpleVisualizer(dataset_loader, dataset_path).generate()\n",
203+
"viz = RealSimpleVisualizer(dataset_loader, \n",
204+
" dataset_path, \n",
205+
" worm_is_lighter=worm_is_lighter).generate()\n",
198206
"orig_img_viewer, processed_img_viewer = ImagesViewer(), ImagesViewer()\n",
199207
"\n",
200208
"max_viz = 100\n",
@@ -234,7 +242,10 @@
234242
"from wormpose.commands import calibrate\n",
235243
"from ipython_utils import ImagesViewer\n",
236244
"\n",
237-
"video_name, result_file = next(calibrate(dataset_loader, dataset_path, save_images=True))\n",
245+
"video_name, result_file = next(calibrate(dataset_loader, \n",
246+
" dataset_path, \n",
247+
" worm_is_lighter=worm_is_lighter,\n",
248+
" save_images=True))\n",
238249
"\n",
239250
"VIEW_SCORES = 5\n",
240251
"\n",
@@ -285,7 +296,8 @@
285296
"display(fp)\n",
286297
"\n",
287298
"gen_progress = generate(dataset_loader,\n",
288-
" dataset_path, \n",
299+
" dataset_path,\n",
300+
" worm_is_lighter=worm_is_lighter,\n",
289301
" num_train_samples=1000)\n",
290302
"for progress_value in gen_progress:\n",
291303
" fp.value = progress_value"
@@ -447,9 +459,9 @@
447459
"name": "python",
448460
"nbconvert_exporter": "python",
449461
"pygments_lexer": "ipython3",
450-
"version": "3.6.5"
462+
"version": "3.8.6"
451463
}
452464
},
453465
"nbformat": 4,
454466
"nbformat_minor": 4
455-
}
467+
}

0 commit comments

Comments
 (0)