1.path = untar_data(URLs.PASCAL_2007)

 

2.df = pd.read_csv(path/'train.csv')

df.head()

 

3.pascal = DataBlock(blocks= (ImageBlock, MultiCategoryBlock),

splitter = ColSplitter('is_valid'),

get_x = ColReader('fname', pref = str(path/'train') + os.path.sep),

get_y = ColReader('labels', label_delim = ' '),

item_tfms = Resize(460),

batch_tfms = aug_transforms(size = 224) )

 

->이해x

This block is slightly different than before: we don't need to pass a function to gather all our items as the dataframe we will give already has them all. However, we do need to preprocess the row of that dataframe to get out inputs, which is why we pass a get_x. It defaults to the fastai function noop, which is why we didn't need to pass it along before.

Like before, pascal is just a blueprint. We need to pass it the source of our data to be able to get DataLoaders

 

이전처럼 data block은 청사진이다.

dataloaders 메소드를 사용하자.

 

4. dls = pascal.dataloaders(df)

 

5. dls.show_batch(max_n = 9)

+ Recent posts