Skip to content

Commit c8de4e9

Browse files
committed
replace 11-5 with 7-13
1 parent 2eb12da commit c8de4e9

File tree

9 files changed

+15
-9
lines changed

9 files changed

+15
-9
lines changed

ves_seg/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,25 @@ To continue retraining from a checkpoint, use:
2121

2222
Inference tools are available in `tools/process.py`. To do inference, in a Python shell or file, run:
2323

24-
`> do_inference(<im_path>, <pred_path>, [<base_config.yaml>, <bcd_config.yaml>], <checkpoint_path>)`
24+
`do_inference(<im_path>, <pred_path>, [<base_config.yaml>, <bcd_config.yaml>], <checkpoint_path>)`
2525

2626
To also get adapted rand, precison, and recall metrics, run:
2727

28-
`> infer_and_stats([<im_path1>, ...], [<pred_path1>, ...], [<mask_path1, ...>], [<base_config.yaml>, <bcd_config.yaml>], <checkpoint_path>),
28+
`infer_and_stats([<im_path1>, ...], [<pred_path1>, ...], [<mask_path1, ...>], [<base_config.yaml>, <bcd_config.yaml>], <checkpoint_path>),
2929
`
3030

3131
Our final model checkpoint is provided at `outputs/checkpoint_1000000.pth.tar`.
3232

3333
## Visualiztion
3434

35-
Visualing predictions is done with neuroglancer. To load a volume and its segmentation, modify the file `scripts/ng.py`, then run `python -i scripts/ng.py`. A link to view neuroglancer will open. If running on a remote cluster, please note that port forwarding will be necessary to view on your machine. The `screnshot()` function can be used to take high-resolution screenshots of the neuroglancer representation.
35+
Visualing predictions is done with neuroglancer. To load a volume and its segmentation, modify the file `scripts/ng.py`, then run `python -i scripts/ng.py`. A link to view neuroglancer will open. If running on a remote cluster, please note that port forwarding will be necessary to view on your machine. The `screenshot()` function can be used to take high-resolution screenshots of the neuroglancer representation.
3636

3737
Further documentation for both functions is contained in `tools/process.py`
3838

3939
## Sample
4040

41-
A small sample is prepared in the `sample` directory. `11-5` shows a small inter-neuron region with an assortment of large vesicles. Neuroglancer scripts that display the CLAHE-enhanced images, neuron mask, ground truth, and predictions with the final model checkpoints are prepared in `sample/11-5_ng.py`.
41+
A small sample is prepared in the `sample` directory. `7-13` shows a small soma region with large vesicles. To generate large vesicle predictions in the regionm, run the following command from within the root directory:
42+
43+
`python tools/process.py`
44+
45+
After inference, a neuroglancer script that display the CLAHE-enhanced images, neuron mask, ground truth, and predictions with the final model checkpoints can be viewed by running `sample/ng.py` from within the root directory.

ves_seg/sample/11-5_mask.h5

-662 KB
Binary file not shown.

ves_seg/sample/11-5_pred.h5

-533 KB
Binary file not shown.

ves_seg/sample/11-5_ves.h5

-253 KB
Binary file not shown.
Binary file not shown.

ves_seg/sample/7-13_mask.h5

310 KB
Binary file not shown.

ves_seg/sample/7-13_ves.h5

196 KB
Binary file not shown.

ves_seg/sample/ng.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
from skimage import morphology
99

1010
import neuroglancer
11-
ip = 'localhost' # f'{hostname}.cm.cluster'
12-
port = 9098 # change to an unused port number
13-
neuroglancer.set_server_bind_address(bind_address=ip,bind_port=port)
11+
port = 9098
12+
neuroglancer.set_server_bind_address(bind_address='localhost',bind_port=port)
1413
viewer=neuroglancer.Viewer()
1514

1615
def screenshot(path='temp.png', save=True, show=True, size=None):
@@ -24,8 +23,8 @@ def screenshot(path='temp.png', save=True, show=True, size=None):
2423
plt.imshow(ss)
2524
plt.show()
2625

27-
data_dir = '.'
28-
vol_name = '11-5'
26+
data_dir = 'sample'
27+
vol_name = '7-13'
2928

3029
clahe = readvol(os.path.join(data_dir, vol_name+"_clahe.h5"))
3130
mask = readvol(os.path.join(data_dir, vol_name+"_mask.h5"))

ves_seg/tools/process.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,6 @@ def infer_and_stats(
281281

282282
# return the list of metrics
283283
return metric_list
284+
285+
if __name__ == '__main__':
286+
do_inference('sample/7-13_clahe.h5', 'sample/7-13_pred.h5', ['configs/03_base.yaml', 'configs/bcd_config.yaml'], 'outputs/checkpoint_1000000.pth.tar', show=True)

0 commit comments

Comments
 (0)