본문 바로가기

Deep Learning

(13)
Pytorch DataLoader Argument DataLoaer - 데이터를 미니 배치 단위로 나누어서 제공하는 역할 DataLoader(dataset, batch_size=1, shuffle=False, sampler=None, batch_sampler=None, num_workers=0, collate_fn=None, pin_memory=False, drop_last=False, timeout=0, worker_init_fn=None, *, prefetch_factor=2, persistent_workers=False) - batch_size: Batch size 지정 - shuffle: 데이터를 섞어서 사용할 것인가의 여부 - sampler: 데이터 인덱스를 다루는 방법. 인덱스를 직접 다루기 때문에 shuffle 파라미터는 반드시 False여..
Pytorch Label Smoothing import torch.nn as nn class LabelSmoothingLoss(nn.Module): def __init__(self, classes, smoothing=0.0, dim=-1): super(LabelSmoothingLoss, self).__init__() self.confidence = 1.0 - smoothing self.smoothing = smoothing self.cls = classes self.dim = dim def forward(self, pred, target): pred = pred.log_softmax(dim=self.dim) # Cross Entropy 부분의 log softmax 미리 계산하기 with torch.no_grad(): # true_dist = pr..
GAN generator Loss function Deep Learning Quiz를 풀다가 이 문제를 틀린 게 너무 분하고 억울해서 티스토리로 다시 정리함. Original GAN Generator Loss function ↓ Amended GAN Generator Loss function Generator의 Original Loss function(GAN 논문의 Loss function) 실제로 사용 시, 초반에 gradient surface가 stable해서 generator가 어떠한 학습 signal도 받을 수 없다. 따라서, Amended된 Loss function을 적용하여 generator가 초반에 train이 용이하게 만들어준다.
Self-Supervised Learning *사용된 모든 영문 image의 출처는 cs231n 강의 자료입니다.* 1. Self-Supervised Introduction 2. Pre-text tasks 3. Constrastive Learning Self-Supervised Introduction Pre-training Pre-trained된 network의 feature들은 다양한 downstream task에서 사용됨 → supervision의 발달에 많은 영향 Pre-train on large superised dataset Collect a dataset of "supervised" images Train a Convolutional Network Getting "real" labels is difficult and expensive. ..
Generative Adversarial Networks *사용된 모든 영문 image의 출처는 cs231n 강의 자료입니다.* 1. GAN introduction 2. GAN 3. Variants of GAN GAN introduction Branches of ML Supervised Learning "how to classify" Unsupervised Learning "Learn the distribution of training data" Probability distribution Probability variable이 특정한 값을 가질 확률을 나타내는 함수 Discrete probability distribution Probability variable X의 개수를 정확히 셀 수 있을 때의 함수 Continuous probability distrib..
Attention Models *사용된 모든 영문 image의 출처는 cs231n 강의 자료입니다.* 1. Image Captioning 2. Image Captioning with Attention 3. Visual Question Anwsering Image Captioning Language model P(next word | previous word) Image Captioning Explain Images with Multimodal Recurrent Networks, Mao et al. CNN의 FC layer에서 vector 추출 RNN의 hidden state vector로 전달 (Wih * v) tanh(Wxh * x + Whh * h) → tanh(Wxh * x + Whh * h + Wih * v) Whole ima..
Convolution 연산 시, channel 수 / filter 수와 parameter 수 관계 정리 오늘 구름 Deep Learning Quiz를 풀다가 paramter 개수와 channel 개수, filter 개수 간의 관계를 다시 한번 정리하는 게 좋다고 생각해서 따로 업로드 ! Input data의 channel이 여러 개인 경우 paramter 개수 Input data가 여러 channel을 갖는 경우 filter는 각 channel을 순회하여 convolution 연산을 한 후, channel 별 feature map 생성. → 각 channel의 feature map을 합산하여 최종 feature map으로 반환. Filter가 여러 개인 경우 paramter 개수 하나의 convolution layer에 크기가 같은 여러 filter를 적용 시, feature map에는 filter 개수만..
Recurrent Neural Networks 1. Recurrent Neural Networks 2. LSTM & GRU Recurrent Nueral Networks Vanilla RNN → 연속적인 data 정보를 가지는 시계열 data 등 에 적합한 model 기본 Neural Networks 구조 one-to-one vanilla neural networks one-to-many e.g. Image Captioning (image → sequence of words) many-to-one e.g. Sentiment Classification (sequence of words → sentiment) many-to-many e.g. Machine Translation (seq of words → seq of words) many-to-many´..