JonathanSeriesX / rembg-trainer

Code to train U2Net model for use with rembg tool
MIT License
56 stars 16 forks source link

It's not detecting my images and mask file #3

Open pkmnsandy opened 1 month ago

pkmnsandy commented 1 month ago

Why I am getting these errors despite having all my images and their corresponding binary files in their respective folders?

Learning the dataset itself...

Training Images Found: [] Number of Images: 0 Training Masks Found: [] Number of Masks: 0 Traceback (most recent call last): File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 578, in main() File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 568, in main create_and_train( File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 547, in create_and_train dataloader = get_dataloader( ^^^^^^^^^^^^^^^ File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 382, in get_dataloader dataloader = DataLoader( ^^^^^^^^^^^ File "/Users/pkmnsandy/anaconda3/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 351, in init sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/pkmnsandy/anaconda3/lib/python3.11/site-packages/torch/utils/data/sampler.py", line 144, in init raise ValueError(f"num_samples should be a positive integer value, but got num_samples={self.num_samples}") ValueError: num_samples should be a positive integer value, but got num_samples=0

shuaimoumou commented 3 weeks ago

Why I am getting these errors despite having all my images and their corresponding binary files in their respective folders?

Learning the dataset itself...

Training Images Found: [] Number of Images: 0 Training Masks Found: [] Number of Masks: 0 Traceback (most recent call last): File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 578, in main() File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 568, in main create_and_train( File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 547, in create_and_train dataloader = get_dataloader( ^^^^^^^^^^^^^^^ File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 382, in get_dataloader dataloader = DataLoader( ^^^^^^^^^^^ File "/Users/pkmnsandy/anaconda3/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 351, in init sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/pkmnsandy/anaconda3/lib/python3.11/site-packages/torch/utils/data/sampler.py", line 144, in init raise ValueError(f"num_samples should be a positive integer value, but got num_samples={self.num_samples}") ValueError: num_samples should be a positive integer value, but got num_samples=0

Your mistake was caused by the absence of 0 images and masks

pkmnsandy commented 3 weeks ago

Thank you for the replt

Why I am getting these errors despite having all my images and their corresponding binary files in their respective folders? Learning the dataset itself... Training Images Found: [] Number of Images: 0 Training Masks Found: [] Number of Masks: 0 Traceback (most recent call last): File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 578, in main() File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 568, in main create_and_train( File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 547, in create_and_train dataloader = get_dataloader( ^^^^^^^^^^^^^^^ File "/Users/pkmnsandy/rembg-trainer/u2net_train.py", line 382, in get_dataloader dataloader = DataLoader( ^^^^^^^^^^^ File "/Users/pkmnsandy/anaconda3/lib/python3.11/site-packages/torch/utils/data/dataloader.py", line 351, in init sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/pkmnsandy/anaconda3/lib/python3.11/site-packages/torch/utils/data/sampler.py", line 144, in init raise ValueError(f"num_samples should be a positive integer value, but got num_samples={self.num_samples}") ValueError: num_samples should be a positive integer value, but got num_samples=0

Your mistake was caused by the absence of 0 images and masks

Thank you for the reply. What do you mean by the absence of 0 images and masks? I have all the original images (saved in images folder) and their corresponding mask images (saved in masks folder), with the same file names and file extension (i.e. .jpg). Still I got this error.