AWS for Industries
Vertex Pharmaceuticals: Accelerating image segmentation for drug discovery imaging using serverless technologies on AWS
This post was co-authored with Roberto Iturralde, Sr. Director of Software Engineering, and Karthik Ghantasala, Director of Cloud Architecture at Vertex Pharmaceuticals.
Drug discovery is a complex process that involves the identification and optimization of potential drug candidates that can interact with specific biological targets to produce a desired therapeutic effect. One challenge in this process is the efficient and accurate analysis of large amounts of data from experiments, including microscope images, showing how a drug candidate interacted with biological material such as cells. Historically, scientists painstakingly measured changes in areas of interest in microscope images to calculate the impact of different experimental conditions.
Machine learning (ML) has become an increasingly important tool in the drug discovery process. Techniques such as image segmentation help researchers analyze images more quickly and efficiently by first training a ML model and then applying it across the images to identify and measure the areas of interest at scale.
In this blog post, we will show how Vertex Pharmaceuticals designed a highly performant and cost optimized image segmentation system to analyze microscope imagery using AWS. Vertex is a global biotechnology company that invests in scientific innovation to create transformative medicines for people with serious diseases.
Overview
Analyzing imaging assays is a resource intensive process that involves complex distributed systems to process images and compute results. Vertex Pharmaceuticals’ legacy system could not dynamically scale to meet the increased demand and the underlying infrastructure resources were shared amongst Vertex’s scientific groups. Under heavy load, tens-of-thousands of images would be queued for processing resulting in jobs taking hours to complete, there by slowing down the research work of the scientists. By rearchitecting to use AWS serverless technologies, Vertex Pharmaceuticals was able to complete segmentation jobs 11 times faster with a 90% reduction in cost and better overall system reliability.
Using AWS, Vertex Pharmaceuticals built a system that leveraged custom image segmentation ML models to accelerate image analysis across multiple disease programs where:
1. An upstream system would capture thousands of images from microscopes and upload them to an image repository.
2. This image repository would allow scientists to manually segment areas of interest in a subset of images.
3. The system would then use the manually segmented images to fine tune an existing proprietary ML model.
4. The fine-tuned ML model would then segment the remainder of the images in the set, allowing scientists to further explore the results.
Architecture
Vertex Pharmaceuticals modernized their architecture using AWS Step functions Distributed Map — a serverless solution for large scale parallel processing. This drastically reduced the processing time while also improving costs. Distributed Map can iterate over millions of objects in various formats from S3 source, which provided Vertex with a reliable workflow orchestration system. Coupled with AWS Step Function’s ability to easily integrate with other AWS services such as Amazon API Gateway, AWS Lambda, and Amazon S3, Vertex Pharmaceuticals was able to build a highly scalable, cost-effective workload orchestration API using minimal infrastructure. AWS Step Functions’ native integration with Amazon CloudWatch provided detailed visibility into logs and performance metrics.
When a batch job with multiple images needs to be analyzed:
- A scientist submits a batch segmentation request via a web application, which calls Amazon API Gateway with the job details in the payload.
- Amazon API Gateway initiates an AWS Step Functions State Machine execution and passes the payload as input to the execution.
- Within the Step Functions execution, an AWS Lambda function looks up the set of images to be processed.
- Next, a Step Functions Distributed Map invokes an AWS Lambda function for each image and applies a pre-trained ML segmentation model. The ML models are stored in an Amazon ElastiCache for Redis cache to improve performance. The AWS Step Functions Distributed Map offers batching and concurrency controls that are used to tune overall job throughput.
- Upon completion of the parallel processing, the AWS Step Functions Distributed Map aggregates the output from the Lambda invocations into a single result file and writes it to Amazon S3.
- Finally, an AWS Lambda function writes the aggregated segmentation results to a relational database to be displayed to the scientists via the web application and consumed by downstream systems.
Conclusion
The new architecture speeds up processing and can process more than two times the number of images, resulting in jobs completing up to 11 times faster than the old system. By leveraging technologies fully managed by AWS, the infrastructure has an expected up-time of 99.9%. The chosen technologies natively scale compute resources to match the demand, resulting in a cost reduction of 90% compared to the previous system and incurring no costs when the system is idle.
To learn more about how AWS and APN partner solutions are empowering life sciences research and discovery, visit aws.amazon.com/health/biopharma/solutions/.