rdroste / unisal

Unified Image and Video Saliency Modeling (ECCV 2020)
https://arxiv.org/abs/2003.05477
Apache License 2.0
131 stars 37 forks source link

SALICON loaded with 0 samples in training #9

Closed GemLuo closed 3 years ago

GemLuo commented 3 years ago

Hello,Mr.Droste.I changed the paths of datasets and run python run.py train, but it don't work. This is the traceback. I find that SALICON loaded with 0 samples in training. Could you please help me?

(unisal) LHY2@node2:/storage/LHY2/Code/unisal$ OMP_NUM_THEREADS=1 CUDA_VISIBLE_DEVICES=6 python run.py train
++++++++ /storage/LHY2/Dataset/VideoSaliency/SALICON
600 videos loaded (100.0%)
0 videos are too short [(0.0%)]
0 videos are too long (0.0%)
DHF1K      train dataset loaded with 600 samples
946 videos loaded (43.2%)
1244 videos are too short (56.8%)
0 videos are too long (0.0%)
Hollywood  train dataset loaded with 946 samples
82 videos loaded (88.2%)
11 videos are too short (11.8%)
0 videos are too long (0.0%)
UCFSports  train dataset loaded with 82 samples
**SALICON    train dataset loaded with 0 samples**

Epoch   0, lr 0.04000
DHF1K, phase train batch size: 4
Hollywood, phase train batch size: 4
UCFSports, phase train batch size: 4
SALICON, phase train batch size: 32
Traceback (most recent call last):
  File "run.py", line 97, in <module>
    fire.Fire()
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/fire/core.py", line 138, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/fire/core.py", line 471, in _Fire
    target=component.__name__)
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/fire/core.py", line 675, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "run.py", line 13, in train
    trainer.fit()
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 237, in fit
    self.fit_epoch()
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 265, in fit_epoch
    self.fit_phase()
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 281, in fit_phase
    for src in sources}
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 281, in <dictcomp>
    for src in sources}
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 1067, in get_dataloader
    drop_last=True,
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 802, in __init__
    sampler = RandomSampler(dataset)
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 64, in __init__
    "value, but got num_samples={}".format(self.num_samples))
ValueError: num_samples should be a positive integeral value, but got num_samples=0
haitian2du commented 3 years ago

Hello,Mr.Droste.I changed the paths of datasets and run python run.py train, but it don't work. This is the traceback. I find that SALICON loaded with 0 samples in training. Could you please help me?

(unisal) LHY2@node2:/storage/LHY2/Code/unisal$ OMP_NUM_THEREADS=1 CUDA_VISIBLE_DEVICES=6 python run.py train
++++++++ /storage/LHY2/Dataset/VideoSaliency/SALICON
600 videos loaded (100.0%)
0 videos are too short [(0.0%)]
0 videos are too long (0.0%)
DHF1K      train dataset loaded with 600 samples
946 videos loaded (43.2%)
1244 videos are too short (56.8%)
0 videos are too long (0.0%)
Hollywood  train dataset loaded with 946 samples
82 videos loaded (88.2%)
11 videos are too short (11.8%)
0 videos are too long (0.0%)
UCFSports  train dataset loaded with 82 samples
**SALICON    train dataset loaded with 0 samples**

Epoch   0, lr 0.04000
DHF1K, phase train batch size: 4
Hollywood, phase train batch size: 4
UCFSports, phase train batch size: 4
SALICON, phase train batch size: 32
Traceback (most recent call last):
  File "run.py", line 97, in <module>
    fire.Fire()
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/fire/core.py", line 138, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/fire/core.py", line 471, in _Fire
    target=component.__name__)
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/fire/core.py", line 675, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "run.py", line 13, in train
    trainer.fit()
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 237, in fit
    self.fit_epoch()
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 265, in fit_epoch
    self.fit_phase()
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 281, in fit_phase
    for src in sources}
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 281, in <dictcomp>
    for src in sources}
  File "/storage/LHY2/Code/unisal/unisal/train.py", line 1067, in get_dataloader
    drop_last=True,
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 802, in __init__
    sampler = RandomSampler(dataset)
  File "/storage/LHY/anaconda/envs/unisal/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 64, in __init__
    "value, but got num_samples={}".format(self.num_samples))
ValueError: num_samples should be a positive integeral value, but got num_samples=0

I think the reason for this may be the problem of data path, you can download and put data according to the path as below, it will be fine. But I have other problems, please ask if you have encountered? 捕获2

GemLuo commented 3 years ago

Thank you ! I add self.phase_str in function get_img of data.py , and the program running normally. @haitian2du what's your problem? def get_img(self, img_nr): img_file = self.dir / 'images' / self.phase_str / ( self.file_stem + self.file_nr.format(img_nr) + '.jpg') img = cv2.imread(str(img_file)) assert(img is not None) return np.ascontiguousarray(img[:, :, ::-1])

rdroste commented 3 years ago

Sorry for the late reply. Glad to hear that the issue is solved. If you think that there is a general issue in nose_down_crop_y.get_img, please feel free to open a pull request.