{"id":13800761,"url":"https://github.com/IBM/MAX-Nucleus-Segmenter","last_synced_at":"2025-05-13T09:31:55.200Z","repository":{"id":37601940,"uuid":"176559069","full_name":"IBM/MAX-Nucleus-Segmenter","owner":"IBM","description":"Identify nuclei in a microscopy image and assign each pixel of the image to a particular nucleus","archived":true,"fork":false,"pushed_at":"2022-11-22T07:53:45.000Z","size":3209,"stargazers_count":2,"open_issues_count":4,"forks_count":9,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-07T05:42:15.536Z","etag":null,"topics":["deep-learning","docker-image","machine-learning","machine-learning-models","medical-image-analysis","object-detection","tensorflow"],"latest_commit_sha":null,"homepage":"https://developer.ibm.com/exchanges/models/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-19T16:51:27.000Z","updated_at":"2024-07-03T16:44:38.000Z","dependencies_parsed_at":"2023-01-21T12:49:13.178Z","dependency_job_id":null,"html_url":"https://github.com/IBM/MAX-Nucleus-Segmenter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2FMAX-Nucleus-Segmenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2FMAX-Nucleus-Segmenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2FMAX-Nucleus-Segmenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2FMAX-Nucleus-Segmenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBM","download_url":"https://codeload.github.com/IBM/MAX-Nucleus-Segmenter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913231,"owners_count":21983279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","docker-image","machine-learning","machine-learning-models","medical-image-analysis","object-detection","tensorflow"],"created_at":"2024-08-04T00:01:16.024Z","updated_at":"2025-05-13T09:31:51.869Z","avatar_url":"https://github.com/IBM.png","language":"Jupyter Notebook","funding_links":[],"categories":["Data \u0026 AI"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/IBM/MAX-Nucleus-Segmenter.svg?branch=master)](https://travis-ci.com/IBM/MAX-Nucleus-Segmenter)\n[![API demo](https://img.shields.io/website/http/max-nucleus-segmenter.codait-prod-41208c73af8fca213512856c7a09db52-0000.us-east.containers.appdomain.cloud/swagger.json.svg?label=API%20demo\u0026down_message=down\u0026up_message=up)](http://max-nucleus-segmenter.codait-prod-41208c73af8fca213512856c7a09db52-0000.us-east.containers.appdomain.cloud)\n\n[\u003cimg src=\"docs/deploy-max-to-ibm-cloud-with-kubernetes-button.png\" width=\"400px\"\u003e](http://ibm.biz/max-to-ibm-cloud-tutorial) \n\n# IBM Developer Model Asset Exchange: Nucleus Segmenter\n\nThe Nucleus Segmenter model detects nuclei in a microscopy image and specifies the pixels in the image that \nare assigned to each nucleus. The model is developed based on the architecture of Mask R-CNN using Feature Pyramid \nnetwork (FPN) and a ResNet50 backbone. Given an image (of size 64 x 64, 128 x 128 or 256 x 256), this model outputs the \nsegmentation masks and probabilities for each detected nucleus. The mask is compressed using \n[Run-length encoding (RLE)](https://en.wikipedia.org/wiki/Run-length_encoding).       \n\nThe model is based on the TF implementation of [Mask R-CNN](https://github.com/matterport/Mask_RCNN). \nThe model is trained on the [Broad Bioimage Benchmark Collection (Accession number BBBC038, Version 1)](https://data.broadinstitute.org/bbbc/BBBC038/) \ndataset of annotated biological images. The code in this repository deploys the model as a web service in a Docker container. \nThis repository was developed as part of the [IBM Developer Model Asset Exchange](https://developer.ibm.com/exchanges/models/).\n\n## Model Metadata\n| Domain | Application | Industry  | Framework | Training Data | Input Data Format |\n| ------------- | --------  | -------- | --------- | --------- | -------------- |\n| Vision | Medical Image Segmentation | Health care | TensorFlow | [2018 Data Science Bowl](https://data.broadinstitute.org/bbbc/BBBC038/) | Image(RGB) |\n\n## References\n* _He, K., Gkioxari, G., Dollár, P. and Girshick, R._, 2017, October. [Mask R-CNN](https://arxiv.org/abs/1703.06870). In Computer Vision (ICCV), 2017 IEEE International Conference on (pp. 2980-2988). IEEE.\n* _Ljosa, V., Sokolnicki, K.L. and Carpenter, A.E._, 2012. Annotated high-throughput microscopy image sets for validation. Nature methods, 9(7), pp.637-637.\n* Broad Bioimage Benchmark Collection [[Ljosa et al., Nature Methods, 2012]](https://www.nature.com/articles/nmeth.2083).\n* [Mask R-CNN Github Repository](https://github.com/matterport/Mask_RCNN)\n\n## Licenses\n\n| Component | License | Link  |\n| ------------- | --------  | -------- |\n| This repository | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) | [LICENSE](LICENSE) |\n| Model Weights | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) | [LICENSE](LICENSE) |\n| Model Code (3rd party) | [MIT](https://opensource.org/licenses/MIT) | [LICENSE](https://github.com/matterport/Mask_RCNN/blob/master/LICENSE) |\n| Test samples | Various | [Samples README](samples/README.md) |\n\n## Training dataset\nWe used image set [BBBC038v1](https://data.broadinstitute.org/bbbc/BBBC038/) from 2018 Data Science Bowl®, presented by Booz Allen Hamilton and Kaggle. The dataset is available from the Broad Bioimage Benchmark \nCollection [[Ljosa et al., Nature Methods, 2012](http://dx.doi.org/10.1038/nmeth.2083)]. According to \n[this post](https://www.kaggle.com/c/data-science-bowl-2018/discussion/47864), the dataset is under Creative Commons \nlicense 0 (CC0 public domain). Credits for the images are available [here](https://www.kaggle.com/c/data-science-bowl-2018/discussion/54759).\n\n## Pre-requisites:\n\n* `docker`: The [Docker](https://www.docker.com/) command-line interface. Follow the [installation instructions](https://docs.docker.com/install/) for your system.\n* The minimum recommended resources for this model is 2GB Memory and 1 CPU.\n\n# Steps\n\n1. [Deploy from Quay](#deploy-from-quay)\n2. [Deploy on Kubernetes](#deploy-on-kubernetes)\n3. [Run Locally](#run-locally)\n\n## Deploy from Quay\n\nTo run the docker image, which automatically starts the model serving API, run:\n\n```\n$ docker run -it -p 5000:5000 quay.io/codait/max-nucleus-segmenter\n```\n\nThis will pull a pre-built image from the Quay.io container registry  (or use an existing image if already cached locally) and run it.\nIf you'd rather checkout and build the model locally you can follow the [run locally](#run-locally) steps below.\n\n## Deploy on Kubernetes\n\nYou can also deploy the model on Kubernetes using the latest docker image on Quay.\n\nOn your Kubernetes cluster, run the following commands:\n\n```\n$ kubectl apply -f https://raw.githubusercontent.com/IBM/MAX-Nucleus-Segmenter/master/max-nucleus-segmenter.yaml\n```\n\nThe model will be available internally at port `5000`, but can also be accessed externally through the `NodePort`.\n\n## Run Locally\n\n1. [Build the Model](#1-build-the-model)\n2. [Deploy the Model](#2-deploy-the-model)\n3. [Use the Model](#3-use-the-model)\n4. [Run the Notebook](#4-run-the-notebook)\n5. [Development](#5-development)\n6. [Cleanup](#6-cleanup)\n\n\n### 1. Build the Model\n\nClone this repository locally. In a terminal, run the following command:\n\n```\n$ git clone https://github.com/IBM/MAX-Nucleus-Segmenter\n```\n\nChange directory into the repository base folder:\n\n```\n$ cd MAX-Nucleus-Segmenter\n```\n\nTo build the docker image locally, run:\n\n```\n$ docker build -t max-nucleus-segmenter .\n```\n\nAll required model assets will be downloaded during the build process. _Note_ that currently this docker image is CPU only (we will add support for GPU images later).\n\n\n### 2. Deploy the Model\n\nTo run the docker image, which automatically starts the model serving API, run:\n\n```\n$ docker run -it -p 5000:5000 max-nucleus-segmenter\n```\n\n### 3. Use the Model\n\nThe API server automatically generates an interactive Swagger documentation page. Go to `http://localhost:5000` to load \nit. From there you can explore the API and also create test requests. Use the `model/predict` endpoint to load a test \nimage (you can use one of the test images from the `assets` folder) and get predicted probabilities and segmentation \nmasks for the image from the API.\n\n![Swagger UI Screenshot](docs/swagger-screenshot.png)\n\nYou can also test it on the command line, for example:\n\n```\n$ curl -F \"image=@samples/example.png\" -XPOST http://localhost:5000/model/predict\n```\n\nYou should see a JSON response like that below:\n\n```\n{\n  \"status\": \"ok\",\n  \"predictions\": [\n    {\n      \"mask\": [\n        3507,\n        1,\n        3571,\n        5,\n        3635,\n        6,\n        3700,\n        5,\n        3766,\n        4,\n        3831,\n        2\n      ],\n      \"probability\": 0.9837305545806885\n    },\n    \n    ...\n    \n    {\n      \"mask\": [\n        1079,\n        1,\n        1144,\n        1,\n        1207,\n        3,\n        1271,\n        4,\n        1336,\n        3,\n        1401,\n        3,\n        1465,\n        3,\n        1530,\n        3,\n        1595,\n        2\n      ],\n      \"probability\": 0.9726951122283936\n    },\n```\n\n### 4. Run the Notebook\n\nOnce the model server is running, you can see how to use it by walking through [the demo notebook](demo.ipynb). _Note_ the demo requires `jupyter`, `numpy`, `matplotlib`, `scikit-image`, `json`, and `requests`.\n\nRun the following command from the model repo base folder, in a new terminal window (leaving the model server running in the other terminal window):\n\n```\n$ jupyter notebook\n```\n\nThis will start the notebook server. You can open the simple demo notebook by clicking on `demo.ipynb`.\n\n### 5. Development\n\nTo run the Flask API app in debug mode, edit `config.py` to set `DEBUG = True` under the application settings. You will then need to rebuild the docker image (see [step 1](#1-build-the-model)).\n\n### 6. Cleanup\n\nTo stop the Docker container, type `CTRL` + `C` in your terminal.\n\n## Resources and Contributions\n   \nIf you are interested in contributing to the Model Asset Exchange project or have any queries, please follow the instructions [here](https://github.com/CODAIT/max-central-repo).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIBM%2FMAX-Nucleus-Segmenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIBM%2FMAX-Nucleus-Segmenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIBM%2FMAX-Nucleus-Segmenter/lists"}