본문 바로가기

반응형

Data-science/deep learning

(87)
g_ema?, EMA 구하는 공식 g_ema? stylegan2 repository에 나오는 약어... 처음엔 몰랐는데 하다보니 알게됐다. 학습하면서 생성된 generator 들의 가중치들의 이동 평균 최근에 학습된 가중치일수록 더 많이 반영되도록 한다. exponetial moving average 대충 전체 학습한 가중치 개수에다가 스무딩 정도만큼 현재 값을 반영하게 하고, 남은 부분은 이전 값을 반영하게 하는 것. 7개 가중치가 있으면 이전 이동평균( 6개 가중치의 이동평균 )과 7번째 가중치를 비중을 달리해서 더 한다. 그런데 최근 것이 더 반영이 많이 되나 보다. www.investopedia.com/ask/answers/122314/what-exponential-moving-average-ema-formula-and-how-e..
[pytorch] stylegan2 pretrained model load error 에러가 났다. pretrained model 못쓰는건가... 좌절중일때! repository에 정답이 있었다. god hub! RuntimeError: Error(s) in loading state_dict for Generator: Missing key(s) in state_dict: "noises.noise_0", "noises.noise_1", "noises.noise_2", "noises.noise_3", "noises.noise_4", "noises.noise_5", "noises.noise_6", "noises.noise_7", "noises.noise_8", "noises.noise_9", "noises.noise_10", "noises.noise_11", "noises.noise_12".
[pytorch] stylegan1 freezeD 이해 및 코드 분석 stylegan2에 freezeD를 적용하길 원한다. 이에 앞서 stylegan1에 쓰인 freezeD 코드를 이해하고 분석해본다. 왜냐하면 pytorch 구현은 stylegan 1에 대한 freezeD만 있기 때문이다. freezeD는 custom한 데이터셋? 혹은 다른 도메인의 데이터셋으로 학습할 때 Discriminator의 특정 layer를 freezing 시키는 방법이다. 이게 효과적인 이유는 gan에서 FFHQ를 통해 학습한 Discriminator는 훌륭한 진짜/가짜 판별자이고, 이를 transfer learning으로 그대로 이용할 수 있기 때문이다. 이 판별자의 처음 몇 layer를 고정시키고 후 단의 layer만을 학습시키는 방식이다. 이는 기존의 전체 layer를 미세 조정하는 fin..
[pytorch] stylegan2 freezeD 적용 stylegan2에 freezeD를 적용하길 원한다. study-grow.tistory.com/entry/pytorch-stylegan1-freezeD-%EC%BD%94%EB%93%9C-%EB%B6%84%EC%84%9D [pytorch] stylegan1 freezeD 이해 및 코드 분석 stylegan2에 freezeD를 적용하길 원한다. 이에 앞서 stylegan1에 쓰인 freezeD 코드를 이해하고 분석해본다. 왜냐하면 pytorch 구현은 stylegan 1에 대한 freezeD만 있기 때문이다. freezeD는 custom한 데이터셋.. study-grow.tistory.com 그에 앞서 1에 쓰인 freezeD를 분석했고, 이제 2에 적용할 차례다. 끝 단의 5, 6 그리고 final lay..
[pytorch] requires grad 확인. named_parameters()루프를 돌면서. parameter의 requires_grad 변수를 확인해보면 된다. True일 경우 해당 가중치는 학습한다. False일 경우 frozen, 얼려져있다. 학습하지 않는다.
[pytorch] stylegan1 Vs stylegan2 Discriminator 차이 stylegan1 Discriminator 뜯어보기 progression.0.conv1.0.conv.bias progression.0.conv1.0.conv.weight_orig progression.0.conv2.1.weight progression.0.conv2.1.bias progression.1.conv1.0.conv.bias progression.1.conv1.0.conv.weight_orig progression.1.conv2.1.weight progression.1.conv2.1.bias progression.2.conv1.0.conv.bias progression.2.conv1.0.conv.weight_orig progression.2.conv2.1.weight progression.2.c..
FusedLeakyRelu? import os import torch from torch import nn from torch.nn import functional as F from torch.autograd import Function from torch.utils.cpp_extension import load module_path = os.path.dirname(__file__) fused = load( "fused", sources=[ os.path.join(module_path, "fused_bias_act.cpp"), os.path.join(module_path, "fused_bias_act_kernel.cu"), ], ) class FusedLeakyReLUFunctionBackward(Function): @staticm..
[pytorch] nn.module의 zero_grad VS optimizer의 zero_grad의 차이 tutorials.pytorch.kr/beginner/pytorch_with_examples.html 예제로 배우는 파이토치(PyTorch) — PyTorch Tutorials 1.6.0 documentation 예제로 배우는 파이토치(PyTorch) Author: Justin Johnson번역: 박정환 이 튜토리얼에서는 PyTorch 의 핵심적인 개념을 예제를 통해 소개합니다. 본질적으로, PyTorch에는 2가지 주요한 특징이 있습니다: NumPy tutorials.pytorch.kr optimizer 객체에서 zero_grad()를 call하는 것. 이건 역전파를 하기 전에, 모든 변화도를 0으로 만들어준 거다. 그런데 nn.module 과 같이 모델 객체에도 zero_grad()를 똑같이 call..

728x90
반응형