The AI Adapter facilitates the connection of pre-built and custom AI models with the Digital Slide Archive. This integration empowers users to leverage AI models for the analysis of digital histopathology data and for the purpose of prototyping and testing AI models within the DSA environment. The AI Adapter offers four key features:
Access to Pre-built AI Models for Analysis: Directly access AI models such as Nuclick and Segment anything (Facebook) from the platform, enabling seamless analysis of histopathology images.
Connect Custom AI Inference Models: Seamlessly connect custom AI inference models to the DSA platform.
Configure AI Model Parameters: Customize AI model parameters by modifying this repository aiInferenceModel
.
Visualize AI Model Output: Easily visualize the results generated by AI models within the DSA interface and save them to specific locations.
Created by Subin Erattakulangara, David Manthey
-
Eliminates the Need for Extension Development
-
Seamlessly Connect Custom AI Models via FastAPI Deployment
-
Expanded Data Output Capabilities:
- Image Tiles with Optional Pre-processing Using HistomicsTK Modules in the UI
- Nuclei Maps
- Segmentations
-
Built-in Functionality for Streamlined Processing:
- Single Nuclei Analysis (via onClick Method)
- Region of Interest Evaluation
- Whole Slide Image Handling
-
Versatile Output Formats:
- Easily Save Results as Annotations or CSV Files
Help users to deploy and run the AI applications with Digital slide archive
Here are the cleaned-up instructions for downloading and deploying the AI adapter:
- Choose a folder of your preference.
- Open a terminal within the selected folder.
- Execute the following steps in the terminal at the root:
git init
git pull https://github.com/DigitalSlideArchive/dsa-run-custom-ai-models.git
docker build --force-rm -t dsarchive/runcustomaimodels .
check if the docker image is present using the command
docker images
You should be able to locate the Docker image named dsarchive/runcustomaimodels
in order to proceed. Once you've successfully confirmed its presence, proceed to add the AI adapter to the DSA platform by following the provided tutorial.
Once you receive a success message from the platform confirming that the Docker has been successfully added, you can validate this by navigating to the Digital Slide Archive platform and performing the following steps.
Deploys AI models seperately as a service. Users can add or remove AI models from this codebase. Following are the steps needed to setup the API
To run the AI model using Docker, follow these steps:
-
Navigate to the
aiInferenceModel
directory:cd aiInferenceModel
-
Build the Docker image:
docker build -t dsarchive/aimodels .
-
Run the Docker container:
docker run -t -d -p 8000:80 --name aimodels dsarchive/aimodels
-
Verify the status of the Docker image:
docker images
-
To ensure that the API is running, open the following URL in your web browser:
http://localhost:8000/docs
If you can see the API documentation, it means the AI models are successfully running in your environment.
Alternatively, you can run the AI models without Docker by creating a Conda environment and installing all the requirements:
-
Create a Conda environment:
conda create -n dsaAiModels python=3.11
-
Activate the Conda environment:
conda activate dsaAiModels
-
Navigate to the
aiInferenceModel
folder:cd aiInferenceModel
-
Install all the requirements:
pip install -r requirements.txt
-
Run the
main.py
file:python main.py
This will start the FAST API interface for the AI applications.
Until today, we have successfully integrated five distinct AI models designed for the comprehensive analysis of histopathology images, encompassing both segmentation and classification tasks. Below, you will find detailed tutorials for utilizing each of these individual models.