Supervised ISI segmentaion using tensorflow
Project description
Welcome!
This is a repository for segmenting visual cortex areas for sign map. The model was trained on about 2000 isi-experiment data using UNet and TensorFlow.
The sign map will be segmented into different regions and 14 cortex areas could be identified. The output label map will be saved as '.png' file with different values (i.e., 1, 2, 3 ...) corresponding to different visual cortex areas (i.e., VISp, VISam, VISal ...). The class definition is as follows:
| Class | acronym | name |
|---|---|---|
| 1 | VISp | Primary visual area |
| 2 | VISam | Anteromedial visual area |
| 3 | VISal | Anterolateral visual area |
| 4 | VISl | Lateral visual area |
| 5 | VISrl | Rostrolateral visual area |
| 6 | VISpl | Posterolateral visual area |
| 7 | VISpm | posteromedial visual area |
| 8 | VISli | Laterointermediate area |
| 9 | VISpor | Postrhinal area |
| 10 | VISrll | Rostrolateral lateral visual area |
| 11 | VISlla | Laterolateral anterior visual area |
| 12 | VISmma | Mediomedial anterior visual area |
| 13 | VISmmp | Mediomedial posterior visual area |
| 14 | VISm | Medial visual area |
Installation
To use isi-segmentation library, clone this repository and install the requirements.
- First, ensure git is installed:
git --version
If git is not recognized, install git.
- Move into the directory where you want to place the repository folder, and then download it from GitHub:
cd <SOME_FOLDER>
git clone https://github.com/AllenNeuralDynamics/isi_segmentation.git
cd isi_segmentation
pip install -e .
The script should take four inputs:
- hdf5_path (str): the hdf5 file which contains the sign map
- sign_map_path (str): the sign map extracted from .hdf5 file for prediction
- label_map_path (str): the output label map for the given sign map
- model_path (str): path to trained model (to download it, follow here)
Download trained model
mkdir -p model
gdown 'https://drive.google.com/uc?id=1X5C0avuOcjnbZDcS0hG6yujd2bY1hrK1' -O ./model/isi_segmentation_model.h5
Usage
To predict the label map for the sample sign map with the download model, run:
python run_predict.py \
--hdf5_path ./sample_data/661511116_372583_20180207_processed.hdf5\
--sign_map_path ./sample_data/661511116_372583_20180207_sign_map.jpg\
--label_map_path ./sample_data/661511116_372583_20180207_label_map.png\
--model_path ./model/isi_segmentation_model.h5\
--plot_segmentation True
Or you could directly run
sh run.sh
Please make sure you have already downloaded the trained model (follow here) and update model_path.
Model output directory structure
After running prediction, a directory will be created with the following structure
/path/to/outputs/
├── <experiment_name>.png
└── <experiment_name>_visualize.png
-
<experiment_name>.png: prediction from the sign map, the filename is set tolabel_map_path -
<experiment_name>_visualize.png: visualize the sign map and its resulting label map ifplot_segmentationis set totrue.
An example of isi segmentation outputs is ./sample_data/
Visualization
If you would like to visualize the output label map, set plot_segmentation to True.
The plot will be saved as <experiment_name>_visualize.png and stored in the same folder as the label map.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file isi_segmentation-0.1.0.tar.gz.
File metadata
- Download URL: isi_segmentation-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aac4cbc8866ae9896a5deb331a367d63b0b980c2879ca05d4ccdb9b4091051d
|
|
| MD5 |
3f16ff42fb6d3f2cfe6b000a43e37cc3
|
|
| BLAKE2b-256 |
1de986658a80ee69b2c651f5aa942a9c3a2e232f66b8291fa472def67fb27023
|
File details
Details for the file isi_segmentation-0.1.0-py3-none-any.whl.
File metadata
- Download URL: isi_segmentation-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
373805d33867e7453633a7d008c8e3bdec0832939da576f5ad0cdd4b14bc2b79
|
|
| MD5 |
72132cada8dd5ad7f65124f13bc2c708
|
|
| BLAKE2b-256 |
2ce5eda15dd618141f34ec2b751325c6a8f2f94a47df72eee66ee4c73514e120
|