11.12. Chest X-ray Classification Pipeline

The Chest X-ray Classification pipeline is one of the reference pipelines provided with Clara Deploy SDK. A pre-trained model for classification of diseases from a chest x-ray 16-bit PNG image is used in the pipeline. This pipeline depends on the Clara Deploy CLI to send a PNG image and trigger a job.

Once the pipeline is started, the AI model classifies an input image and saves the output as a new image with the classification label with probability burnt-in on top of the image. The model supports 15 categories (‘Nodule’, ‘Mass’, ‘Distortion of Pulmonary Architecture’, ‘Pleural Based Mass’, ‘Granuloma’, ‘Fluid in Pleural Space’, ‘Right Hilar Abnormality’, ‘Left Hilar Abnormality’, ‘Major Atelectasis’, ‘Infiltrate’, ‘Scarring’, ‘Pleural Fibrosis’, ‘Bone/Soft Tissue Lesion’, ‘Cardiac Abnormality’, and ‘COPD’). The class categories with the probability are burnt to the upper left corner of the output image for top 3 categories. If the probability is high enough (0.5), the category is written out with red color, or yellow color is used. The name of each output file has the pattern output-<original file name>.png. It also outputs a CSV file (output-<original file name>.csv) including the input file path and top 3 classifications with probability (e.g., Granuloma:0.68,Nodule:0.22,COPD:0.02)

The output image can be downloaded by Clara CLI and viewed by any PNG image viewer such as GIMP.

11.12.1. Pipeline Definition

The Chest X-ray Classification pipeline is defined in the Clara Deploy pipeline definition language. This pipeline utilizes built-in reference containers to construct the following operator:

  • The ai-app-chestxray operator performs AI inference against the NVIDIA TensorRT Inference server to generate an image for disease classifications from a chest x-ray image.

The following is the details of pipeline definition, with comments describing each operator’s functions as well as input and output.

api-version: 0.4.0
name: chestxray-pipeline
operators:
  - name: ai-app-chestxray
    description: Classifying Chest X-ray Images
    container:
      image: clara/ai-chestxray
      tag: latest
    requests:
      gpu: 1
    input:
    - path: /input
    output:
    - path: /output
    services:
    - name: trtis
      container:
        image: nvcr.io/nvidia/tensorrtserver
        tag: 19.08-py3
        command: ["trtserver", "--model-store=$(NVIDIA_CLARA_SERVICE_DATA_PATH)/models"]
      connections:
        http:
        - name: NVIDIA_CLARA_TRTISURI
          port: 8000

11.12.2. Executing the Pipeline

Please refer to the Run Reference Pipelines using Local Input Files in the How to run a Reference Pipeline section to learn how to register a pipeline and execute the pipeline using local input files.