Skip to Content
PyTorch의 코더를 위한 AI 및 ML
book

PyTorch의 코더를 위한 AI 및 ML

by Laurence Moroney
July 2025
Beginner to intermediate
444 pages
7h 30m
Korean
O'Reilly Media, Inc.
Content preview from PyTorch의 코더를 위한 AI 및 ML

4장. PyTorch로 데이터 사용하기

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

이 책의 첫 세 장( )에서는 API를 통해 편리하게 번들로 제공되는 패션 MNIST 데이터 세트부터 다운로드하고 전처리해야 하는 ZIP 파일로 제공되는 이미지 기반 '말 또는 인간' 및 '개와 고양이' 데이터 세트까지 다양한 데이터를 사용해 모델을 훈련했습니다. 지금쯤이면 모델 학습에 필요한 데이터를 얻는 방법은 매우 다양하다는 사실을 깨달았을 것입니다.

그러나 많은 공개 데이터 세트는 모델 아키텍처를 고려하기 전에 다양한 도메인별 기술을 배워야 합니다. PyTorch 도메인과 torch.utils.data.Datasets 네임스페이스에서 제공되는 도구의 목표는 데이터를 수집하고 PyTorch 친화적인 API로 가져오는 모든 전처리 단계가 자동으로 수행되는 사용하기 쉬운 방식으로 데이터 세트를 노출하는 것입니다.

이 아이디어는 이미 2장에서 PyTorch가 패션 MNIST를 처리하는 방법( )에서 조금 보셨을 것입니다. 요약하자면, 데이터를 얻기 위해 해야 할 일은 이것뿐이었습니다:

train_dataset = datasets.FashionMNIST(root='./data', train=True,
                             download=True, transform=transform)
 

이 데이터 세트( )의 경우, 패션 MNIST에 대한 참조가 포함된 데이터 세트 객체를 얻기 위해 torchvision 라이브러리에서 임포트를 수행했습니다:

from torchvision import datasets

컴퓨터 비전 지향 데이터 세트이기 때문에, 이 데이터 세트가 torchvision 라이브러리에 있는 것이 당연합니다.

PyTorch에는 같은 방식으로 로드할 수 있는 다양한 데이터 유형의 다른 많은 데이터 세트가 있습니다. 여기에는 다음이 포함됩니다:

Vision

패션 MNIST는 앞서 언급한 torchvision 라이브러리에 있습니다. "이미지 분류" 기본 제공 데이터 세트 중 하나이지만 이미지 감지, 세그멘테이션, 광학 흐름, 스테레오 매칭, 이미지 페어링, 이미지 캡션, 비디오 분류, 비디오 예측 등과 같은 다른 시나리오를 위한 더 많은 데이터 세트가 있습니다.

텍스트

일반적인 텍스트 데이터 세트는 토치 텍스트 라이브러리에서 사용할 수 있습니다. 여기에 나열하기에는 너무 많지만 텍스트 분류, 언어 모델링, 기계 번역, 시퀀스 태깅, 질문과 답변, 비지도 학습을 위한 데이터 세트가 있습니다. 이에 대한 자세한 내용은 PyTorch 문서에서 확인할 수 있습니다. 이 라이브러리에는 데이터 세트에만 국한되지 않고 텍스트를 처리할 때 사용할 수 있는 많은 도우미 함수도 있습니다.

오디오

torchaudio 라이브러리에는 소리나 음성에 대한 머신 러닝 시나리오에서 사용할 수 있는 많은 데이터 세트가 포함되어 있습니다. 자세한 내용은 PyTorch 문서에서 확인할 수 있습니다.

모든 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

실무로 통하는 ML 문제 해결 with 파이썬

실무로 통하는 ML 문제 해결 with 파이썬

카일 갤러틴, 크리스 알본
AI 에이전트를 위한 메모리 관리

AI 에이전트를 위한 메모리 관리

Benjamin Labaschin, Jim Allen Wallace, Andrew Brookins, Manvinder Singh
생성형 AI를 위한 프롬프트 엔지니어링

생성형 AI를 위한 프롬프트 엔지니어링

제임스 피닉스, 마이크 테일러

Publisher Resources

ISBN: 9798341662605