资源简介
语义图像分割模型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
- 上一篇:反激式变换器的系统设计
- 下一篇:华工操作系统课程设计
相关资源
- 深度学习应用于OFDM系统
- 基于tensorflow深度学习的中文命名实体
- 吴恩达深度学习编程练习1-5课附答案
- 深度学习实战项目-利用RNN与LSTM网络原
- 深度学习框架-Tensorflow案例实战视频课
- 基于深度学习的高分辨率遥感图像识
- 一键配置arcgis pro2.5深度学习环境.ba
- 基于DBN模型的遥感图像分类
- TensorFlow深度学习算法原理与编程实战
- nndl-book神经网络与深度学习
- 神经网络深度学习+MNIST数字识别实验
- 论文研究 - 使用“切碎的图片&rd
- vgg16_weights_tf_dim_ordering_tf_kernels.h5
- Neural Network and Deep Learning中文版
- GGNN和GCN的几篇论文笔记
- 李飞飞深度学习中文笔记完整版
- cudnn-9.0-linux-x64-v7.2.1.38.tgz
- 吴恩达作业lr_utils文件及数据集
- 深度学习资料(2019最新版)(百度网
- 吴恩达深度学习第一课第三周编程作
- 贪心NLP集训营.txt
- Deep Learning in Remote Sensing A Review.pdf
- Deepnude.txt内含训练包
- yolov4.weights
- GoogleNews-vectors-negative300.bin.gz
- reuters.npz和reuters_word_index.json.zip
- 中文信息发展处理报告自然语言处理
- 商汤冠军代码
- deep learning for anomaly detection a survey(深
- LITS2017肝脏肿瘤分割挑战数据集地址百
评论
共有 条评论