import cv2 # For OpenCV modules (For Image I/O and Contour Finding) import numpy as np # For general purpose array manipulation import scipy . fftpack # For FFT2 #### imclearborder definition def imclearborder ( imgBW , radius ): # Given a black and white image, first find all of its contours imgBWcopy = imgBW . copy () contours , hierarchy = cv2 . findContours ( imgBWcopy . copy (), cv2 . RETR_LIST , cv2 . CHAIN_APPROX_SIMPLE ) # Get dimensions of image imgRows = imgBW . shape [ 0 ] imgCols = imgBW . shape [ 1 ] contourList = [] # ID list of contours that touch the border # For each contour... for idx in np . arange ( len ( contours )): # Get the i'th contour cnt = contours [ idx ] # Look at each point in the contour for pt in cnt : rowCnt = pt [ 0 ][ 1 ] colCnt = pt [ 0 ][ 0 ] # If this is within the radius of th...
파이토치 인스털:
답글삭제pip install http://download.pytorch.org/whl/cu80/torch-0.1.12.post2-cp27-none-linux_x86_64.whl
pip install torchvision
운영체계 및 파이썬 버전별 설치:
https://github.com/pytorch/pytorch
파이토치 설치여부 확인:
답글삭제python에서 import torch 가 먹어줘야 ...
# 분류망 통과에 클래스 갯수 조정 !
답글삭제model_ft.fc = nn.Linear(num_ftrs, 3)