Skip to main content

NeurIPS-CellSeg-baseline

Project description

NeurIPS-CellSeg

A naive baseline and submission demo for the microscopy image segmentation challenge in NeurIPS 2022

Preprocessing

Download training data to the data folder

Run python pre_process_3class.py

Training

cd baseline

Run python model_training_3class.py --data_path 'path to training data' --batch_size 8

Inference

Run

python predict.py -i input_path -o output_path

Your prediction file should have at least the two arguments: input_path and output_path. The two arguments are important to establish connections between local folders and docker folders.

Build Docker

We recommend this great tutorial: https://nbviewer.org/github/ericspod/ContainersForCollaboration/blob/master/ContainersForCollaboration.ipynb

1) Preparation

The docker is built on MONAI

docker pull projectmonai/monai

Prepare Dockerfile

FROM projectmonai/monai:latest

WORKDIR /workspace
COPY ./   /workspace

Put the inference command in the predict.sh

# !/bin/bash -e
python predict.py -i "/workspace/inputs/"  -o "/workspace/outputs/"

The input_path and output_path augments should specify the corresponding docker workspace folders rather than local folders, because we will map the local folders to the docker workspace folders when running the docker container.

2) Build Docker and make sanity test

The submitted docker will be evaluated by the following command:

docker container run --gpus "device=0" --name teamname --rm -v $PWD/CellSeg_Test/:/workspace/inputs/ -v $PWD/teamname_outputs/:/workspace/outputs/ teamname:latest /bin/bash -c "sh predict.sh"
  • --name: container name during running

  • --rm: remove the container after running

  • -v $PWD/CellSeg_Test/:/workspace/inputs/: map local image data folder to Docker workspace/inputs folder.

  • -v $PWD/teamname_outputs/:/workspace/outputs/ : map Docker workspace/outputs folder to local folder. The segmentation results will be in $PWD/teamname_outputs

  • teamname:latest: docker image name (should be teamname) and its version tag. The version tag should be latest. Please do not use v0, v1... as the version tag

  • /bin/bash -c "sh predict.sh": start the prediction command. It will load testing images from workspace/inputs and save the segmentation results to workspace/outputs

Assuming the team name is baseline, the Docker build command is

docker build -t baseline .

Test the docker to make sure it works. There should be segmentation results in the baseline_outputs folder.

docker container run --gpus "device=0" --name baseline --rm -v $PWD/CellSeg_Test/:/workspace/inputs/ -v $PWD/baseline_outputs/:/workspace/outputs/ baseline:latest /bin/bash -c "sh predict.sh"

During the inference, please monitor the GPU memory consumption using watch nvidia-smi. The GPU memory consumption should be less than 1500MB. Otherwise, it will run into an OOM error on the official evaluation server. We impose this hard constraint on GPU memory consumption to ensure ease of use, because biologists may not have powerful GPUs in practice. Thus, the model should be low-resource.

3) Save Docker

docker save baseline | gzip -c > baseline.tar.gz

Upload the docker to Google drive or Baidu net disk and send the download link to NeurIPS.CellSeg@gmail.com.

Please do not upload the Docker to dockerhub!

Limitations and potential improvements

The naive baseline's primary aim is to give participants out-of-the-box scripts that can generate successful submisions. Thus, there are many ways to surpass this baseline:

  • New cell representation methods. In the baseline, we separated touching cells by simply removing their boundaries. More advanced cell representation could be used to address this issue, such as stardist, cellpose, omnipose, deepcell, and so on.
  • New architectures
  • More data augmentations and the use of additional public datasets or the set of unlabeled data provided.
  • Well-designed training protocols
  • Postprocessing

Nevertheless, please always keep in mind that many end users do not have powerful computation resources. It's important to consider the trade-off between resource consumption and accuracy.

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

cellseg_baseline-0.0.2.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

cellseg_baseline-0.0.2-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file cellseg_baseline-0.0.2.tar.gz.

File metadata

  • Download URL: cellseg_baseline-0.0.2.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.3

File hashes

Hashes for cellseg_baseline-0.0.2.tar.gz
Algorithm Hash digest
SHA256 293ae6b49929a9a8218e057cb182f260e0a72c346682fd3cb042ecb32b2bb7de
MD5 2dad52791db3b8729121c23173ffe021
BLAKE2b-256 d4180733b4f02da4930d6caff7f5e576add880bea64fe88ddbd74dbd78c727ef

See more details on using hashes here.

File details

Details for the file cellseg_baseline-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for cellseg_baseline-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e67147614e6a9409cbb5d0aae79b3cd79944e98836c67b9fcaaf8f2b22a78a1d
MD5 86dc1bb16056e5d20fe16e0fbf2d34b8
BLAKE2b-256 f1332b05bc22ab6a696c20c35826b912e986e9def2cea699c30d3cce87948675

See more details on using hashes here.

Supported by

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