NGC Catalog
CLASSIC
Welcome Guest
Containers
Clara Deploy AI Breast [Deprecated]

Clara Deploy AI Breast [Deprecated]

For copy image paths and more information, please view on a desktop device.
Logo for Clara Deploy AI Breast [Deprecated]
Description
Clara Deploy AI Breast
Publisher
NVIDIA
Latest Tag
0.8.1-2108.1
Modified
April 4, 2023
Compressed Size
216.12 MB
Multinode Support
No
Multi-Arch Support
No
0.8.1-2108.1 (Latest) Security Scan Results

Linux / amd64

Sorry, your browser does not support inline SVG.

Clara Deploy SDK is being consolidated into Clara Holoscan SDK

More info https://catalog.ngc.nvidia.com/orgs/nvidia/teams/clara/collections/claradeploy

Breast Microscopy Classification Operator

This asset requires the Clara Deploy SDK. Follow the instructions on the Clara Ansible page to install the Clara Deploy SDK.

Overview

This operator performs classification of microscopy images for detecting Invasive Ductal Carcinoma (IDC). It assigns a label of either "cancerous" or "not cancerous" to each image. It is deployed as a containerized AI inference application for use as one of the operators in the Clara Deploy pipelines.

Inputs

This operator, in the form of a Docker container, expects an input folder (/input by default), which can be mapped to the host volume when the Docker container is started. Expected in this folder is a set of PNG images representing the microscope slides. Irrespective of the original input image size, at inference time each image is resized to 48x48.

Outputs

After an image is classified, the operator saves the output as a new image with the classification label burnt-in on top of the image.

This application saves output images to an output folder (/output by default). If the class category of an image is "cancerous", the operator burns in the letter "T" to the upper left corner of the output image; otherwise, the letter "F" is burnt in.

The name of each output file has the pattern output-.png.

AI Model

The dataset used in training this model is available from kaggle.com. The original dataset consists of 162 whole-mount slide images of Breast Cancer (BCa) specimens scanned at 40x. From that, 277,524 patches of size 50x50 were extracted (198,738 IDC negative and 78,786 IDC positive). The resultant model is named classification_breast_v1.

The input tensor is of shape 48x48x3, and the output is of shape 2x1.

NVIDIA TensorRT Inference Server (TRTIS)

This application performs inference on the NVIDIA TensorRT Inference Server (TRTIS), which provides a cloud inferencing solution optimized for NVIDIA GPUs. The server provides an inference service via an HTTP or gRPC endpoint, allowing remote clients to request inferencing for any model managed by the server.

Directory Structure

The directories in the container are shown below:

app_breast/
├── Dockerfile
├── main.py
├── Pipfile
└── requirements.txt

Executing the Operator Locally

If you want to see the internals of the container and manually run the application, follow these steps:

  1. Start the container in interactive mode. See the next section on how to run the container, and replace the docker run command with the following:
docker run --entrypoint /bin/bash
  1. Once in the Docker terminal, ensure the current directory is /app.
  2. Execute the following command:
python ./app_base_inference/main.py
  1. When finished, type exit.

Executing the Operator in Docker

Prerequisites

  1. Ensure the Docker image of TRTIS has been imported into the local Docker repository with the following command:
docker images
  1. Look for the image name TRTIS and the correct tag for the release (e.g. 20.07-v1-py3).
  2. Download both the input dataset and the trained model from the MODEL SCRIPTS section for this container on NGC, following the steps in the Setup section.

Step 1

Switch to your working directory (e.g. test_breast).

Step 2

Create, if they do not exist, the following directories under your working directory:

  • input containing the input image file
  • output for the segmentation output
  • publish for publishing data for the Render Server
  • logs for the log files
  • models for the model repository. Copy the contents of the classification_breast_v1 folder into this model repository folder.

Step 3

In your working directory, create a shell script (e.g. run_breast.sh or another name if you prefer), copy the sample content below, and save it.

#!/bin/bash

# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.

# Define the name of the app (aka operator), assumed the same as the project folder name
APP_NAME="app_breast"

# Define the TenseorRT Inference Server Docker image, which will be used for testing
# Use either local repo or NVIDIA repo
TRTIS_IMAGE="nvcr.io/nvidia/tritonserver:20.07-v1-py3"

# Launch the container with the following environment variables
# to provide runtime information.
export NVIDIA_CLARA_TRTISURI="localhost:8000"

# Define the model name for use when launching TRTIS with only the specific model
MODEL_NAME="classification_breast_v1"

# Create a Docker network so that containers can communicate on this network
NETWORK_NAME="container-demo"

# Create network
docker network create ${NETWORK_NAME}

# Run TRTIS(name: trtis), maping ./models/${MODEL_NAME} to /models/${MODEL_NAME}
# (localhost:8000 will be used)
nvidia-docker run --name trtis --network ${NETWORK_NAME} -d --rm --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 \
 -p 8000:8000 \
 -v $(pwd)/models/${MODEL_NAME}:/models/${MODEL_NAME} ${TRTIS_IMAGE} \
 tritonserver --model-repository=/models

# Wait until TRTIS is ready
trtis_local_uri=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' trtis)
echo -n "Wait until TRTIS ${trtis_local_uri} is ready..."
while [ $(curl -s ${trtis_local_uri}:8000/api/status | grep -c SERVER_READY) -eq 0 ]; do
 sleep 1
 echo -n "."
done
echo "done"

export NVIDIA_CLARA_TRTISURI="${trtis_local_uri}:8000"

# Run ${APP_NAME} container.
# Launch the app container with the following environment variables internally,
# to provide input/output path information.
docker run --name ${APP_NAME} --network ${NETWORK_NAME} -it --rm \
 -v $(pwd)/input:/input \
 -v $(pwd)/output:/output \
 -v $(pwd)/logs:/logs \
 -v $(pwd)/publish:/publish \
 -e NVIDIA_CLARA_TRTISURI \
 -e NVIDIA_CLARA_NOSYNCLOCK=TRUE \
 ${APP_NAME}

echo "${APP_NAME} is done."

# Stop TRTIS container
echo "Stopping TRTIS"
docker stop trtis > /dev/null

# Remove network
docker network remove ${NETWORK_NAME} > /dev/null

Step 4

Execute the script as shown below and wait for the application container to finish:

`./run_breast.sh`

Step 5

Check for classification results in the output directory. Ensure that the number of output PNG images is the same as the number of input images.

Step 6

To visualize the classification results, use any PNG image viewer (such as GIMP).

License

An End User License Agreement is included with the product. By pulling and using the Clara Deploy asset on NGC, you accept the terms and conditions of these licenses.

Suggested Reading

Release Notes, the Getting Started Guide, and the SDK itself are available at the NVIDIA Developer forum.

For answers to any questions you may have about this release, visit the NVIDIA Devtalk forum.