tensorflow实现FCN_源代码
tensorflow实现FCN_源代码,可以在自己的电脑上跑程序
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-04-05 16:29 FCN.tensorflow-master
文件 42 2017-04-05 16:29 FCN.tensorflow-master.gitignore
文件 3108 2017-04-05 16:29 FCN.tensorflow-masterBatchDatsetReader.py
文件 9796 2017-04-05 16:29 FCN.tensorflow-masterFCN.py
文件 1074 2017-04-05 16:29 FCN.tensorflow-masterLICENSE
文件 4617 2017-04-05 16:29 FCN.tensorflow-masterREADME.md
文件 8480 2017-04-05 16:29 FCN.tensorflow-masterTensorflowUtils.py
文件 0 2017-04-05 16:29 FCN.tensorflow-master\__init__.py
目录 0 2017-04-05 16:29 FCN.tensorflow-masterlogs
目录 0 2017-04-05 16:29 FCN.tensorflow-masterlogsimages
文件 113332 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesImage_Cmaped.ipynb
文件 20876 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesconv_1_1_gradient.png
文件 16359 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesconv_4_1_gradient.png
文件 16447 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesconv_4_2_gradient.png
文件 16355 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesconv_4_3_gradient.png
文件 1928 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_0.png
文件 2214 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_1.png
文件 3875 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_2.png
文件 3628 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_3.png
文件 3490 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_4.png
文件 1439 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_5.png
文件 3062 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_6.png
文件 4309 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_7.png
文件 3027 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_8.png
文件 9716 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c0.png
文件 10398 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c1.png
文件 15633 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c2.png
文件 13852 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c3.png
文件 14244 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c4.png
文件 8791 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c5.png
文件 12713 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c6.png
............此处省略27个文件信息
“““
Code ideas from https://github.com/Newmu/dcgan and tensorflow mnist dataset reader
“““
import numpy as np
import scipy.misc as misc
class BatchDatset:
files = []
images = []
annotations = []
image_options = {}
batch_offset = 0
epochs_completed = 0
def __init__(self records_list image_options={}):
“““
Intialize a generic file reader with batching for list of files
:param records_list: list of file records to read -
sample record: {‘image‘: f ‘annotation‘: annotation_file ‘filename‘: filename}
:param image_options: A dictionary of options for modifying the output image
Available options:
resize = True/ False
resize_size = #size of output image - does bilinear resize
color=True/False
“““
print(“Initializing Batch Dataset Reader...“)
print(image_options)
self.files = records_list
self.image_options = image_options
self._read_images()
def _read_images(self):
self.__channels = True
self.images = np.array([self._transform(filename[‘image‘]) for filename in self.files])
self.__channels = False
self.annotations = np.array(
[np.expand_dims(self._transform(filename[‘annotation‘]) axis=3) for filename in self.files])
print (self.images.shape)
print (self.annotations.shape)
def _transform(self filename):
image = misc.imread(filename)
if self.__channels and len(image.shape) < 3: # make sure images are of shape(hw3)
image = np.array([image for i in range(3)])
if self.image_options.get(“resize“ False) and self.image_options[“resize“]:
resize_size = int(self.image_options[“resize_size“])
resize_image = misc.imresize(image
[resize_size resize_size] interp=‘nearest‘)
else:
resize_image = image
return np.array(resize_image)
def get_records(self):
return self.images self.annotations
def reset_batch_offset(self offset=0):
self.batch_offset = offset
def next_batch(self batch_size):
start = self.batch_offset
self.batch_offset += batch_size
if self.batch_offset > self.images.shape[0]:
# Finished epoch
self.epochs_completed += 1
print(“****************** Epochs completed: “ + str(self.epochs_completed) + “******************“)
# Shuffle the data
perm = np.arange(self.images.shape[0])
np.random.shuffle(perm)
self.images = self.images[perm]
self.annotations = self.annotations[perm]
# Start next epoch
start = 0
self.batch_offset = batch_size
end = self.batch_offset
return self.images[start:end] self.annotations[start:end]
def get_random_batch(self batch_size):
indexes = np.random.randint(0 self.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-04-05 16:29 FCN.tensorflow-master
文件 42 2017-04-05 16:29 FCN.tensorflow-master.gitignore
文件 3108 2017-04-05 16:29 FCN.tensorflow-masterBatchDatsetReader.py
文件 9796 2017-04-05 16:29 FCN.tensorflow-masterFCN.py
文件 1074 2017-04-05 16:29 FCN.tensorflow-masterLICENSE
文件 4617 2017-04-05 16:29 FCN.tensorflow-masterREADME.md
文件 8480 2017-04-05 16:29 FCN.tensorflow-masterTensorflowUtils.py
文件 0 2017-04-05 16:29 FCN.tensorflow-master\__init__.py
目录 0 2017-04-05 16:29 FCN.tensorflow-masterlogs
目录 0 2017-04-05 16:29 FCN.tensorflow-masterlogsimages
文件 113332 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesImage_Cmaped.ipynb
文件 20876 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesconv_1_1_gradient.png
文件 16359 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesconv_4_1_gradient.png
文件 16447 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesconv_4_2_gradient.png
文件 16355 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesconv_4_3_gradient.png
文件 1928 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_0.png
文件 2214 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_1.png
文件 3875 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_2.png
文件 3628 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_3.png
文件 3490 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_4.png
文件 1439 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_5.png
文件 3062 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_6.png
文件 4309 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_7.png
文件 3027 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_8.png
文件 9716 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c0.png
文件 10398 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c1.png
文件 15633 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c2.png
文件 13852 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c3.png
文件 14244 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c4.png
文件 8791 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c5.png
文件 12713 2017-04-05 16:29 FCN.tensorflow-masterlogsimagesgt_c6.png
............此处省略27个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)