일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- MariaDB
- Docker
- Web Programming
- 논문 리뷰
- 파이썬
- 데이터베이스
- paper review
- 딥러닝
- 텐서플로우
- GUI
- 웹 프로그래밍
- 파이토치
- 그래픽 유저 인터페이스
- pytorch
- Django
- FLASK
- POD
- Python
- Tkinter
- kubernetes
- 장고
- 컴퓨터 비전
- numpy
- k8s
- yaml
- Computer Vision
- tensorflow
- vue.js
- OpenCV
- Deep Learning
- Today
- Total
목록Python/Pytorch (6)
Maxima's Lab

안녕하세요, 오늘은 Distributed Data Parallel (DDP) 사용하는 방법에 대해서 알아보겠습니다. Distributed Data Parallel (DDP)는 PyTorch에서 멀티 GPU 학습을 효율적으로 처리하는 병렬 학습 프레임워크입니다. 각 GPU가 자신의 모델 복사본을 가지고 데이터를 나누어 학습하므로써, Backward 시에만 Gradient를 서로 통신하여 동기화합니다. 다음은, DPP를 활용하는 코드 예시 입니다. import osimport torchimport torch.nn as nnimport torch.optim as optimimport torch.distributed as distfrom torch.nn.parallel import DistributedDataP..
안녕하세요, 오늘은 Anomaly Detection의 개념에 대해 알아보고 Pytorch 프레임워크를 활용해서 코드를 구현해보는 방법에 대해서 알아보도록 하겠습니다. Anomaly Detection : 이상 감지는 이미지 또는 일련의 이미지 내에서 비정상적이거나 비정상적인 패턴, 개체 또는 이벤트를 식별하느 프로세스를 의미합니다. 이어서, Anomaly Detection Task에서 Reconstruction Loss Functions으로 자주 사용하는 Loss Functions에 대해서 알아보도록 하겠습니다. Mean Squared Error (MSE) : 예측 값과 실제 값 사이의 제곱 차이의 평균을 측정하는 손실 함수 입니다. 이는 재구성된 이미지와 원본 이미지의 차이를 계산하기 위해 자주 사용됩니..

안녕하세요, 오늘은 Pytorch 내 torchvision.transforms에 대해 알아보도록 하겠습니다. transforms 내 알아볼 내용들은 다음과 같습니다. CenterCrop RandomCrop Resize RandomVerticalFlip & RandomHorizontalFlip 아래의 Original Image에 대해 적용해보도록 하겠습니다. 위의 이미지는 (256, 256, 3) Shape을 지니고 있는 이미지입니다. 먼저, (200, 200, 3) Shape로 Center Crop을 적용해보겠습니다. import torch import torchvision.transforms as transforms transforms = transforms.Compose( [transforms.ToT..
안녕하세요, 오늘은 Pytorch 내 Tensor와 Cuda 사용법에 대해서 알아보도록 하겠습니다. Tensor 및 Cuda 사용법에 대한 내용은 다음과 같습니다. torch.tensor() torch.as_tensor() size() dtype device unsqueeze() & squeeze() permute() & transpose() 다음은 Tensor와 Cuda를 사용하기 전 Cuda와 관련된 상태를 알아보는 코드입니다. import torch print(torch.cuda.is_available()) print(torch.cuda.current_device()) print(torch.cuda.device_count()) print(torch.cuda.get_device_name(0)) 위의 ..
안녕하세요, 오늘은 Pytorch 내 TensorDataset과 DataLoader에 대해 알아보도록 하겠습니다. 코드를 구현하기 위한 과정은 다음과 같습니다. 임의의 numpy.narray 타입의 데이터 셋 생성(train_x, train_y) numpy.narray 타입의 데이터 셋을 torch.Tensor 타입으로 변환 TensorDataset을 이용하여 데이터 셋 구성 DataLoader를 이용하여 Batch로 구성 위의 과정에 대해 전체 코드는 다음과 같습니다. import torch from torch.utils.data import TensorDataset, DataLoader import numpy as np train_x = np.random.randint(0, 256, (64, 3, 2..
안녕하세요, 오늘은 Pytorch 내 DataLoader (데이터 셋 불러오기)에 대해서 알아보겠습니다. torchvision.datasets 내 데이터 셋 예시들 중 CIFAR10를 활용해서 진행해보도록 하겠습니다. import torch import torchvision import torchvision.transforms as transforms import numpy as np transform = transforms.Compose( [transforms.ToTensor()]) train_dataset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform) print(train_data..