Skip to main content

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, either install directly with pip or clone this repository and install the requirements listed in setup.py.

Method 1. pip install

pip install isi-segmentation

Method 2: conda from source

  1. First, ensure git is installed:
git --version

If git is not recognized, install git.

  1. 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 (PathLike): path to the hdf5 file which contains the sign map
  • sign_map_path (PathLike): path to the sign map extracted from .hdf5 file for prediction
  • label_map_path (PathLike): path to save the output label map
  • model_path (PathLike): 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

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 to label_map_path
  • <experiment_name>_visualize.png: visualize the sign map and its resulting label map

An example of isi segmentation outputs is ./sample_data/

Visualization

To visualize the output label map, the plot will be saved as <experiment_name>_visualize.png and stored in the same folder as the label map.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isi_segmentation-0.1.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isi_segmentation-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file isi_segmentation-0.1.1.tar.gz.

File metadata

  • Download URL: isi_segmentation-0.1.1.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

Hashes for isi_segmentation-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0e510071ca9e92119081fa01655e0022181d6f598d96cd29ef423e252ef0bbf3
MD5 74ce0e76b9e1f558252f8905630a79f1
BLAKE2b-256 6711fd848f31b2c34d84f2c3e5b16d57b2b00a0eee84a524aa43bad50d05c2a6

See more details on using hashes here.

File details

Details for the file isi_segmentation-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for isi_segmentation-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 efb03e5da08e023ccf4f45c42b120295877b543750fa8758b46523de78643f76
MD5 f850569571ce70cb2859e17f542cc993
BLAKE2b-256 0cc502a504bce1f9c1cdf05ecd6d00f8c6b031ef030aab456c28483209831539

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page