def __init__(self, filename=None, epochs=100, num_classes=1):
super().__init__()
with tf.name_scope('Dataset_Segmentation_Reader') as scope:
self.batch_size = tf.placeholder(tf.int32, name='Dataset_batch_size')
self.num_classes = num_classes
self.open_dataset(filename=filename, epochs=epochs)
self.mean_header_proto = proto.Image_set()
dataset_path, dataset_name = os.path.split(filename)
common_name, _ = os.path.splitext(dataset_name)
mean_file_path = os.path.join(dataset_path,common_name +'_header.proto')
with open(mean_file_path,"rb") as mean_header_file:
self.mean_header_proto.ParseFromString(mean_header_file.read())
self.flip_prob = tf.Variable(tf.random_uniform(shape=[1], minval=0, maxval=1, dtype=tf.float32),trainable=False)
self.crop_prob = tf.Variable(tf.random_uniform(shape=[1], minval=0, maxval=1, dtype=tf.float32),trainable=False)
self.crop_val = tf.Variable(tf.random_uniform(shape=[1], minval=1.1, maxval=1.25, dtype=tf.float32),trainable=False)
self.init_randoms = tf.group(self.flip_prob.initializer, self.crop_prob.initializer, self.crop_val.initializer)
self.sess = None
self.image_shape = [self.mean_header_proto.Image_headers.image_width, self.mean_header_proto.Image_headers.image_height, self.mean_header_proto.Image_headers.image_depth]
self.mask_shape = [self.mean_header_proto.Image_headers.image_width, self.mean_header_proto.Image_headers.image_height, 1]
self.images , self.masks , self.mask_weights, self.names = self.batch_inputs()
Dataset_reader_segmentation.py 文件源码
python
阅读 32
收藏 0
点赞 0
评论 0
评论列表
文章目录