Skip to content

I'm curious about configuring datasets for training.Β #509

@a510721

Description

@a510721

πŸ€” What’s your question?

I'm curious about how to structure my datasets for training. I'm following the coco format and have the images and annotation.json files in the same folder.

.train/images
β”œβ”€β”€ annotation.json
β”œβ”€β”€ image1.png
β”œβ”€β”€ image2.png

The code is as follows:
import lightly_train

def main():

lightly_train.train_instance_segmentation(
    out="out/my_experiment",
    overwrite=True,
    model="dinov3/vits16-eomt-inst-coco",
    data={
        "path": "/home/kys/workspace/code/thrid_party/detector/datasets/light_train",
        "train": "train/images",
        "val": "valid/images",
        "names": {
            0: "person",
        },
    },
)

The error is as follows:
Train images: 0, Val images: 0
Detected dataset size 0 and batch size 16. Reducing batch size to 0.
<lightly_train._data.yolo_instance_segmentation_dataset.YOLOInstanceSegmentationDataset object at 0x703ef9a6eea0>
Traceback (most recent call last):
File "/home/kys/workspace/code/thrid_party/detector/lightly-train/main.py", line 42, in
main()
File "/home/kys/workspace/code/thrid_party/detector/lightly-train/main.py", line 11, in main
lightly_train.train_instance_segmentation(
File "/home/kys/workspace/code/thrid_party/detector/lightly-train/venv/lib/python3.12/site-packages/lightly_train/_commands/train_task.py", line 189, in train_instance_segmentation
return _train_task(config_cls=InstanceSegmentationTrainTaskConfig, **locals())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kys/workspace/code/thrid_party/detector/lightly-train/venv/lib/python3.12/site-packages/lightly_train/_commands/train_task.py", line 499, in _train_task
_train_task_from_config(config=config)
File "/home/kys/workspace/code/thrid_party/detector/lightly-train/venv/lib/python3.12/site-packages/lightly_train/_commands/train_task.py", line 649, in _train_task_from_config
train_dataloader = helpers.get_train_dataloader(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kys/workspace/code/thrid_party/detector/lightly-train/venv/lib/python3.12/site-packages/lightly_train/_commands/train_task_helpers.py", line 581, in get_train_dataloader
dataloader = DataLoader(**dataloader_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kys/workspace/code/thrid_party/detector/lightly-train/venv/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 388, in init
sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kys/workspace/code/thrid_party/detector/lightly-train/venv/lib/python3.12/site-packages/torch/utils/data/sampler.py", line 162, in init
raise ValueError(
ValueError: num_samples should be a positive integer value, but got num_samples=0

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions