資源簡介
FCN源代碼,這個代碼非常適合配合FCN論文進行學習,適合初學者閱讀學習深度學習網絡構建框架。

代碼片段和文件信息
“““
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??2018-05-17?17:00??FCN.tensorflow-master\
?????文件??????????42??2018-05-17?17:00??FCN.tensorflow-master\.gitignore
?????文件????????3108??2018-05-17?17:00??FCN.tensorflow-master\BatchDatsetReader.py
?????文件???????10219??2018-05-17?17:00??FCN.tensorflow-master\FCN.py
?????文件????????1074??2018-05-17?17:00??FCN.tensorflow-master\LICENSE
?????文件????????4617??2018-05-17?17:00??FCN.tensorflow-master\README.md
?????文件????????8480??2018-05-17?17:00??FCN.tensorflow-master\TensorflowUtils.py
?????文件???????????0??2018-05-17?17:00??FCN.tensorflow-master\__init__.py
?????目錄???????????0??2018-05-17?17:00??FCN.tensorflow-master\logs\
?????目錄???????????0??2018-05-17?17:00??FCN.tensorflow-master\logs\images\
?????文件??????113332??2018-05-17?17:00??FCN.tensorflow-master\logs\images\Image_Cmaped.ipynb
?????文件???????20876??2018-05-17?17:00??FCN.tensorflow-master\logs\images\conv_1_1_gradient.png
?????文件???????16359??2018-05-17?17:00??FCN.tensorflow-master\logs\images\conv_4_1_gradient.png
?????文件???????16447??2018-05-17?17:00??FCN.tensorflow-master\logs\images\conv_4_2_gradient.png
?????文件???????16355??2018-05-17?17:00??FCN.tensorflow-master\logs\images\conv_4_3_gradient.png
?????文件????????1928??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_0.png
?????文件????????2214??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_1.png
?????文件????????3875??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_2.png
?????文件????????3628??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_3.png
?????文件????????3490??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_4.png
?????文件????????1439??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_5.png
?????文件????????3062??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_6.png
?????文件????????4309??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_7.png
?????文件????????3027??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_8.png
?????文件????????9716??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_c0.png
?????文件???????10398??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_c1.png
?????文件???????15633??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_c2.png
?????文件???????13852??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_c3.png
?????文件???????14244??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_c4.png
?????文件????????8791??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_c5.png
?????文件???????12713??2018-05-17?17:00??FCN.tensorflow-master\logs\images\gt_c6.png
............此處省略27個文件信息
- 上一篇:12864字庫轉換器
- 下一篇:E1-471 BIOS升級
評論
共有 條評論