ECN icon indicating copy to clipboard operation
ECN copied to clipboard

ValueError: num_samples should be a positive integeral value, but got num_samples=0

Open ZamSul opened this issue 5 years ago • 1 comments

Hi, I was trying main.py and encountered the following error.

/usr/local/lib/python3.6/dist-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
log_dir= /home/zamra/PYreps/Person_ReId/ECN/logs
Namespace(arch='resnet50', batch_size=128, data_dir='/home/zamra/PYreps/Person_ReId/ECN/data', dist_metric='euclidean', dropout=0.5, epochs=60, epochs_decay=40, evaluate=False, features=4096, height=256, inv_alpha=0.01, inv_beta=0.05, knn=6, lmd=0.3, logs_dir='/home/zamra/PYreps/Person_ReId/ECN/logs', lr=0.1, momentum=0.9, output_feature='pool5', print_freq=1, re=0.5, resume='', source='duke', target='market', weight_decay=0.0005, width=128, workers=8)
DA dataset loaded
  subset   | # ids | # images
  ---------------------------
  source train    |     0 |        0
  target train    | 'Unknown' |        0
  query    |     0 |        0
  gallery  |     0 |        0
Traceback (most recent call last):
  File "main.py", line 229, in <module>
    main(args)
  File "main.py", line 94, in main
    args.re, args.workers)
  File "main.py", line 50, in get_data
    shuffle=True, pin_memory=True, drop_last=True)
  File "/home/zamra/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 802, in __init__
    sampler = RandomSampler(dataset)
  File "/home/zamra/.local/lib/python3.6/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

ZamSul avatar Jan 21 '20 11:01 ZamSul

It can appears when you did not split properly data.

Be sure that you respect the convention the author mentionned downloading all files required and follow this architecture :

ECN/data
----market OR duke OR msmt17
--------bounding_box_train --------bounding_box_test --------bounding_box_train_camstyle --------query

with exactly same name (rename Market1501 as market etc...).

bounding_box_train_camstyle has to be downloaded and added after (because it is not present in initial datasets)

djidje avatar Jan 24 '20 21:01 djidje