OD-CLIP / README.md
yeeecheng's picture
Update README: jpeg split into 2 parts
0a4293a verified
|
Raw
History Blame Contribute Delete
5.79 kB
metadata
license: cc-by-sa-4.0
task_categories:
  - image-to-image
  - image-classification
tags:
  - image-restoration
  - super-resolution
  - blind-image-super-resolution
  - clip
  - degradation
  - lpips
size_categories:
  - 100K<n<1M
pretty_name: OD-CLIP Training Dataset

OD-CLIP Training Dataset

Training data for OD-CLIP: a degradation-aware CLIP variant that jointly predicts degradation type and LPIPS-calibrated perceptual severity, used for blind image super-resolution.

The dataset provides paired ground-truth (GT) and low-quality (LQ) image crops together with per-image degradation metadata, covering four synthetic degradation types (Gaussian blur, Gaussian noise, JPEG compression, and downsampling) at a dense grid of physical severity levels.

Download and Setup

The dataset is distributed as six tar archives (blur / jpeg_part1 / jpeg_part2 / resize / noisy for the single-degradation set, and one tar for the mixed-degradation set) plus two CSV manifests. JPEG is split into two parts because its combined size exceeds Hugging Face's per-file limit of 50 GB.

1. Install the CLI (once)

pip install --upgrade huggingface_hub

2. Download the dataset

# Download the whole dataset
huggingface-cli download yeeecheng/OD-CLIP \
  --repo-type dataset --local-dir OD-CLIP

Or download only the parts you need:

# Only single-degradation set (blur/jpeg/resize/noisy)
huggingface-cli download yeeecheng/OD-CLIP --repo-type dataset \
  --include "DIV2K_HR_train_crop/*" --local-dir OD-CLIP

# Only mixed-degradation set (stage-2 fine-tuning)
huggingface-cli download yeeecheng/OD-CLIP --repo-type dataset \
  --include "DIV2K_train_HR_random/*" --local-dir OD-CLIP

# Only one degradation type (e.g. blur)
huggingface-cli download yeeecheng/OD-CLIP --repo-type dataset \
  --include "DIV2K_HR_train_crop/blur.tar" \
  --include "DIV2K_HR_train_crop/merged_daclip_train_all.csv" \
  --local-dir OD-CLIP

# For JPEG, remember to grab both parts
huggingface-cli download yeeecheng/OD-CLIP --repo-type dataset \
  --include "DIV2K_HR_train_crop/jpeg_part*.tar" \
  --include "DIV2K_HR_train_crop/merged_daclip_train_all.csv" \
  --local-dir OD-CLIP

3. Extract the tar archives

cd OD-CLIP

# Extract the four type tars (single-degradation set)
cd DIV2K_HR_train_crop
for f in *.tar; do
  echo "Extracting $f ..."
  tar xf "$f"
  rm "$f"                 # optional: free disk after extraction
done
cd ..

# Note: jpeg_part1.tar and jpeg_part2.tar both extract into the same
# top level (each holds a disjoint set of jpeg{XX}.0/ subdirs), so no
# special handling is needed — the two archives merge cleanly.

# Extract the mixed-degradation tar
cd DIV2K_train_HR_random
mkdir -p train_crop
tar xf random0.tar -C train_crop/
rm random0.tar            # optional
cd ..

4. Resulting directory layout

OD-CLIP/
├── DIV2K_HR_train_crop/
│   ├── merged_daclip_train_all.csv          # top-level manifest
│   ├── blur0.1/  blur0.2/  ...  blur4.0/    # 40 subdirs
│   ├── jpeg31/   jpeg32/   ...  jpeg95/     # 65 subdirs
│   ├── resize1.1/  ...  resize7.0/          # 60 subdirs
│   ├── noisy1/   ...  noisy40/              # 40 subdirs
│   └── (each subdir contains: GT/, LQ/, daclip_val.csv, degraded_prompts_0.json)
└── DIV2K_train_HR_random/
    ├── merged_daclip_train_all_updated.csv  # stage-2 manifest
    └── train_crop/random0/
        ├── GT/          # 4000 clean crops
        └── LQ/          # 4000 mixed-degradation crops

5. Verify

Each single-degradation subdirectory should contain 800 GT crops and 800 LQ crops; the mixed-degradation random0/{GT,LQ} should each contain 4000. A quick check:

ls OD-CLIP/DIV2K_HR_train_crop/blur0.1/LQ | wc -l                # → 800
ls OD-CLIP/DIV2K_HR_train_crop/blur0.1/GT | wc -l                # → 800
ls OD-CLIP/DIV2K_train_HR_random/train_crop/random0/LQ | wc -l   # → 4000

Contents

1. DIV2K_HR_train_crop/

Single-degradation training set. Contains 208 subdirectories, one per (degradation_type, level) pair:

Type Physical parameter Range Step # subdirs
Blur Gaussian sigma 0.1 → 4.0 0.1 40
JPEG Quality factor 31 → 95 1 65
Downsample Scale factor 1.1 → 7.0 0.1 60
Noise Gaussian sigma 1.0 → 40.0 1.0 40
Total 205

(Additional 3 clean-reference subdirs bring the total to 208.)

Each subdirectory contains:

  • GT/ — 800 clean crops (256×256 px, PNG)
  • LQ/ — 800 degraded crops (256×256 px, PNG), paired one-to-one with GT/
  • daclip_val.csv — per-image manifest (filepath, degradation label, physical parameter value)
  • degraded_prompts_0.json — text prompt used for the degradation

2. DIV2K_train_HR_random/

Mixed-degradation training set. All four degradations are applied to each image with per-image randomized parameters, used for stage-2 fine-tuning on composite degradations.

  • train_crop/random0/GT/ — 4000 clean crops
  • train_crop/random0/LQ/ — 4000 mixed-degradation crops
  • merged_daclip_train_all_updated.csv — top-level manifest for stage-2 training

Source and License

Ground-truth crops are derived from the DIV2K training set (https://data.vision.ee.ethz.ch/cvl/DIV2K/), licensed under CC BY-SA 4.0. This release inherits the same license.

Contact

For questions, please open an issue on this dataset repository.