The LVM-Image-NSFW Filter (DLC) component scores images for Not Safe For Work (NSFW) content and removes images that exceed a configured threshold. Use it as a data-cleaning step before training image generation models to improve training data quality.
How it works
The component reads image data from Object Storage Service (OSS) — either from a directory path or a metadata file.
It calculates an NSFW score for each image.
Images with a score above the configured NSFW Score Threshold are filtered out.
The retained images and statistics are written to the specified OSS output directory.
Prerequisites
Before you begin, ensure that you have:
An OSS bucket containing the image data to filter
An OSS directory available to store the output
A GPU instance type available in your resource group (required by the scoring algorithm)
Input ports
The component accepts input from one of the following sources:
Scenario | Input source |
First run (no upstream component) | Set the Image Data OSS Path parameter to point to the OSS directory containing your images |
Subsequent runs | Set Image Data OSS Path to the |
Pipeline integration | Connect any image data preprocessing component as the upstream input |
When the component runs for the first time with a directory path, it generates a meta.jsonl metadata file in the parent directory of that path. On subsequent runs, pass meta.jsonl directly to skip re-scanning the directory.
Output port
The component writes filtering results to the OSS directory specified by OSS Directory for Saving OutputData. The output includes:
File | Description |
| The filtered output dataset. The filename is set by Output Filename (default: |
| The state file |
| The YAML configuration used when the algorithm ran |
Configure the component
Configure the following parameters in Machine Learning Designer.
Field settings
Parameter | Required | Default | Description |
Image Data OSS Path | No | — | The OSS directory containing your images, or the |
OSS Directory for Saving OutputData | No | — | The OSS directory where filtering results are stored. |
Output Filename | No |
| The base name for the output file. The stats file uses the same base name with a |
Parameter settings
Parameter | Required | Default | Description |
NSFW Score Threshold | Yes |
| Images with an NSFW score above this value are filtered out. A lower threshold is stricter and retains fewer images; a higher threshold is more permissive and retains more images. |
Execution tuning
Parameter | Required | Default | Description |
Number of Processes | No |
| The number of processes. |
Single-node/Distributed | No |
| Single-node or multi-node mode. Default value: single-node. Multi-node mode supports only the Ray framework. |
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):
|
Maximum Running Duration (seconds) | No | — | The job is terminated if it runs longer than this value. |