I m new to tensorflow and python and I created a feed forward neural network with tensorflow that will help me to classify two groups of images. One group represents images of myself and another group represents images of a different person (I know convolutional network is better for this kind of problem but for the sake of learning I approached the FF network). All my images are stored in two separate directories. I
mトレーニング用のイメージをロードしてNNにフィードします。私の画像は272x272px RGBなので、入力層には73984個のニューロンが必要です。画像を読み込んでネットワーク経由でフィードすることができません。テンソルフローでカスタムイメージをロード
私はこのアプローチを使用してみました:
filename_queue = tf.train.string_input_producer(tf.train.match_filenames_once("images/train/resized/*.jpg"))
reader = tf.WholeFileReader()
filename, content = reader.read(filename_queue)
image = tf.image.decode_jpeg(content, channels=3)
image = tf.cast(image, tf.float32)
resized_image = tf.image.resize_images(image, [272, 272])
した後、私は実行時:
sess.run([optimizer], feed_dict={x: resized_image, y: 1})
I GEN
エラー "フィードの値がtf.Tensor対象にすることはできません"これを行うにはより良い方法がありますか、ここでは何が欠けていますか? ありがとう!
ありがとう。しかし、あなたのコードを実行するとき、私のネットワーク構造は、定義されたニューロンの数が実際の入力データと一致しないため、最初の層の合計を計算することができません。それでは、入力ニューロンの数はどうなるべきですか? –
あなたの入力テンソルを 'x = tf.placeholder(tf.float32、(272、272))'にし、PILを使ってグレースケールの画像を読み込みます 'gray_image = Image.open( 'image.png')。convert( ' LA ') 'と入力し、テンソル' x'に 'gray_image'を入力します。入力ニューロンはテンソル' x'の形に依存します – Jai
ありがとうございます! –