I am having a hard time managing to reach the solution to my next problem:
I have 3 datasets and a common test set for image segmentation:
This is my folder structure:
Datasets/
- Dataset1/
-Images/
-Label/
- Dataset2/
-Images/
-Label/
- Dataset3/
-Images/
-Label/
- test/
-Images/
-Label/
I need to train a different model for each dataset and valid it againts the same test set.
I have tried using the DataBlock API:
path=Path("Datasets/")
manual = DataBlock(blocks=(ImageBlock, MaskBlock(codes)),
get_items=partial(get_image_files,folders=["Dataset1","test"]),
splitter=GrandparentSplitter(valid_name='test'),
get_y=get_y_fn_manual,
item_tfms=Resize((size,size)),
batch_tfms=Normalize.from_stats(*imagenet_stats)
)
manual.summary(path)
dls = manual.dataloaders(path,bs=1)
I don understand pretty well the get_items operation.
However, It keeps throwing me the next error:
Setting-up type transforms pipelines
Collecting items from ../datasets
Found 0 items
2 datasets of sizes 0,0
Setting up Pipeline: PILBase.create
---------------------------------------------------------------------------
TypeError: 'NoneType' object is not iterable
I have tried the next code:
manual = DataBlock(blocks=(ImageBlock, MaskBlock(codes)),
get_items=partial(get_image_files,folders=["Dataset1","test"]),
get_y=get_y_fn_manual,
splitter=GrandparentSplitter(train_name="Dataset1",valid_name="test"),
item_tfms=Resize((size,size)),
batch_tfms=Normalize.from_stats(*imagenet_stats)
)
manual.summary(path)
dls = manual.dataloaders(path,bs=1)
Its creating the databunch now, however it don’t distinguish between Images and Labels.