91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

完整工程案例:深度學(xué)習(xí)Tensorflow 圖像語義分割(Image Segmentation)DeepLab基于ResNet101模型(tensorflow1.1以上、python3.5及以上)

資源截圖

代碼片段和文件信息

from?__future__?import?print_function
import?argparse
import?tensorflow?as?tf
import?numpy?as?np
from?deeplab_resnet?import?DeepLabResNetModel?ImageReader

IMG_MEAN?=?np.array((104.00698793?116.66876762?122.67891434)?dtype=np.float32)

DATA_DIRECTORY?=?‘./dataset‘
DATA_LIST_PATH?=?‘./dataset/val.txt‘
IGNORE_LABEL?=?255
NUM_CLASSES?=?21
NUM_STEPS?=?1449?#?Number?of?images?in?the?validation?set.
RESTORE_FROM?=?‘./ini_model/deeplab_resnet.ckpt‘


def?get_arguments():
????“““解析控制臺參數(shù).
????
????Returns:參數(shù)列表
????“““
????parser?=?argparse.ArgumentParser(description=“DeepLab?Network“)
????parser.add_argument(“--data-dir“?type=str?default=DATA_DIRECTORY
????????????????????????help=“Path?to?the?directory?containing?the?PASCAL?VOC?dataset.“)
????parser.add_argument(“--data-list“?type=str?default=DATA_LIST_PATH
????????????????????????help=“Path?to?the?file?listing?the?images?in?the?dataset.“)
????parser.add_argument(“--ignore-label“?type=int?default=IGNORE_LABEL
????????????????????????help=“The?index?of?the?label?to?ignore?during?the?training.“)
????parser.add_argument(“--num-classes“?type=int?default=NUM_CLASSES
????????????????????????help=“Number?of?classes?to?predict?(including?background).“)
????parser.add_argument(“--num-steps“?type=int?default=NUM_STEPS
????????????????????????help=“Number?of?images?in?the?validation?set.“)
????parser.add_argument(“--restore-from“?type=str?default=RESTORE_FROM
????????????????????????help=“Where?restore?model?parameters?from.“)
????return?parser.parse_args()


def?load(saver?sess?ckpt_path):
????‘‘‘加載已訓(xùn)練的權(quán)重參數(shù).
????
????Args:
??????saver:?TensorFlow?Saver?存儲器對象.
??????sess:?TensorFlow?session.
??????ckpt_path:?checkpoint權(quán)重參數(shù)文件路徑.
????‘‘‘?
????saver.restore(sess?ckpt_path)
????print(“Restored?model?parameters?from?{}“.format(ckpt_path))


def?main():
????“““主函數(shù):模型構(gòu)建和evaluate.“““
????args?=?get_arguments()
????
????#?構(gòu)建隊(duì)列協(xié)調(diào)器queue?coordinator
????coord?=?tf.train.Coordinator()
????
????#?加載讀取器reader.
????with?tf.name_scope(“create_inputs“):
????????reader?=?ImageReader(
????????????args.data_dir
????????????args.data_list
????????????None?#?無輸入尺寸設(shè)置.
????????????False?#?無隨機(jī)尺寸變換.
????????????False?#?無鏡像變換.
????????????args.ignore_label
????????????IMG_MEAN
????????????coord)
????????image?label?=?reader.image?reader.label
????#?添加Batch維度.
????image_batch?label_batch?=?tf.expand_dims(image?dim=0)?tf.expand_dims(label?dim=0)?

????#?構(gòu)建DeepLab-ResNet-101網(wǎng)絡(luò)
????net?=?DeepLabResNetModel({‘data‘:?image_batch}?is_training=False?num_classes=args.num_classes)

????#?設(shè)定要預(yù)加載的網(wǎng)絡(luò)權(quán)重參數(shù)
????restore_var?=?tf.global_variables()
????
????#?執(zhí)行預(yù)測.
????raw_output?=?net.layers[‘fc1_voc12‘]
????raw_output?=?tf.image.resize_bilinear(raw_output?tf.shape(image_batch)[1:3?])
????raw_output?=?tf.argmax(raw_output?dimension=3)
????pred?=?tf.expand_dims(raw_output?dim=3)?#?Create?4-d?tensor.
????
????#?計(jì)算mIoU
????pred?=?tf.reshape(pred?[-1?])
????gt?=?tf.reshape(label_batch?[-1?])
????weights?=?tf.cast(tf

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件????????455??2018-02-20?15:44??DeepLab-ResNet-101\.idea\C6_DeepLab_TF.iml

?????文件????????562??2018-02-20?16:30??DeepLab-ResNet-101\.idea\inspectionProfiles\Project_Default.xml

?????文件????????301??2018-02-20?16:30??DeepLab-ResNet-101\.idea\misc.xml

?????文件????????278??2018-02-20?15:44??DeepLab-ResNet-101\.idea\modules.xml

?????文件??????19898??2018-02-20?16:31??DeepLab-ResNet-101\.idea\workspace.xml

?????文件?????????56??2017-06-07?00:01??DeepLab-ResNet-101\.spyproject\codestyle.ini

?????文件?????????58??2017-06-07?00:01??DeepLab-ResNet-101\.spyproject\encoding.ini

?????文件?????????85??2017-06-07?00:01??DeepLab-ResNet-101\.spyproject\vcs.ini

?????文件????????425??2017-06-07?00:01??DeepLab-ResNet-101\.spyproject\workspace.ini

?????文件????????414??2018-02-20?23:59??DeepLab-ResNet-101\dataset\dataset下載說明.txt

?????文件?????698411??2017-06-07?00:01??DeepLab-ResNet-101\dataset\train.txt

?????文件??????95633??2017-06-07?00:01??DeepLab-ResNet-101\dataset\val.txt

?????文件???????7490??2018-02-20?15:45??DeepLab-ResNet-101\deeplab_resnet\image_reader.py

?????文件??????30632??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\model.py

?????文件??????12322??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\network.py

?????文件???????3320??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\utils.py

?????文件????????169??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\__init__.py

?????文件???????6632??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\__pycache__\image_reader.cpython-35.pyc

?????文件???????6169??2018-02-20?15:50??DeepLab-ResNet-101\deeplab_resnet\__pycache__\image_reader.cpython-36.pyc

?????文件??????14724??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\__pycache__\model.cpython-35.pyc

?????文件??????11219??2018-02-20?15:50??DeepLab-ResNet-101\deeplab_resnet\__pycache__\model.cpython-36.pyc

?????文件??????10135??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\__pycache__\network.cpython-35.pyc

?????文件???????9357??2018-02-20?15:50??DeepLab-ResNet-101\deeplab_resnet\__pycache__\network.cpython-36.pyc

?????文件???????3396??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\__pycache__\utils.cpython-35.pyc

?????文件???????3235??2018-02-20?15:50??DeepLab-ResNet-101\deeplab_resnet\__pycache__\utils.cpython-36.pyc

?????文件????????395??2017-06-07?00:01??DeepLab-ResNet-101\deeplab_resnet\__pycache__\__init__.cpython-35.pyc

?????文件????????405??2018-02-20?15:50??DeepLab-ResNet-101\deeplab_resnet\__pycache__\__init__.cpython-36.pyc

?????文件???????4382??2018-02-20?16:08??DeepLab-ResNet-101\evaluate.py

?????文件???????3214??2018-02-20?16:03??DeepLab-ResNet-101\inference.py

?????文件?????????93??2018-02-21?00:10??DeepLab-ResNet-101\ini_model\pretrained模型下載.txt

............此處省略15個(gè)文件信息

評論

共有 條評論

相關(guān)資源