BLIP2 Processor
Unstable API
0.8.0
@project-lakechain/blip2-image-processor
The BLIP2 image processor makes it possible to generate captions for images within a Lakechain pipeline. It deploys an auto-scaled cluster of GPU-enabled containers to process images using the BLIP2 image model, such that all the processing remains on customers AWS environment.
đˇ Captioning
To use this middleware, you import it in your CDK stack and specify a VPC in which the cluster will be deployed.
đ Note that you will need to specify a data source that the BLIP2 processor will use as an input, such as the S3 trigger.
Auto-Scaling
The cluster of containers deployed by this middleware will auto-scale based on the number of images that need to be processed. The cluster scales up to a maximum of 5 instances by default, and scales down to zero when there are no images to process.
âšī¸ You can configure the maximum amount of instances that the cluster can auto-scale to by using the
withMaxInstances
method.
đ Output
The BLIP2 image processor does not modify or alter source images in any way. It instead enriches the metadata of their document by setting the description
field to the output of the captioning result. It will also specify the dimensions of the image.
đ Click to expand example
âšī¸ Below is an example of a CloudEvent emitted by the BLIP2 processor.
đī¸ Architecture
The BLIP2 image processor requires GPU-enabled instances (g5.2xlarge) to run the BLIP2 image model. To orchestrate deployments, it deploys an ECS auto-scaled cluster of containers that consume documents from the middleware input queue. The cluster is deployed in the private subnet of the given VPC, and caches the model on an EFS storage to optimize cold-starts.
âšī¸ The average cold-start for the BLIP2 image processor is around 3 minutes when no instances are running.
đˇī¸ Properties
Supported Inputs
Mime Type | Description |
---|---|
image/bmp | Bitmap image |
image/gif | GIF image |
image/jpeg | JPEG image |
image/png | PNG image |
image/tiff | TIFF image |
image/webp | WebP image |
image/x-pcx | PCX image |
Supported Outputs
This middleware supports as outputs the same types as the supported inputs.
Supported Compute Types
Type | Description |
---|---|
GPU | This middleware requires GPU instances to run the BLIP2 image model. |
đ Examples
- Image Captioning Pipeline - Builds a pipeline demonstrating image captioning using the BLIP2 model.