Filters out image data whose matching score with the corresponding text is too low, helping ensure training data quality for image generation models.
Supported compute resources
How it works
The component uses the blip-itm-base-coco model to calculate the matching score between an image description and the descriptive text in the training data (the content after the <__dj__video> field in the sample training data file). Images with scores below the threshold are filtered out. Training data file format:
The input data must be a JSON Lines (.jsonl) file. In the text field, "<__dj__image>" and "<|__dj__eoc|>" mark the beginning and end of the image description.
{"images":["oss://bucket_name.oss-cn-hangzhou.aliyuncs.com/image/data/image1.jpg"],"text":"<__dj__image> optional image caption <|__dj__eoc|>"}
{"images":["oss://bucket_name.oss-cn-hangzhou.aliyuncs.com/image/data/image2.jpg"],"text":"<__dj__image><|__dj__eoc|>"}
{"images":["oss://bucket_name.oss-cn-hangzhou.aliyuncs.com/image/data/image3.jpg"],"text":"<__dj__image> a person pointing to a piece of wood on the ground\n"}
{"images":["oss://bucket_name.oss-cn-hangzhou.aliyuncs.com/image/data/image4.jpg", "oss://bucket_name.oss-cn-hangzhou.aliyuncs.com/image/data/image5.jpg"],"xxx":"yyy"}
-
images: The OSS path to the image. -
text: The descriptive text for the image.
Inputs and outputs
Input port
-
Use the Read OSS Data component to read the training data file from its OSS path.
-
Configure the Image Data OSS Path parameter to select the training data file.
For more information about the training data file, see How it works.
Output port
Outputs the filtered results. For details, see the parameter table below.
Configure the component
Add the LVM-Filter by Image-Text Matching Score (DLC) component to your pipeline in Designer and configure its parameters on the right-side panel.
|
Parameter type |
Parameter |
Required |
Description |
Default value |
|
|
Field settings |
Image data OSS path |
No |
The training data file. For the required format, see How it works. |
None |
|
|
OSS Directory for Saving OutputData |
No |
The OSS directory for output files. The results include the following files:
|
None |
||
|
Output file name |
No |
The name of the filtered results file. |
result.jsonl |
||
|
Parameter settings |
Minimum text-image matching score |
Yes |
The minimum score for an image-text pair to be retained. Pairs scoring below this value are discarded. |
0.1 |
|
|
Maximum text-image matching score |
Yes |
The maximum score for an image-text pair to be retained. Pairs scoring above this value are discarded. Typically set to 1. |
1 |
||
|
Execution tuning |
Number of processes |
No |
Set the number of processes. |
4 |
|
|
Single/multi nodes |
No |
Single-node or multi-node mode. Default value: single-node. Multi-node mode supports only the Ray framework. |
single-node |
||
|
Select resource group |
No |
Select a public resource group or a resource quota (if distributed mode is used, you must set resource parameters for the head and worker nodes separately):
|
None |
||
|
Maximum execution duration |
No |
The maximum execution duration. The job is terminated if it exceeds this limit. |
None |
||