data block API를 사용해서 데이터를 DataLoaders에 모아보자.
(참고)
1.pets = DataBlock(blocks=(ImageBlock, CategoryBlock),
get_items=get_image_files,
splitter=RandomSplitter(),
get_y=using_attr(RegexLabeller(r'(.+)_\d+.jpg$'), 'name'),
item_tfms=Resize(460),
batch_tfms=aug_transforms(size=224))
blocks = 이미지블락, 카테고리블락
get_image_fils = 날것의 아이템을 얻는 방법
regular expression = 라벨된 아이템을 얻는 방법
random splitter = 아이템을 스플릿하는 방법
item_tfms, batch_tfms
=> pet 객체 자체는 비어있고, 데이터를 모으는 데 도움이 되는 function만 가지고 있다.
2. path = untar_data(URLs.PETS)
3. dls = pets.dataloaders(path/"images")
이렇게 data block API를 사용해서 데이터 로드 함수를 사용할 수 있다.
dls는 이전과 같이 DataLoaders다.
4.dls.show_batch(max_n = 9)
'이제는 사용하지 않는 공부방 > Artificial intelligence' 카테고리의 다른 글
| fastai vision tutorial/segmentation (1) | 2021.01.15 |
|---|---|
| fastai vision tutorial/multi-label classification (1) | 2021.01.15 |
| fastai vision tutorial/classifying breeds (0) | 2021.01.14 |
| fastai vision tutorial/single label classification (0) | 2021.01.14 |
| [이해] gpt - 3 (0) | 2021.01.10 |