CNN을 사용하여 개 번식 식별을 분류하려고합니다. 나는 이미지를 그레이 스케일로 변환하고 크기를 줄이기 위해 다시 스케일링했다. 그래서 지금은 그들을 numpy 배열에 추가하고 훈련을하려고합니다. 또한 Relu 활성화 기능을 사용하기 때문에 다중 계층 및 개 카테고리의 서로 다른 카테고리에 대한 범주 적 교차 엔트로피와 잘 작동합니다.이미지를 CNN 용 배열로 변환
def RescaleGrayscaleImg():
# iterate through the names of contents of the folder
for image_path in os.listdir(path):
# create the full input path and read the file
input_path = os.path.join(path, image_path)
# make image grayscale
img = io.imread(input_path)
img_scaled = rescale(img, 2.0/4.0)
GrayImg = color.rgb2gray(img_scaled)
# create full output path, 'example.jpg'
# becomes 'grayscaled_example.jpg', save the file to disk
fullpath = os.path.join(outPath, 'grayscaled_'+image_path)
misc.imsave(fullpath, GrayImg)
내가 배열로 이미지를 변환 할 방법 : 아래
그레이 스케일 다시 규모에 대한 코드? 각 열은 이미지일까요? 어떤 도움이 도움이 될 것입니다.
귀하의 질문은 무엇입니까? – Drop
어떤 패키지를 사용하고 있습니까? – James
나는 keras, scipy 및 skimage를 사용하고 있습니다. os –