haibo-qiu / FROM

[TPAMI 2021] End2End Occluded Face Recognition by Masking Corrupted Features
https://arxiv.org/abs/2108.09468
43 stars 8 forks source link

getting num_samples value as 0 #10

Closed Splinter1080 closed 1 year ago

Splinter1080 commented 1 year ago

Hey I am trying to run the code but I am facing the following error :

Traceback (most recent call last):
  File "train.py", line 255, in <module>
    main()
  File "train.py", line 197, in main
    train_loader = torch.utils.data.DataLoader(
  File "C:\Users\supre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\torch\utils\data\dataloader.py", line 268, in __init__
    sampler = RandomSampler(dataset, generator=generator)
  File "C:\Users\supre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\torch\utils\data\sampler.py", line 102, in __init__
    raise ValueError("num_samples should be a positive integer "
ValueError: num_samples should be a positive integer value, but got num_samples=0

Ps ; I tried to print len(dataset) , I am getting 0 for that too .

haibo-qiu commented 1 year ago

Hi @Splinter1080 , The training data is unpacked from the LMDB file using the following class: https://github.com/haibo-qiu/FROM/blob/416c13c0133a33dbb0dc4aa58bcdb5a76e4f20a3/lib/datasets/dataset.py#L115-L124

If len(dataset) is 0, first check if the path to the LMDB file is correct. Then verify that the version of the LMDB package is lmdb=1.2.0, as different versions may cause unpacking problems that I have encountered before.

haibo-qiu commented 1 year ago

Feel free to reopen this issue if you have any further questions.

xhlbetter commented 1 month ago

lmdb=1.2.0 was yanked: incomplete release

xhlbetter commented 1 month ago

So are there any other ways to solve this problem?

xhlbetter commented 1 month ago

I would like to ask if you have solved this problem? @Splinter1080