2017-09-24 14 views
0

私は自分のresnet_v2_152を訓練するためにスリムなライブラリを使用していますし、tf.train.batch形状の不一致

それは私がバイト変換を使用してtfrecordsにデータを変換する際に問題を持っていないし、前処理後の画像配列データを取得するが、それは常に

のエラーを示して、私のnumpyの配列サイズが

[224, 224, 20] 

になることを意味します

INFO:tensorflow:Error reported to Coordinator: 
<class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, 
Shape mismatch in tuple component 0. Expected [224,224,3], got [224,224,20] 

OutOfRangeError (see above for traceback): FIFOQueue '_5_batch/fifo_queue' 
is closed and has insufficient elements (requested 1, current size 0) 

私はtf.traiを適用するとn.batch以下

は、私がtrain_image_classifier.pyでスタイルに従うことを主張してい

dataset = dataset_factory.get_dataset(
     FLAGS.datasetname, FLAGS.dataset, FLAGS.dataset_dir) 

    network_fn = nets_factory.get_network_fn(
     FLAGS.model_name, 
     num_classes=101, 
     is_training=True) 

    provider = slim.dataset_data_provider.DatasetDataProvider(
      dataset, 
      num_readers=4, 
      common_queue_capacity=20 * FLAGS.batch_size, 
      common_queue_min=10 * FLAGS.batch_size) 
    [image, label] = provider.get(['image', 'label']) 
    label -= 0 

    preprocessing_name = FLAGS.preprocessing_name or FLAGS.model_name 
    image_preprocessing_fn = preprocessing_factory.get_preprocessing(preprocessing_name, is_training=True) 

    eval_image_size = FLAGS.eval_image_size or network_fn.default_image_size 
    image = image_preprocessing_fn(image, eval_image_size, eval_image_size) 

    #Batch size is 1 
    images, labels = tf.train.batch(
      [image, label], 
      batch_size=FLAGS.batch_size, 
      num_threads=4, 
      capacity=5 * FLAGS.batch_size) 

    init_op = tf.group(tf.global_variables_initializer(), 
      tf.local_variables_initializer()) 

    #This part to see the fetched results 
    with tf.Session() as sess: 
     coord = tf.train.Coordinator() 
     threads = tf.train.start_queue_runners(coord=coord) 
     sess.run(init_op) 
     im = sess.run(images) 
     l = sess.run(label) 
     coord.request_stop() 
     coord.join(threads) 

、私のコードの一部であり、私はスリムなライブラリが提供するデフォルトのトレーニングパターンを使用したいからです。

本当にありがとうございます。おかげ

答えて

0

私はちょうど自分自身が経験してエラーを見つけるには、しかし

image.set_shape([output_height, output_width, channels]) 

vgg_preprocessing.py 

image.set_shape([output_height, output_width, 3]) 

内のコードを変更することにより、

の寸法proprocessed画像サイズによるものです誰かが私に答えることができれば、本当に感謝しています。ありがとうございました