WEBINARAnnotate Multi-Turn GenAI Chatbot Responses 🤖

How to do Medical Image Labeling with Label Studio

Tutorials

In the medical field, imaging is a quick way to see what’s going on inside or outside the body. Training models to classify these images, or the structures inside them, is becoming increasingly popular. There are many groups out there that are using modeling to help improve treatment and diagnosis. Take BioticsAI for example – they’re leveraging Label Studio to help them quickly and efficiently leverage their Subject Matter Experts to label their data, and greatly improving treatment and diagnostics for OB/GYNs.

We’ve put together a brief tutorial and template to help you get started with labeling and classifying your own medical images in Label Studio. This allows you to get data that you can be fully confident in, especially given the fact that in the medical field there is no margin for error. Expertise is expensive, so making sure that your SME time is used as efficiently as possible is critical. Take a look below for our tutorial, or find just the template here.

Getting Started

To begin, we downloaded this dataset from Kaggle, which contains breast ultrasound images. The dataset is grouped into 3 classes – normal, benign, and malignant. We’ll use this dataset to show what medical imaging might look like in Label Studio!

Let’s start by creating a new project in Label Studio. Click on the blue “create” button on the upper right hand corner of your screen. We’ll give the project a name, and you could fill out the description with any additional information that you’d like to have on hand. Here, we’ll leave it blank.

Upload Your Data

Uploading the data to this project is easy! We’re just going to drag and drop the images from the Kaggle dataset into our project on the Data Import screen. When you unzip the dataset after you download it from Kaggle, you’ll notice the 3 folders that correspond to the 3 classes. Within each folder, there is a mask and an image for each sample. We’re going to ignore the mask files, and just drag and drop one of the regular images into the data import screen.

Configure Your Medical Image Labeling Project

For this task, we have two goals – draw a bounding box around the tumor, and classify it as benign, malignant, or normal. You can see the labeling config for this project below. Notice that we show the image first, using the “Image” tag, and then have a RectangleLabels object for the bounding box around the tumor. You could easily swap this out with a BrushLabels tag if you wanted to draw a more precise shape around the tumor. Finally, we have the choices tag, which allows us to classify the image as benign, malignant, or normal. Click on the “custom template” button on the bottom of the left hand column, and paste the code below into that screen.

<View>
<Image name="image" value="$image"/>
<RectangleLabels name="label" toName="image">
<Label value="Tumor" background="green"/>
</RectangleLabels>
<Choices name="classification" toName="image">
<Choice value="Benign"/>
<Choice value="Malignant"/>
<Choice value="Normal"/>
</Choices>
</View>

Time to Label!

Now, you’re ready to label! Click into any of the samples, or click the “Label All Tasks” button at the top of the Data Manager. Select the Tumor label below the image, and then draw your bounding box. Then, you can click on whichever label you’d like to apply. Finally, click submit.

And you’re done! Labeling medical images in Label Studio with bounding boxes is very straightforward, and will greatly reduce your time to a model or model evaluation.

Happy labeling!

Related Content

  • Monitor & Evaluate Models in Production with Label Studio

    Understanding how your production model is performing is the most crucial yet most challenging step in the Machine Learning pipeline. This tutorial gives you an easy way to keep a pulse on what is really happening in production.

    Micaela Kaplan

    Data Scientist

  • OpenAI Structured Outputs with Label Studio

    OpenAI’s new Structured Outputs feature allows you to ensure outputs conform to a defined JSON structure. In this blog, we’ll explore how to leverage this feature for various labeling tasks.

    Jimmy Whitaker

    Data Scientist in Residence at HumanSignal

  • Fine-Tuning Llama 3: Enhancing Accuracy in Medical Q&A With LLMs

    In this article, we want to demonstrate a method of curating large datasets to reduce but not remove the cost for curating a high quality medical Q&A dataset in Label Studio and fine-tuning Llama 3 on this data.

    Jimmy Whitaker

    Data Scientist in Residence at HumanSignal