SeungjunNah / DeepDeblur-PyTorch

Deep Multi-scale CNN for Dynamic Scene Deblurring
MIT License
262 stars 42 forks source link

how to train it on custom dataset? #41

Closed anushka17agarwal closed 9 months ago

anushka17agarwal commented 2 years ago

Hi, I've been trying to run this code on my custom dataset but couldn't understand the directory structure. Can someone help

SeungjunNah commented 2 years ago

The data loader assumes that the input and the target have different key strings in their full paths. By default, it is set as 'blur_gamma' and 'sharp' for GOPRO_Large dataset, 'blur' and 'sharp' for REDS dataset.

ex) gopro_large.py .../dataset/GOPRO_Large/train/blur_gamma/GOPR0372_07_00/blur_gamma/000047.png .../dataset/GOPRO_Large/train/blur_gamma/GOPR0372_07_00/sharp/000047.png

You can put blurry images under subfolders named 'blur' and sharp images under 'sharp.'

anushka17agarwal commented 2 years ago

I tried it still gives this error warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))

Traceback (most recent call last):
  File "main.py", line 68, in <module>
    main()
  File "main.py", line 65, in main
    main_worker(args.rank, args)
  File "main.py", line 15, in main_worker
    loaders = Data(args).get_loader()
  File "/home/anushka/DeepDeblur-PyTorch/src/data/__init__.py", line 73, in __init__
    self.loaders[mode] = _get_data_loader(mode)
  File "/home/anushka/DeepDeblur-PyTorch/src/data/__init__.py", line 43, in _get_data_loader
    sampler = RandomSampler(dataset, replacement=False)
  File "/home/anushka/miniconda3/envs/deblur/lib/python3.6/site-packages/torch/utils/data/sampler.py", line 96, in __init__
    "value, but got num_samples={}".format(self.num_samples))
ValueError: num_samples should be a positive integer value, but got num_samples=0
SeungjunNah commented 2 years ago

The message means that the code did not locate the dataset. Did you change --data_root and --data_train accordingly? You may want to check L40-47 in option.py.

For example, if args.data_root is ~/Research/dataset and args.data_train is CustomData, your dataset path should be something like: ~/Research/dataset/CustomData/train/seq01/blur/0001.png ~/Research/dataset/CustomData/train/seq01/sharp/0001.png