본문 바로가기

분류 전체보기

(90)
git pull requests 사용법 github pull requests(PR) 하는 방법이 익숙치 않아서 정리! 1. 다른 사람이 진행중인 프로젝트에 pull requests를 해야할 때 - 타겟 프로젝트의 저장소를 자신의 저장소로 fork 한다(github repository 맨 위 오른쪽에 fork 누르기) - fork가 완료되면 자신의 계정에 새로운 저장소가 생긴다 2. clone, remote 설정 - 오른쪽에 "Clone or donwload" 버튼을 눌러 나타나는 url 복사하기 - 터미널 열기(mac기준, windows는 git bash를 열면 될 듯 하다) - 자신의 컴퓨터에 작업하기 위해 fork한 저장소를 로컬에 clone git clone https://github.com/ug-kim/CS231n.git - 로컬 저장..
Remote server에서 html file 열기, 확인하기 # pix2pixHD Remote ubuntu/linux 서버에서 index.html를 편집했는데, 이걸 웹브라우저에 띄워서 결과를 확인하고 싶었다. 로컬에서 만든 파일이면 바로 크롬과 같은 웹브라우저를 통해 열면 되지만, remote server의 경우에서는 어떻게 해야되는지 몰랐다. 아래의 코드를 remote server가 연결된 터미널에서 작동시키면 된다. cd /directory/where/html/is/present python -m SimpleHTTPServer 8000 # For python 2 python -m http.server 8000 # For python 3 보통 python 3를 현재 사용하므로, 세번재 코드를 터미널에 작성해주면 된다. 첫번째 코드는, 현재 index.html ..
PyTorch - UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead. # pix2pixHD debugging 에러로그: UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead. pyTorch에서 volatile을 더이상 지원하지 않으므로, with torch.no_grad()를 대신 이용하라는 Warning이 떴다. pytorch discuss에서 검색해 본 결과, before의 코드를 now의 코드로 고치면 된다고 한다. # before ... x = Variable(torch.randn(1), volatile=True) return x # now with torch.no_grad(): ... x = torch.randn(1) return x 출처: https:..
matplotlib.pyplot - subplot, 여러 개의 그래프 그리기 * 여러 개의 그래프 그리기 - subplot 이용 import numpy as np import matplotlib.pyplot as plt def f(t): return np.exp(-t) * np.cos(2*np.pi*t) def g(t): return np.sin(np.pi*t) t1 = np.arange(0.0, 5.0, 0.01) t2 = np.arange(0.0, 5.0, 0.01) plt.subplot(221) plt.plot(t1, f(t1)) plt.subplot(222) plt.plot(t2, g(t2)) plt.subplot(223) plt.plot(t1, f(t1), 'r-') plt.subplot(224) plt.plot(t2, g(t2), 'r-') plt.show() - pl..
Python matplotlib.pyplot - imshow(), show() * matplotlib.pyplot에서 imshow() vs show() - plt.show(): displays the figure (and enters the mainloop of whatever gui backend you're using). You shouldn't call it until you've plotted things and want to seef them displayed. figure를 보여준다. figure가 무조건 보여지게 되므로, displayed 되므로 plot을 그려서 나타내고 싶을 때에만 호출을 해야한다. - plt.imshow(): draws an image on the current figure (creating a figure is there isn't a curre..
딥러닝 프레임워크 - Tensorflow vs PyTorch * Deep Learning Framework Power Scores 2018 (2018.09.20) 구인구직 현황, 업계 사용량, 구글 검색량, 블로그/책/논문 등 출판량, Github 활동량을 조사하여 매긴 점수이다. * Keras 사용자 많고 수요도 크며 간편하다. Tensorflow 위에 얹어서 사용하는 high-level api이다. 맨 처음 딥러닝에 입문하는 입장에서는 Keras로 공부하는 것을 보통 추천한다. 그리고 keras를 이미 알고, 더 깊게 공부를 해보고 싶다면 tensorflow, pytorch 중 어떤 프레임워크를 선택할 지 고민하게 된다. * Tensorflow, PyTorch 차이 두개의 프레임워크의 차이는 딥러닝을 구현하는 패러다임이 다른 것이다. - Tensorflow: ..
opencv erode & dilate - Morphological Transformations * Erosion - 이미지를 침식시키는 것 - 이미지의 경계 부분을 침식시켜서 배경 이미지로 전환한다 - 흐릿한 경계부분을 배경으로 만든다고 생각하면 쉽다 - 작은 (nxn) kernel 창으로 이미지 전체를 훑으면서 kernel 창에 들어온 matrix 값을 변경한다 import cv2 import numpy as np kernel = np.ones((3, 3), np.uint8) erosion = cv2.erode(img, kernel, iterations=1) - img: erosion을 진행할 원본이미지 - kernel: erosion을 위한 kernel - iterations: erosion 반복 횟수 * Dilation - 이미지를 팽창시키는 것 - Erosion과 반대로 동작한다 impor..
Python - for문에서의 range, enumerate * Python에서의 for in 반복문 Python에서는 for in문 한가지 방식의 for문만 제공한다. for item in iterable ...iteratable code... - iterable 객체에는 list, dictionary, set, string, tuple, bytes 등이 있다. - range도 iterable하다. * range range(시작숫자, 종료숫자, step) - 시작숫자부터 종료숫자 바로 앞 숫자까지 컬렉션을 만든다. - 시작숫자와 step은 생략 가능하다. for i in range(5) print(i) 더보기 결과 0 1 2 3 4 - 파이썬에서 권장하지 않는 패턴 s = [1, 3, 5] for i in range(len(s)): print(s[i]) - 파이..