Home > other >  How to solve the tf. Train. Batch only generates a batch data problem
How to solve the tf. Train. Batch only generates a batch data problem

Time:10-26

Using tensorflow training online download good flowers when data sets to the problem, according to the following code after operation with sess. The run () to obtain batch data and print, showing only one batch (10) data, ask the great spirit how to solve the
 keys_to_features={
'image/encoded: tf. FixedLenFeature ([], default_value=', dtype=tf. The string,),
'image/format: tf. FixedLenFeature ([], default_value=' https://bbs.csdn.net/topics/jpeg ', dtype=tf. The string),
'image/class/label: tf FixedLenFeature ([], tf int64, default_value=https://bbs.csdn.net/topics/0),
'image/height: tf. FixedLenFeature ([], tf int64, default_value=https://bbs.csdn.net/topics/0),
'image/width: tf. FixedLenFeature ([], tf int64, default_value=https://bbs.csdn.net/topics/0)
}

Items_to_handlers={
'image' : slim. Tfexample_decoder. Image (image_key='image/encoded, format_key=' image/format, channels=3),
'label' : slim. Tfexample_decoder. Tensor (' image/class/label, shape=[]),
'height, slim. Tfexample_decoder. Tensor (' image/height, shape=[]),
'width' : slim. Tfexample_decoder. Tensor (' image/width, shape=[])
}
Decoder=slim. Tfexample_decoder. TFExampleDecoder (keys_to_features items_to_handlers)

Labels_to_names=None
Items_to_descriptions={
'image' : 'An image with shape image_shape.',
'label' : 'A single integer between 0 and 9.',
'height' : 'float number',
'width' : 'float number'}

The dataset=slim. The dataset. A dataset (
Data_sources=tfrecord_path,
Reader=tf TFRecordReader,
Decoder=decoder,
The num_samples=1000,
Items_to_descriptions=None,
Num_classes=num_classes,
)

The provider=slim. Dataset_data_provider. DatasetDataProvider (dataset=dataset,
Num_readers=4,
This into a False shuffle=False, # later every batch of generating the same
Common_queue_capacity=256,
Common_queue_min=128,
Seed=None)

[image, label, height, width]=provider. Get ([' image ', 'label' and 'height' and 'width'])

Resized_image=tf squeeze (tf) image) resize_bilinear ([image], size=[resize_height resize_width]))

Images, labels=tf. Train. Batch ([resized_image, label], batch_size=bsize, allow_smaller_final_batch=True, num_threads=1, capacity=5 * bsize)
  • Related