The dataset viewer is not available for this dataset.
Error code: ConfigNamesError
Exception: RuntimeError
Message: Dataset scripts are no longer supported, but found ksdd2.py
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/dataset/config_names.py", line 66, in compute_config_names_response
config_names = get_dataset_config_names(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/inspect.py", line 161, in get_dataset_config_names
dataset_module = dataset_module_factory(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 1031, in dataset_module_factory
raise e1 from None
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 989, in dataset_module_factory
raise RuntimeError(f"Dataset scripts are no longer supported, but found {filename}")
RuntimeError: Dataset scripts are no longer supported, but found ksdd2.pyNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
KSDD2 (manual-download loader)
This repo provides a manual-download loading script for Kolektor Surface-Defect Dataset 2 (KSDD2).
No images are hosted here. Users must download KSDD2 from the official page and load locally via load_dataset(..., data_dir=...).
- Official page (license & download): https://www.vicos.si/resources/kolektorsdd2/
- Dataset license: CC BY-NC-SA 4.0 (non‑commercial; attribution; share‑alike). For commercial usage, follow the authors’ instructions on the official page.
What this loader does: read your local KSDD2 folder, return a standard DatasetDict with images and metadata, without moving or copying files.
Recommended environment (important)
This dataset card uses a custom loading script (trust_remote_code=True). Newer versions of datasets (v4.x) do not execute loading scripts from the Hub.
To load this dataset from the Hub script, please install the tested versions:
pip install "datasets==3.2.0" "huggingface_hub<0.27"
If you must use newer releases, consider the built‑in imagefolder loader (labels/masks & pyb auto‑labeling will not be available), or run a local helper to produce Arrow/Parquet then load_from_disk. For best UX, we recommend the tested versions above.
Windows note: you may see a harmless warning about symlinks from
huggingface_hub. It can be ignored, or disable viaHF_HUB_DISABLE_SYMLINK_WARNING=1, or enable Windows Developer Mode / run as admin.
Features by config
| Config | Features | When to use |
|---|---|---|
image_only |
{"image", "path"} |
You have flat train/ and test/ (images only), no labels yet. |
classification_from_list |
{"image", "label", "path"} |
Flat folders + you provide defect_list.txt (one filename per line). |
classification_from_pyb |
{"image", "label", "path"} |
Flat folders + you have split_weakly_*.pyb files (labels auto‑derived). |
classification |
{"image", "label", "path"} |
Your data is already split into ok/ and defect/ subfolders. |
with_mask |
{"image", "label", "path", "mask_path"} |
Same as classification, and you also have a masks folder with same names. |
label is a ClassLabel with ["good", "defect"].mask_path is a string (empty if not found).
Folder layouts (examples)
A) Flat layout (no subfolders under split)
KSDD2/
train/*.png|jpg
test/*.png|jpg
split_weakly_0.pyb
split_weakly_16.pyb
...
B) Labeled subfolders
KSDD2/
train/
ok/*.png|jpg
defect/*.png|jpg
[masks | masks_defect | ground_truth | gt | label | labels]/*.png # optional, for with_mask
test/
ok/*.png|jpg
defect/*.png|jpg
[masks | masks_defect | ground_truth | gt | label | labels]/*.png
Quickstart
All snippets below assume the tested versions mentioned above and
trust_remote_code=True.
1) Flat, images only
from datasets import load_dataset
ds = load_dataset("OliverOnHF/ksdd2",
name="image_only",
data_dir=r"<Your Local KSDD2 dataset path>",
trust_remote_code=True)
print(ds)
print(ds["train"][0]) # {"image": ..., "path": "..."}
2) Flat + auto labels from pyb
ds = load_dataset("OliverOnHF/ksdd2",
name="classification_from_pyb",
data_dir=r"<Your Local KSDD2 dataset path>",
trust_remote_code=True)
print(ds["train"].features) # ClassLabel(names=['good','defect'])
print(ds["train"][0]) # {"image": ..., "label": 0/1, "path": "..."}
How it works: the loader scans all split_weakly_*.pyb next to your train/ and test/, extracts filename strings and/or numeric IDs, matches them to your image basenames (e.g. 10023 → 10023.png), and takes the union across all pyb files: if a name appears in any pyb, it is labeled as defect.
3) Flat + your defect list
Place a defect_list.txt (or .csv) inside each split:
KSDD2/
train/
defect_list.txt # one filename per line; comments (#) and blanks ignored
test/
defect_list.txt
Then:
ds = load_dataset("OliverOnHF/ksdd2",
name="classification_from_list",
data_dir=r"<Your Local KSDD2 dataset path>",
trust_remote_code=True)
4) Labeled subfolders
ds = load_dataset("OliverOnHF/ksdd2",
name="classification",
data_dir=r"<Your Local KSDD2 dataset path>",
trust_remote_code=True)
5) Labeled subfolders + masks
ds = load_dataset("OliverOnHF/ksdd2",
name="with_mask",
data_dir=r"<Your Local KSDD2 dataset path>",
trust_remote_code=True)
The loader looks up masks by same filename under any of:
masks, masks_defect, ground_truth, gt, label, labels. If not found, mask_path is an empty string.
Troubleshooting
- “Dataset scripts are no longer supported” or cannot
trust_remote_code: use the tested versions shown above (datasets==3.2.0,huggingface_hub<0.27). - “Cannot find class folders … expect ok and defect”: you selected
classification/with_maskbut your layout is flat. Useclassification_from_pyb/classification_from_list, or reorganize intook/anddefect/. - No labels produced in
classification_from_pyb: make suresplit_weakly_*.pybsits next totrain/andtest/, and that image basenames contain numeric IDs or exact names referenced by the pyb files. - Windows symlink warning from
huggingface_hub: harmless; can be ignored.
License
- Dataset (KSDD2): CC BY-NC-SA 4.0 — see the official KSDD2 page. This repo does not redistribute any images.
- Loader code in this repo: MIT (see
LICENSE).
Citation
Please cite KSDD2 as requested by the authors on the official page.
- Downloads last month
- 10