The LVM-Image-Aspect-Ratio Filter (DLC) component removes images with extreme aspect ratios from your training dataset. Use it to enforce consistent image proportions before training image generation models.
Supported computing resources
How it works
The component calculates the width-to-height ratio (W/H) for each image and filters out any image whose ratio falls outside the configured range. Images within the range are written to the output file; images outside the range are discarded. In most cases, the component is used for the subsequent training of image generation models.
Example: With Minimum Aspect Ratio set to 0.333 and Maximum Aspect Ratio set to 3.0:
|
Image |
Dimensions |
Aspect ratio (W/H) |
Result |
|
img1 |
1920 x 1080 |
1.78 |
Kept |
|
img2 |
100 x 1000 |
0.10 |
Filtered out (too narrow) |
|
img3 |
3200 x 400 |
8.00 |
Filtered out (too wide) |
Inputs and outputs
Input
Connect one of the following upstream components:
-
Read File Data — reads the Object Storage Service (OSS) path where your training data is stored.
-
Image Data OSS Path — configure this parameter to select the OSS directory where the image data is stored or to select the image metadata file.
-
Any image data preprocessing component — the output of an upstream preprocessing step can feed directly into this filter.
Output
The filtering results. For more information, see the parameter description below.
Parameters
Configure the component in Machine Learning Designer. The following table describes all parameters.
|
Category |
Parameter |
Required |
Description |
Default |
|
Field Settings |
Image Data OSS Path |
No |
On the first run without an upstream component, select the OSS directory where the image data is stored manually. A metadata file meta.jsonl is generated in the parent directory of the specified path. For subsequent runs, you can select the previously generated meta.jsonl file directly. |
None |
|
OSS Directory for Saving OutputData |
No |
The OSS directory where filtering results are stored. The filtering results include the following files:
|
None |
|
|
Output Filename |
No |
The filename for the filtered output file. |
result.jsonl |
|
|
Parameter Settings |
Minimum Aspect Ratio (W/H) |
Yes |
The minimum acceptable aspect ratio (W/H). |
0.333 |
|
Maximum Aspect Ratio (W/H) |
Yes |
The maximum acceptable aspect ratio (W/H). |
3.0 |
|
|
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 (for distributed mode, set resource parameters separately for the Head and Worker):
|
None |
|
|
Maximum Running Duration |
No |
The maximum time the component is allowed to run. The job is terminated if this limit is exceeded. |
None |