Language&Framework&Etc/Pytorch
Pytorch 데이터 로딩 방법
머리올리자
2021. 6. 7. 19:03
ImageFolder
이미지들이 폴더별로 클래스 형태로 정의되어 있을 때 사용할 수 있다.
아래의 pytorch 튜토리얼을 따라하다보면 hymenoptera_data를 이용하여 학습과 테스트를 진행한다.
Finetuning Torchvision Models — PyTorch Tutorials 1.2.0 documentation
Note Click here to download the full example code Finetuning Torchvision Models Author: Nathan Inkawhich In this tutorial we will take a deeper look at how to finetune and feature extract the torchvision models, all of which have been pretrained on the 100
pytorch.org
이 때 torchvision.datasets.ImageFolder 메서드를 사용하여 데이터를 로딩하는데
그 이유는 hymenoptera_data 데이터가 위 ImageFolder의 설명과 같이 데이터들의 폴더가 계층적으로 class 이름으로 정의되어 있기 때문이다.