allow_empty=True for Classify dataset class directories (#14301)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Alexis IMBERT 2024-07-10 01:02:10 +02:00 committed by GitHub
parent 8ef1d81e66
commit 7a6bb2b1c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -416,7 +416,7 @@ class ClassificationDataset:
import torchvision # scope for faster 'import ultralytics'
# Base class assigned as attribute rather than used as base class to allow for scoping slow torchvision import
self.base = torchvision.datasets.ImageFolder(root=root)
self.base = torchvision.datasets.ImageFolder(root=root, allow_empty=True)
self.samples = self.base.samples
self.root = self.base.root