pytorch 4

(U-Net) pytorch로 Mirroring Extrapolate를 적용하여 학습하기

마지막 포스팅 후 한달만에 포스팅을 올리네요... 그동안 요것저것 너무 바빠서 구현을 해놓고 정리를 못했습니다... 지난번 U-Net 관련 포스팅에서 Mirroring Extrapolate를 구현해봤었는데 오늘은 Mirroring Extrapolate를 적용하여 U-Net 모델을 학습 시키는 부분을 포스팅하겠습니다. Mirroring Extrapolate 지난번 Mirroring Extrapolate는 아래와 같이 구현했었습니다. 더보기 import torch import numpy as np # tensor shape (1, x, y) def mirroring_Extrapolate(img): # mirroring 92 pixel x = img.shape[1] y = img.shape[2] np_img ..

AI 2022.05.18

(U-Net) 모델 분석 및 Pytorch로 구현 - 1

오늘은 Biomedical 분야 Semantic Segmentation을 위한 Convolutional network 인 U-Net에 대해 포스팅 하려고 합니다. 더보기 https://link.springer.com/content/pdf/10.1007/978-3-319-24574-4_28.pdf (U-Net: Convolutional Networks for Biomedical Image Segmentation Olaf Ronneberger, Philipp Fischer, and Thomas Brox) U-Net의 구조 - U-Net의 구조는 아래와 같습니다. U-Net은 'Contracting path', 'Bottle Neck', 'Expanding path'로 구성되어있습니다. '수축 단계(Contr..

AI 2022.04.12

(Pytorch) Pytorch를 이용하여 학습한 모델 저장/불러오는 방법

Pytorch를 이용하여 Model을 저장하는 방법은 아래와 같습니다. import torch import torch.nn as nn device = 'cuda' if torch.cuda.is_available() else 'cpu' # CNN_model 예시 class CNN_model(nn.Module): #tistory 코드 블럭의 문제인지 indent가 맞질 않습니다... def __init__(self): ... ... def forward(self, x): ... ... model = CNN_model() # torch.save(model, path_dict_file_name) # model 전체 저장 torch.save(model, 'model.pt') # state_dict = 학습 가능한..

python 2022.04.07

(Pytorch) Linear Regression, Multiple Linear Regression

Linear Regression / Multi Linear Regression을 공부하면서 정리한 자료입니다. 아주 기초적인 내용들 이지만 인공지능 분야 공부를 처음 시작하면서 중요하다고 생각한 부분들을 정리해보았습니다. 예제 코드는 Pytorch로 구현되어있습니다. //가설(Hypothesis) 수립, 비용 함수(Cost Function) //최적화 알고리즘(Optimization Algorithm) 중 경사하강법(Gradient Descent) 참고자료 출처 : https://ko.wikipedia.org/wiki/%EC%84%A0%ED%98%95_%ED%9A%8C%EA%B7%80 선형 회귀 - 위키백과, 우리 모두의 백과사전 독립변수 1개와 종속변수 1개를 가진 선형 회귀의 예 통계학에서, 선형 회..

AI 2022.04.06