Yaoyi-Li / GCA-Matting

Official repository for Natural Image Matting via Guided Contextual Attention
MIT License
391 stars 62 forks source link

StopIteration: No samples in loader. example: `iterator = iter(Prefetcher(loader)); data = next(iterator)` #14

Open Feywell opened 4 years ago

Feywell commented 4 years ago

If bg_num < batch_size, there is a error like title. And it will always one image, when bg_num = 1, batch_size = 1.

Yaoyi-Li commented 4 years ago

It is because we assume that the number of background images is always larger than the foreground. If you have more foreground images, you can update https://github.com/Yaoyi-Li/GCA-Matting/blob/5a999be4b00bb482658fa7013a74a2b8acddc78e/dataloader/data_generator.py#L533 to return len(self.fg) and update https://github.com/Yaoyi-Li/GCA-Matting/blob/5a999be4b00bb482658fa7013a74a2b8acddc78e/dataloader/data_generator.py#L486-L488

But I will always recommend that there should be enough background images for sample generation.