coco
Collection
COCO dataset subsets for testing and validation • 3 items • Updated
Error code: RowsPostProcessingError
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
coco-val2017.zip holds the 5,000 COCO val2017 images in coco-val2017/images/val2017 and 4,952 YOLO-format label files (80 COCO classes, ids 0 to 79) in coco-val2017/labels/val2017. Images without objects have no label file. There are no training images, so this set is for validation and benchmarking.
import importlib.resources
import zipfile
import yaml
from huggingface_hub import hf_hub_download
from libreyolo import LibreYOLO
zip_path = hf_hub_download(
repo_id="LibreYOLO/coco-val2017",
filename="coco-val2017.zip",
repo_type="dataset",
)
zipfile.ZipFile(zip_path).extractall(".")
# Reuse the COCO class names that ship with LibreYOLO.
coco = importlib.resources.files("libreyolo") / "config/datasets/coco.yaml"
names = yaml.safe_load(coco.read_text())["names"]
cfg = {"train": "images/val2017", "val": "images/val2017", "nc": 80, "names": names}
yaml.safe_dump(cfg, open("coco-val2017/data.yaml", "w"))
model = LibreYOLO("LibreYOLOXn.pt")
model.val(data="coco-val2017/data.yaml")