资源简介
语义图像分割模型deeplab-v3的tensorflow源代码,欢迎下载

代码片段和文件信息
“““Converts PASCAL dataset to TFRecords file format.“““
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import io
import os
import sys
import PIL.Image
import tensorflow as tf
from utils import dataset_util
parser = argparse.ArgumentParser()
parser.add_argument(‘--data_dir‘ type=str default=‘./dataset/VOCdevkit/VOC2012‘
help=‘Path to the directory containing the PASCAL VOC data.‘)
parser.add_argument(‘--output_path‘ type=str default=‘./dataset‘
help=‘Path to the directory to create TFRecords outputs.‘)
parser.add_argument(‘--train_data_list‘ type=str default=‘./dataset/train.txt‘
help=‘Path to the file listing the training data.‘)
parser.add_argument(‘--valid_data_list‘ type=str default=‘./dataset/val.txt‘
help=‘Path to the file listing the validation data.‘)
parser.add_argument(‘--image_data_dir‘ type=str default=‘JPEGImages‘
help=‘The directory containing the image data.‘)
parser.add_argument(‘--label_data_dir‘ type=str default=‘SegmentationClassAug‘
help=‘The directory containing the augmented label data.‘)
def dict_to_tf_example(image_path
label_path):
“““Convert image and label to tf.Example proto.
Args:
image_path: Path to a single PASCAL image.
label_path: Path to its corresponding label.
Returns:
example: The converted tf.Example.
Raises:
ValueError: if the image pointed to by image_path is not a valid JPEG or
if the label pointed to by label_path is not a valid PNG or
if the size of image does not match with that of label.
“““
with tf.gfile.GFile(image_path ‘rb‘) as fid:
encoded_jpg = fid.read()
encoded_jpg_io = io.BytesIO(encoded_jpg)
image = PIL.Image.open(encoded_jpg_io)
if image.format != ‘JPEG‘:
raise ValueError(‘Image format not JPEG‘)
with tf.gfile.GFile(label_path ‘rb‘) as fid:
encoded_label = fid.read()
encoded_label_io = io.BytesIO(encoded_label)
label = PIL.Image.open(encoded_label_io)
if label.format != ‘PNG‘:
raise ValueError(‘Label format not PNG‘)
if image.size != label.size:
raise ValueError(‘The size of image does not match with that of label.‘)
width height = image.size
example = tf.train.Example(features=tf.train.Features(feature={
‘image/height‘: dataset_util.int64_feature(height)
‘image/width‘: dataset_util.int64_feature(width)
‘image/encoded‘: dataset_util.bytes_feature(encoded_jpg)
‘image/format‘: dataset_util.bytes_feature(‘jpeg‘.encode(‘utf8‘))
‘label/encoded‘: dataset_util.bytes_feature(encoded_label)
‘label/format‘: dataset_util.bytes_feature(‘png‘.encode(‘utf8‘))
}))
return example
def create_tf_record(output_filename
image_dir
label_dir
examples):
“““C
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\
文件 1299 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\.gitignore
文件 1070 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\LICENSE
文件 5024 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\README.md
文件 5256 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\create_pascal_tf_record.py
目录 0 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\dataset\
文件 127 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\dataset\sample_images_list.txt
文件 17472 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\dataset\test.txt
文件 126984 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\dataset\train.txt
文件 17388 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\dataset\val.txt
文件 14710 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\deeplab_model.py
文件 5299 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\evaluate.py
文件 2382 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\export_inference_graph.py
目录 0 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\images\
文件 198096 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\images\tensorboard_images.png
文件 136959 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\images\tensorboard_miou.png
文件 3529 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\inference.py
文件 10494 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\train.py
目录 0 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\utils\
文件 0 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\utils\__init__.py
文件 4950 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\utils\dataset_util.py
文件 9308 2018-04-30 06:51 tensorflow-deeplab-v3-plus-master\utils\preprocessing.py
- 上一篇:反激式变换器的系统设计
- 下一篇:华工操作系统课程设计
相关资源
- 广联达6.0写锁包,2020年11月最新
- 机器学习个人笔记完整版v5.2-A4打印版
- 深度学习卷积神经网络可检测和分类
- GAN对抗式生成网络的应用:从图片上
- [en]深度学习[Deep Learning: Adaptive Compu
- 李宏毅-机器学习(视频2017完整)
- 吴恩达深度学习第一课第四周作业及
- 机器学习深度学习 PPT
- 麻省理工:深度学习介绍PPT-1
- Wikipedia机器学习迷你电子书之四《D
- 深度学习在遥感中的应用综述
- 深度学习数据集标注
- 深度学习算法实践源码-吴岸城
- 李宏毅深度学习ppt
- SSD目标检测算法论文-英文原版
- 台湾李宏毅教授深度学习讲义 pdf
- 基于深度学习实现人脸识别包含模型
- 深度学习与PyTorch-代码和PPT.zip
- 测试工程源码1(一种基于深度学习的
- 深度学习: MNIST的数据集
- 《深度学习》 高清版本中文PDFIan Go
- 今日头条38万条新闻数据标题
- 深度学习算法论文
- TensorFlow Machine Learning Cookbook+无码高清
- Hands-On Machine Learning with Scikit-Learn an
- Neural Networks:Tricks of the Trade+无码高清
- 基于深度学习的图像超分辨率算法论
- 人工智能初步学习总结
- 迁移学习简明手册
- 基于深度学习的软件源码漏洞预测综
评论
共有 条评论