-
大小: 519KB文件类型: .rar金币: 1下载: 0 次发布日期: 2021-05-22
- 语言: Python
- 标签: ImageCaption ShowAndTell 图像描述 CNN&
资源简介
完整工程案例:图像描述---Show and Tell: A Neural Image Caption Generator,基于Inception V3与LSTM实现图像描述,运行环境(Tensorflow1.0及以上,Python3.6)
代码片段和文件信息
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License Version 2.0 (the “License“);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing software
# distributed under the License is distributed on an “AS IS“ BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
“““Image-to-text model and training configurations.“““
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class ModelConfig(object):
“““Wrapper class for model hyperparameters.“““
def __init__(self):
“““Sets the default model hyperparameters.“““
# File pattern of sharded TFRecord file containing SequenceExample protos.
# Must be provided in training and evaluation modes.
# sharded TFRecord文件的命名模式
self.input_file_pattern = None
# Image format (“jpeg“ or “png“).
self.image_format = “jpeg“
# Approximate number of values per input shard. Used to ensure sufficient
# mixing between shards in training.
# 每个TFRecord文件的大约数量量
self.values_per_input_shard = 2300
# Minimum number of shards to keep in the input queue.
# 输入队列的最少shards数量
self.input_queue_capacity_factor = 2
# Number of threads for prefetching SequenceExample protos.
# 读线程数量
self.num_input_reader_threads = 1
# Name of the SequenceExample context feature containing image data.
# 包含图片数据的SequenceExample context feature名称
self.image_feature_name = “image/data“
# Name of the SequenceExample feature list containing integer captions.
# 包含caption word_id数据的SequenceExample feature list名称
self.caption_feature_name = “image/caption_ids“
# Number of unique words in the vocab (plus 1 for ).
# The default value is larger than the expected actual vocab size to allow
# for differences between tokenizer versions used in preprocessing. There is
# no harm in using a value greater than the actual vocab size but using a
# value less than the actual vocab size will result in an error.
# 字典尺寸
self.vocab_size = 12000
# Number of threads for image preprocessing. Should be a multiple of 2.
self.num_preprocess_threads = 4
# Batch size.
self.batch_size = 32
# File containing an Inception v3 checkpoint to initialize the variables
# of the Inception model. Must be provided when starting training for the
# first time.
# Inception v3的pre-trained模型文件,首次训练需要提供
self.inception_checkpoint_file = None
# Dimensions of Inception v3 input images.
# Inception v3的图片输出尺寸
self.image_height = 299
self.image_width = 2
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 455 2018-02-22 16:49 Show_And_Tell\.idea\C7_ShowAndTell_TF.iml
文件 185 2018-02-22 16:49 Show_And_Tell\.idea\misc.xm
文件 286 2018-02-22 16:49 Show_And_Tell\.idea\modules.xm
文件 27653 2018-02-24 01:22 Show_And_Tell\.idea\workspace.xm
文件 56 2017-06-13 19:53 Show_And_Tell\.spyproject\codest
文件 58 2017-06-13 19:53 Show_And_Tell\.spyproject\encoding.ini
文件 85 2017-06-13 19:53 Show_And_Tell\.spyproject\vcs.ini
文件 162 2017-06-13 19:53 Show_And_Tell\.spyproject\workspace.ini
文件 4507 2017-06-13 19:53 Show_And_Tell\configuration.py
文件 19858 2017-06-13 19:53 Show_And_Tell\data\build_mscoco_data.py
文件 68 2017-06-13 19:53 Show_And_Tell\data\inception_v3\download.txt
文件 28 2017-06-13 19:53 Show_And_Tell\data\install_nltk_data.py
文件 138 2017-06-13 19:53 Show_And_Tell\data\mscoco\download.txt
文件 81 2017-06-13 19:53 Show_And_Tell\data\mscoco\raw-data\annotations\download.txt
文件 140823 2014-08-16 09:35 Show_And_Tell\data\mscoco\raw-data\train2014\COCO_train2014_000000581860.jpg
文件 230425 2014-08-16 09:09 Show_And_Tell\data\mscoco\raw-data\val2014\COCO_val2014_000000000192.jpg
文件 0 2017-06-13 19:53 Show_And_Tell\data\mscoco\train\no_use.txt
文件 6798 2017-06-13 19:53 Show_And_Tell\evaluate.py
文件 7238 2017-06-13 19:53 Show_And_Tell\inference_utils\caption_generator.py
文件 5759 2017-06-13 19:53 Show_And_Tell\inference_utils\caption_generator_test.py
文件 6548 2017-06-13 19:53 Show_And_Tell\inference_utils\inference_wrapper_ba
文件 2814 2017-06-13 19:53 Show_And_Tell\inference_utils\vocabulary.py
文件 0 2017-06-13 19:53 Show_And_Tell\inference_utils\__init__.py
文件 6615 2017-06-13 19:53 Show_And_Tell\inference_utils\__pycache__\caption_generator.cpython-35.pyc
文件 6186 2018-02-23 09:10 Show_And_Tell\inference_utils\__pycache__\caption_generator.cpython-36.pyc
文件 6702 2017-06-13 19:53 Show_And_Tell\inference_utils\__pycache__\inference_wrapper_ba
文件 6496 2018-02-23 09:10 Show_And_Tell\inference_utils\__pycache__\inference_wrapper_ba
文件 2587 2017-06-13 19:53 Show_And_Tell\inference_utils\__pycache__\vocabulary.cpython-35.pyc
文件 2418 2018-02-23 09:10 Show_And_Tell\inference_utils\__pycache__\vocabulary.cpython-36.pyc
文件 153 2017-06-13 19:53 Show_And_Tell\inference_utils\__pycache__\__init__.cpython-35.pyc
............此处省略47个文件信息
评论
共有 条评论