私は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を使用しています –