代码拉取完成,页面将自动刷新
同步操作将从 chenmingling/MRI_Deep_learning 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import tensorflow as tf
import numpy as np
def _index_generator(N, batch_size, shuffle=True, seed=None):
batch_index = 0
total_batches_seen = 0
while 1:
if seed is not None:
np.random.seed(seed + total_batches_seen)
current_index = (batch_index * batch_size) % N
if current_index == 0:
index_array = np.arange(N)
if shuffle:
index_array = np.random.permutation(N)
if N >= current_index + batch_size:
current_batch_size = batch_size
batch_index += 1
else:
# current_batch_size = N - current_index
current_batch_size = batch_size
batch_index = 0
current_index = 0
if shuffle:
index_array = np.random.permutation(N)
total_batches_seen += 1
yield (index_array[current_index: current_index + current_batch_size],
current_index, current_batch_size)
def tfrecord_read(config,c_dim):
Filenames = config.tfrecord_train
crop_patch = config.image_size
Num_CHANNELS = c_dim
batch_size = config.Batch_Size
# output file name string to a queue
filename_queue = tf.train.string_input_producer([Filenames], num_epochs=None)
# create a reader from file queue
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
# get feature from serialized example
features = tf.parse_single_example(serialized_example,
features={
'low_CompI': tf.FixedLenFeature([], tf.string),
'CompI': tf.FixedLenFeature([], tf.string)
})
low = tf.decode_raw(features['low_CompI'], tf.float64)
low = tf.reshape(low, [crop_patch, crop_patch,Num_CHANNELS])
high = tf.decode_raw(features['CompI'], tf.float64)
high = tf.reshape(high, [crop_patch, crop_patch,Num_CHANNELS])
# ###for three echo
# low = tf.decode_raw(features['low_CompI'], tf.float64)
# low = tf.reshape(low, [crop_patch_FE, crop_patch_PE,6])
# low = low[:,:,3:6]
#
# high = tf.decode_raw(features['CompI'], tf.float64)
# high = tf.reshape(high, [crop_patch_FE, crop_patch_PE,6])
# high = high[:,:,3:6]
####
low_batch, high_batch = tf.train.shuffle_batch([low, high], batch_size, capacity=20000, min_after_dequeue=5000)
low_image = tf.reshape(low_batch,[batch_size,crop_patch, crop_patch,Num_CHANNELS])
high_image = tf.reshape(high_batch,[batch_size,crop_patch, crop_patch,Num_CHANNELS])
return low_image,high_image
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。