All
This commit is contained in:
commit
21970b730a
406 files changed
+11530
No files matched your search
+31
@@ -0,0 +1,31 @@
|
||||
import torch.utils.data
|
||||
from data.base_data_loader import BaseDataLoader
|
||||
|
||||
|
||||
def CreateDataset(opt):
|
||||
dataset = None
|
||||
from data.aligned_dataset import AlignedDataset
|
||||
dataset = AlignedDataset()
|
||||
|
||||
print("dataset [%s] was created" % (dataset.name()))
|
||||
dataset.initialize(opt)
|
||||
return dataset
|
||||
|
||||
class CustomDatasetDataLoader(BaseDataLoader):
|
||||
def name(self):
|
||||
return 'CustomDatasetDataLoader'
|
||||
|
||||
def initialize(self, opt):
|
||||
BaseDataLoader.initialize(self, opt)
|
||||
self.dataset = CreateDataset(opt)
|
||||
self.dataloader = torch.utils.data.DataLoader(
|
||||
self.dataset,
|
||||
batch_size=opt.batchSize,
|
||||
shuffle=not opt.serial_batches,
|
||||
num_workers=int(opt.nThreads))
|
||||
|
||||
def load_data(self):
|
||||
return self.dataloader
|
||||
|
||||
def __len__(self):
|
||||
return min(len(self.dataset), self.opt.max_dataset_size)
|
||||
Reference in new issue
Block a user