Skip to content
Back to skills

Image Deduplicator

ASecurity

图像去重工具。使用图像哈希精确匹配在文档级别删除包含重复图像的样本。 当用户提到图像去重、删除重复图片、图片去重、清理重复图像等需求时使用此skill。 即使用户没有明确说出"图像去重",只要任务涉及从包含图像的数据中删除重复图片, 就应该使用此skill。

  • 539 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 11, 2026
toolspythonbash

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 5 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add cas-bigdatalab/piflow --skill image_deduplicator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Image Deduplicator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Image Deduplicator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cas-bigdatalab-image-deduplicator/badge)](https://www.skillsdirectory.com/skills/cas-bigdatalab-image-deduplicator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: image_deduplicator
description: |
  图像去重工具。使用图像哈希精确匹配在文档级别删除包含重复图像的样本。
  当用户提到图像去重、删除重复图片、图片去重、清理重复图像等需求时使用此skill。
  即使用户没有明确说出"图像去重",只要任务涉及从包含图像的数据中删除重复图片,
  就应该使用此skill。

name_zh: 图像去重算子
input_params:
  - name: input
    type: string
    required: true
    description: 输入JSON文件路径

  - name: output
    type: string
    required: true
    description: 输出JSON文件路径

  - name: method
    type: string
    required: false
    default: phash
    description: 图像哈希方法(phash/dhash/whash/ahash)

  - name: consider_text
    type: bool
    required: false
    default: false
    description: 是否同时考虑文本哈希进行去重

  - name: image_key
    type: string
    required: false
    default: images
    description: 图像字段的键名

  - name: text_key
    type: string
    required: false
    default: text
    description: 文本字段的键名

output_params:
  - name: output
    type: json_file
    description: 去重后的JSON文件,包含去重后的图像样本
tag: 数据清洗
publisher: COMMUNITY
---

# Image Deduplicator 图像去重 Skill

## 功能概述

本skill使用图像哈希算法(phash/dhash/whash/ahash)进行图像级别的精确匹配去重。
通过计算每个图像的哈希值,识别并删除包含相同图像的重复文档样本。

## 触发条件

当用户请求以下任务时,应使用此skill:
- 图像去重
- 删除重复图片
- 图片去重
- 清理重复图像
- 文档图像去重

## 核心参数说明

### 必需参数
| 参数 | 说明 |
|------|------|
| `--input` | 输入JSON文件路径 |
| `--output` | 输出JSON文件路径 |

### 可选参数
| 参数 | 说明 | 默认值 |
|------|------|--------|
| `--method` | 图像哈希方法 | `phash` |
| `--consider_text` | 是否同时考虑文本哈希 | `False` |
| `--image_key` | 图像字段的键名 | `images` |
| `--text_key` | 文本字段的键名 | `text` |

## 输入文件格式

```json
[
  {
    "images": ["/path/to/image1.png", "/path/to/image2.jpg"]
  },
  {
    "images": ["/path/to/image3.jpg"]
  }
]
```

带文本的格式:

```json
[
  {
    "images": ["/path/to/image1.png"],
    "text": "这是一段描述文字"
  },
  {
    "images": ["/path/to/image2.png"],
    "text": "另一段描述文字"
  }
]
```

## 哈希方法说明

| 方法 | 说明 |
|------|------|
| `phash` | 感知哈希,速度快,准确性高(默认) |
| `dhash` | 差值哈希 |
| `whash` | 小波哈希 |
| `ahash` | 平均哈希,最快但最粗糙 |

## 使用方法

### 基本用法
```bash
python scripts/run_image_deduplicator.py \
  --input ./input.json \
  --output ./output.json
```

### 使用指定哈希方法
```bash
python scripts/run_image_deduplicator.py \
  --input ./input.json \
  --output ./output.json \
  --method dhash
```

### 同时考虑文本去重
```bash
python scripts/run_image_deduplicator.py \
  --input ./input.json \
  --output ./output.json \
  --consider_text True
```

## 输出示例

**命令行输出:**
```
[OK] Image deduplication completed!
   Method: phash
   Consider text: False
   Original documents: 7
   Deduplicated documents: 3
   Removed duplicates: 4
   Input file: ./input.json
   Output file: ./output.json
```

**输出JSON格式:**
```json
[
  {"images": ["/path/to/image1.png"]},
  {"images": ["/path/to/image2.jpg"]},
  {"images": ["/path/to/image3.jpg"]}
]
```

## 环境要求

**安装依赖:**
本SKILL使用依赖 data_juicer,请在调用前安装好python环境并安装data_juicer,可用以下指令进行安装:
```bash
pip install py-data-juicer
```

**额外依赖:**
```bash
pip install imagededup
```

## 注意事项

1. **图像路径**:输入JSON中的图像路径应为绝对路径或相对于工作目录的路径
2. **哈希方法**:默认使用 phash,适合大多数场景
3. **consider_text**:设为 True 时,图像和文本都相同才算重复
4. **图像格式**:支持 PNG、JPG、JPEG 等常见图像格式

Files in this skill

  • SKILL.md4.1 KB
  • assets/icon.png28.1 KB
  • scripts/example_input.json338 B
  • scripts/run_image_deduplicator.py3.3 KB
  • skill.json2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…