Giter Site home page Giter Site logo

kerlomz / captcha_trainer Goto Github PK

View Code? Open in Web Editor NEW
2.9K 70.0 818.0 16.94 MB

[验证码识别-训练] This project is based on CNN/ResNet/DenseNet+GRU/LSTM+CTC/CrossEntropy to realize verification code identification. This project is only for training the model.

License: Apache License 2.0

Python 100.00%
captcha-recognition tensorflow-tutorials ocr tensorflow

captcha_trainer's Introduction

1. 项目介绍

基于深度学习的图片验证码的解决方案 - 该项目能够秒杀字符粘连重叠/透视变形/模糊/噪声等各种干扰情况,足以解决市面上绝大多数复杂的验证码场景,目前也被用于其他OCR场景。

该项目基于 TensorFlow 1.14 开发,旨在帮助中小企业或个人用户快速构建图像分类模型并投入生产环境使用,降低技术应用门槛。

面向算法工程师:提供了可拓展的结构支持,允许通过源码灵活方便的添加自己设计的网络结构及其他组件。

面向零基础用户:有需求?但是不会编程?时间就是金钱,学习成本太高我想白嫖。它简直为你而生!

面向需求频繁者:同样的类型的需求一天10个,它的复用程度让您无需一份代码一个需求,一套服务全部搞定。

编译版下载地址: https://github.com/kerlomz/captcha_trainer/releases/


其使用的网络结构主要包含三部分,从下至上依次为:

> 输入OP: **input** , 输出OP: **dense_decoded**

卷积层:从输入图像中提取特征序列;

循环层,预测从卷积层获取的特征序列的标签(真实值)分布;

转录层,把从循环层获取的标签分布通过去重整合等操作转换成最终的识别结果;

1. 可视化模型配置

为每个图像分类任务创建一个独立的项目,每个项目拥有完全独立的管理空间,方便多任务切换和管理。全程无需修改一行代码,根据模板生成模型配置,生成的配置文件可直接用模型部署服务。

本项目对应的部署服务支持同时部署多套模型,模型支持热拔插,版本迭代等,业务层可拓展颜色提取,算术运算等常见的验证码解决方案。详情可以移步:https://github.com/kerlomz/captcha_platform

2. 特性

  1. 目前支持Windows平台的GPU编译版,无需安装环境,0基础建模。
  2. 项目化管理,适合容易被任务优先级安排的程序员们,同一份代码,不同的项目,随心切换,互不干扰。
  3. 新增样本集无需重新打包,可直接增量添加新的样本集,每个训练任务支持加载多个TFRecords文件。
  4. 解除循环层依赖的必须性,支持CNN5/ResNet50/DenseNet+CrossEntropy的怀旧组合模式。
  5. 提供智能建议性配置功能,选择样本源路径时可根据样本特性自动推荐字符集,设置尺寸,标签数等。
  6. 支持不定宽[-1, HEIGHT]的网络输入,在样本尺寸多样的场景下自动按比例缩放。
  7. 支持训练中的数据增广,如:指定范围的二值化/模糊/旋转/椒盐噪声等。

3. 模板参数介绍

# - requirement.txt  -  GPU: tensorflow-gpu, CPU: tensorflow
# - If you use the GPU version, you need to install some additional applications.
# MemoryUsage: 显存占用率,推荐0.6-0.8之间
System:
  MemoryUsage: {MemoryUsage}
  Version: 2

# CNNNetwork: [CNN5, ResNet50, DenseNet] 
# RecurrentNetwork: [CuDNNBiLSTM, CuDNNLSTM, CuDNNGRU, BiLSTM, LSTM, GRU, BiGRU, NoRecurrent]
# - 推荐配置为 不定长问题:CNN5+GRU ,定长:CNN5/DenseNet/ResNet50
# UnitsNum: RNN层的单元数 [16, 64, 128, 256, 512] 
# - 神经网络在隐层中使用大量神经元,就是做升维,将纠缠在一起的特征或概念分开。
# Optimizer: 优化器算法 [AdaBound, Adam, Momentum]
# OutputLayer: [LossFunction, Decoder]
# - LossFunction: 损失函数 [CTC, CrossEntropy] 
# - Decoder: 解码器 [CTC, CrossEntropy] 
NeuralNet:
  CNNNetwork: {CNNNetwork}
  RecurrentNetwork: {RecurrentNetwork}
  UnitsNum: {UnitsNum}
  Optimizer: {Optimizer}
  OutputLayer:
    LossFunction: {LossFunction}
    Decoder: {Decoder}


# ModelName: 模型名/项目名,同时也对应编译后的pb模型文件名
# ModelField: 模型处理的数据类型,目前只支持图像 [Image, Text]
# ModelScene: 模型处理的场景类型,目前只支持分类场景 [Classification]
# - 目前只支持 “图像分类” 这一种场景.
Model:
  ModelName: {ModelName}
  ModelField: {ModelField}
  ModelScene: {ModelScene}

# FieldParam 分为 Image, Text 两种,不同数据类型时可配置的参数不同,目前只提供 Image 一种。
# ModelField 为 Image 时:
# - Category: 提供默认的内置解决方案:
# -- [ALPHANUMERIC(含大小写英文数字), ALPHANUMERIC_LOWER(小写英文数字), 
# -- ALPHANUMERIC_UPPER(大写英文数字),NUMERIC(数字), ALPHABET_LOWER(小写字母), 
# -- ALPHABET_UPPER(大写字母), ALPHABET(大小写字母), 
# -- ALPHANUMERIC_CHS_3500_LOWER(小写字母数字混合中文常用3500)]
# - 或者可以自定义指定分类集如下(中文亦可):
# -- ['Cat', 'Lion', 'Tiger', 'Fish', 'BigCat']
# - Resize: 重置尺寸,对应网络的输入: [ImageWidth, ImageHeight/-1, ImageChannel]
# - ImageChannel: 图像通道,3为原图,1为灰度 [1, 3]
# - 为了配合部署服务根据图片尺寸自动选择对应的模型,由此诞生以下参数(ImageWidth,ImageHeight):
# -- ImageWidth: 图片宽度.
# -- ImageHeight: 图片高度.
# - MaxLabelNum: 该参数在使用CTC损失函数时将被忽略,仅用于使用交叉熵作为损失函数/标签数固定时使用
# ModelField 为 Text 时:
# - 该类型暂时不支持
FieldParam:
  Category: {Category}
  Resize: {Resize}
  ImageChannel: {ImageChannel}
  ImageWidth: {ImageWidth}
  ImageHeight: {ImageHeight}
  MaxLabelNum: {MaxLabelNum}
  OutputSplit: {OutputSplit}


# 该配置应用于数据源的标签获取.
# LabelFrom: 标签来源,目前只支持 从文件名提取 [FileName, XML, LMDB]
# ExtractRegex: 正则提取规则,对应于 从文件名提取 方案 FileName:
# - 默认匹配形如 apple_20181010121212.jpg 的文件.
# - 默认正则为 .*?(?=_.*\.)
# LabelSplit: 该规则仅用于 从文件名提取 方案:
# - 文件名中的分割符形如: cat&big cat&lion_20181010121212.png,那么分隔符为 &
# - The Default is null.
Label:
  LabelFrom: {LabelFrom}
  ExtractRegex: {ExtractRegex}
  LabelSplit: {LabelSplit}


# DatasetPath: [Training/Validation], 打包为TFRecords格式的训练集/验证集的本地绝对路径。
# SourcePath:  [Training/Validation], 未打包的训练集/验证集源文件夹的本地绝对路径。
# ValidationSetNum: 验证集数目,仅当未配置验证集源文件夹时用于系统随机抽样用作验证集使用。
# - 该选项用于懒人训练模式,当样本极度不均衡时建议手动设定合理的验证集。
# SavedSteps: 当 Session.run() 被执行一次为一步(1.x版本),保存训练过程的步数,默认为100。
# ValidationSteps: 用于计算准确率,验证模型的步数,默认为每500步验证一次。
# EndAcc: 结束训练的条件之准确率 [EndAcc*100]% 到达该条件时结束任务并编译模型。
# EndCost: 结束训练的条件之Cost值 EndCost 到达该条件时结束任务并编译模型。
# EndEpochs: 结束训练的条件之样本训练轮数 Epoch 到达该条件时结束任务并编译模型。
# BatchSize: 批次大小,每一步用于训练的样本数量,不宜过大或过小,建议64。
# ValidationBatchSize: 验证集批次大小,每个验证准确率步时,用于验证的样本数量。
# LearningRate: 学习率 [0.1, 0.01, 0.001, 0.0001] fine-tuning 时选用较小的学习率。
Trains:
  DatasetPath:
    Training: {DatasetTrainsPath}
    Validation: {DatasetValidationPath}
  SourcePath:
    Training: {SourceTrainPath}
    Validation: {SourceValidationPath}
  ValidationSetNum: {ValidationSetNum}
  SavedSteps: {SavedSteps}
  ValidationSteps: {ValidationSteps}
  EndAcc: {EndAcc}
  EndCost: {EndCost}
  EndEpochs: {EndEpochs}
  BatchSize: {BatchSize}
  ValidationBatchSize: {ValidationBatchSize}
  LearningRate: {LearningRate}

# 以下为数据增广的配置
# Binaryzation: 该参数为 list 类型,包含二值化的上界和下界,值为 int 类型,参数为 -1 表示未启用。
# MedianBlur: 该参数为 int 类型,参数为 -1 表示未启用。
# GaussianBlur: 该参数为 int 类型,参数为 -1 表示未启用。
# EqualizeHist: 该参数为 bool 类型。
# Laplace: 该参数为 bool 类型。
# WarpPerspective: 该参数为 bool 类型。
# Rotate: 该参数为大于 0 的 int 类型,参数为 -1 表示未启用。
# PepperNoise: 该参数为小于 1 的 float 类型,参数为 -1 表示未启用。
# Brightness: 该参数为 bool 类型。
# Saturation: 该参数为 bool 类型。
# Hue: 该参数为 bool 类型。
# Gamma: 该参数为 bool 类型。
# ChannelSwap: 该参数为 bool 类型。
# RandomBlank: 该参数为大于 0 的 int 类型,参数为 -1 表示未启用。
# RandomTransition: 该参数为大于 0 的 int 类型,参数为 -1 表示未启用。
DataAugmentation:
  Binaryzation: {DA_Binaryzation}
  MedianBlur: {DA_MedianBlur}
  GaussianBlur: {DA_GaussianBlur}
  EqualizeHist: {DA_EqualizeHist}
  Laplace: {DA_Laplace}
  WarpPerspective: {DA_WarpPerspective}
  Rotate: {DA_Rotate}
  PepperNoise: {DA_PepperNoise}
  Brightness: {DA_Brightness}
  Saturation: {DA_Saturation}
  Hue: {DA_Hue}
  Gamma: {DA_Gamma}
  ChannelSwap: {DA_ChannelSwap}
  RandomBlank: {DA_RandomBlank}
  RandomTransition: {DA_RandomTransition}
  
# 以下为预处理的配置 
# Binaryzation: 该参数为 list 类型,包含二值化的上界和下界,值为 int 类型,参数为 -1 表示未启用。
# ReplaceTransparent: 使用白色替换透明背景
# HorizontalStitching: 水平拆分拼接,适用于上下分层
# ConcatFrames: 根据帧索引列表水平合并帧
# BlendFrames: 根据帧索引列表融合帧内容
Pretreatment:
  Binaryzation: {Pre_Binaryzation}
  ReplaceTransparent: {Pre_ReplaceTransparent}
  HorizontalStitching: {Pre_HorizontalStitching}
  ConcatFrames: {Pre_ConcatFrames}
  BlendFrames: {Pre_BlendFrames}

2. 基本操作流程介绍

2.1 GPU环境

注意:如果你使用笔者编译好的版本,只需更新显卡驱动至最新,可以无视2.1、2.2的环境安装步骤。

如果你准备使用GPU训练,请先更新显卡驱动并安装CUDA和cuDNN,可以了解下官方测试过的编译版本对应: https://www.tensorflow.org/install/install_sources#tested_source_configurations

Github上可以下载到第三方编译好的TensorFlow的WHL安装包:

CUDA下载地址:https://developer.nvidia.com/cuda-downloads

cuDNN下载地址:https://developer.nvidia.com/rdp/form/cudnn-download-survey (需要注册账号)

笔者使用的版本为:CUDA11.4.1 + cuDNN8.2 + TensorFlow 2.8-DEV,此种组合可使用pip安装无需下载第三方编译的whl安装包。

pip install tf-nightly-gpu==2.8.0.dev20211021

2.2 Python环境

  1. 安装Python 3.8 环境(包含pip),可用conda替换。

  2. 安装虚拟环境 virtualenv pip3 install virtualenv

  3. 为该项目创建独立的虚拟环境:

    virtualenv -p /usr/bin/python3 venv # venv is the name of the virtual environment.
    cd venv/ # venv is the name of the virtual environment.
    source bin/activate # to activate the current virtual environment.
    cd captcha_trainer # captcha_trainer is the project path.
  4. 安装本项目的依赖列表:pip install -r requirements.txt

  5. 建议开发者们使用 PyCharm 作为Python IDE

2.3 采集标注样本

笔者这个项目的初衷其实是爬虫遭遇各种验证码,验证码无处不在且需求堆积如山,由此,懒诞生了创造力。

图像分类问题,以验证码为例,用深度学习来解决无非就是训练标注样本。那么样本从何而来?这就是建模流程的第一步。

采集样本: 一般可以通过抓包得到对方网站的接口请求及参数,通过构造请求采集样本。

标注样本: 标注渠道是有一定讲究的,一般采用多个渠道组合,因为现在大多是机器识别,导致保存过滤下来的正确样本可能存在特征缺失,举个例子,这个渠道把所有的b都识别成a,为了避免这种情况建议通过多个渠道组合采集样本,以此保证图片特征的覆盖率。

验证样本:如何提交验证?比如如何从登录页面中获取样本,其实大多时候后端设计都会为了避免过多恶意的数据库访问而先验证验证码的准确性,例如可以提交明显错误的信息,输入不存在的用户名,将对方网站返回的“用户名不存在”作为验证码正确性的判断条件,当验证码错误时如返回“验证码错误”,则验证样本的流程便成立了。

2.2 打包样本

本框架喂数据只接收从TFRecords中读取,也就是样本需要先打包成TFRecords文件格式,样本打包的源目录路径关联的参数为:

SourcePath:
    Training: {SourceTrainPath}
    Validation: {SourceValidationPath}

打包完的TFRecords文件的路径关联的参数为:

DatasetPath:
  Training: {DatasetTrainsPath}
  Validation: {DatasetValidationPath}

项目配置好之后 ,可通过两种方法进行打包

  • make_dataset.py 打包

    运行python make_dataset.py 项目名 方式打包,则需要加启动参数指定训练项目,请确保 projects/项目名 路径下存放各个项目的 model.yaml 配置文件。

  • app.py训练:

    在界面中选择欲使用的网络结构,输入项目名并[回车]或者点击空白处 创建一个新项目 或者 选择一个已有的项目 ,通过 [Browse] 选择训练集路径 后,点击 [Make Dataset] 开始打包 ,中途若终止进程文件将损坏,需要手动至项目路径中删除其未打包完成的样本集,[Validation Path] 可以不选,如若不选,系统将根据 [Validation Set Num] 配置的参数自动分配该数量的验证集,

注意:手动配置训练集的时候请保证验证集的随机性以及特征覆盖率,如若不明笔者所语,请勿手动配置

2.3 设置训练配置

使用app.py运行的界面化配置生成器在选择样本源的时候会自动进行基本的配置如:[Resize],[Size],[Label Num] 等。至于 [Label Num] 只在使用CrossEntropy为损失函数时有效。

Resize的使用

因为网络为多标签而设计,卷积层的输出 outputs 经过了以下变换:

Reshape([label_num, int(outputs_shape[1] / label_num)])

为了保证运算 int(outputs_shape[1] / label_num) 能够取得正整数,也意味着他们之间存在某种关系,对于CNN5+Cross Entropy的网络结构,Conv2D层的步长皆为1,那么需要保证以下关系成立:

$$ mod(\frac{输入宽度\times输入高度\times输出层参数}{池化步长^{池化层数}\times标签数})= 0 $$

所以有时候需要Resize网络输入的Shape

网络 池化步长^池化层数 输出层参数
CNN5 16 64
CNNX 8 64
ResNet50 16 1024
DenseNet 32 2048

例如使用CNN5+CrossEntropy组合,则输入宽度与输入高度需要满足: $$ mod(\frac{输入宽度\times输入高度\times64}{16\times标签数})= 0 $$ 同理如果CNN5+RNN+CTC,卷积层之后的输出经过以下变换:

Reshape([-1, outputs_shape[2] * outputs_shape[3]])

原输出(batch_size, outputs_shape[1], outputs_shape[2], outputs_shape[3]),RNN层的输入输出要求为(batch, timesteps, num_classes),为了接入RNN经过以上操作,那么又引出一个Time Step的概念,所以timesteps的值也是 outputs_shape[1],而CTC Loss要求的输入为 [batch_size, frames, num_labels],若是 timesteps 小于标签数则无法计算损失,也就无法找损失函数中找到极小值,梯度何以下降。timesteps 最合理的值一般是标签数的2倍,为了达到目的,也可以通过Resize网络输入的Shape解决,一般情况timesteps直接关联于图片宽度。

ExtractRegex 参数:

正则匹配,请各位采集样本的时候,尽量和我给的示例保持一致吧,正则问题请谷歌,如果是为1111.jpg这种命名的话,这里提供了一个批量转换的代码:

import re
import os
import hashlib

# 训练集路径
root = r"D:\TrainSet\***"
all_files = os.listdir(root)

for file in all_files:
    old_path = os.path.join(root, file)
    
    # 已被修改过忽略
    if len(file.split(".")[0]) > 32:
        continue
    
    # 采用标注_文件md5码.图片后缀 进行命名
    with open(old_path, "rb") as f:
        _id = hashlib.md5(f.read()).hexdigest()
    new_path = os.path.join(root, file.replace(".", "_{}.".format(_id)))
    
    # 重复标签的时候会出现形如:abcd (1).jpg 这种形式的文件名
    new_path = re.sub(" \(\d+\)", "", new_path)
    print(new_path)
    os.rename(old_path, new_path)

2.4 开始训练

  • trains.py训练:

    如果单独调用 python trains.py 项目名 方式训练,则需要加启动参数指定训练项目,请确保 projects/项目名 路径下存放各个项目的 model.yaml 配置文件。

  • app.py训练:

    在界面中配置好参数后,点击 [Start Training] 开始训练,中途若需终止训练可点击 [Stop] 停止,若是未达到结束条件而终止任务,可以手动点击 [Compile] 编译。

3. 项目结构

|-- fc										// 全连接层
|   |-- cnn.py									// 卷积层的全连接
|   `-- rnn.py									// 循环层的全连接
|-- logs									// Tensor Board 日志
|-- network									// 神经网络实现
|   |   |-- CNN.py								// CNN5/CNNX
|   |   |-- DenseNet.py								// DenseNet
|   |   |-- GRU.py								// GRU/BiBRU/GRUcuDNN
|   |   |-- LSTM.py								// LSTM/BiLSTM/LSTMcuDNN
|   |   |-- ResNet.py								// ResNet50
|   |   `-- utils.py								// 各种网络 block 的实现
|-- optimizer									// 优化器
|   |   `-- AdaBound.py								// AdaBound 优化算法实现
|-- projects									// 项目存放路径
|   `-- demo									// 项目名
|       |-- dataset 								// 数据集存放
|       |-- model								// 训练过程记录存放
|       `-- out									// 模型编译输出
|           |-- graph								// 存放编译pb模型
|           `-- model								// 存放编译yaml配置
|-- resource									// 资源:图标,README 所需图片
|-- tools
|   `-- package.py								// PyInstaller编译脚本
|-- utils
|   |-- data.py									// 数据加载工具类
|   `-- sparse.py								// 稀疏矩阵处理工具类
|-- app.py									// GUI配置生成器
|-- app.spec									// PyInstaller编译配置文件
|-- category.py									// 内置类别模块
|-- config.py									// 配置实体模块
|-- constants.py								// 各种枚举类
|-- core.py									// 神经网络模块
|-- decoder.py									// 解码器
|-- encoder.py									// 编码器
|-- exception.py								// 异常模块
|-- loss.py									// 损失函数
|-- make_dataset.py								// 样本集打包
|-- model.template								// 配置模板
|-- predict_testing.py								// 预测测试
|-- pretreatment.py								// 预处理
|-- requirements.txt								// 项目依赖
|-- trains.py									// 训练模块
`-- validation.py								// 验证模块

4. 注意事项

  1. 如何使用CPU训练:

    本项目默认安装TensorFlow-GPU版,建议使用GPU进行训练,如需换用CPU训练请替换 requirements.txt 文件中的tensorflow-gputensorflow,其他无需改动。

  2. 参数修改:

    切记,[ModelName] 是绑定一个模型的唯一标志,如果修改了训练参数如:[Resize],[Category],[CNNNetwork],[RecurrentNetwork],[UnitsNum] 这类影响计算图的参数,需要删除model路径下的旧文件,重新训练,或者使用新的 [ModelName] 重新训练,否则默认作为断点续练。

    在可视化版本中,[Neural Net] 组中的配置,除了学习率 [Learning Rate] 和图片尺寸 [Size] 设置以外,任何改动都需要先 [Reset History]

7. 附言

问题一: 有人问,验证码是什么,简单送上一幅图,验证码早已不是Tesseract能解决的时代了,为什么选择验证码作为图像分类的入门,其一因为随处可见,对于深度学习样本不可或缺,验证码的采集难度及成本低。其二,现在的验证码越来越难也越来越具备研究价值,因为它本为安全而生,各种人为的干扰甚至于机器学习对抗等等,也在不断促进图像识别的发展。

问题二: 部署识别也需要GPU吗?我的答案是,完全没必要。理想中是用GPU训练,使用CPU部署识别服务,部署如果也需要这么高的成本,那还有什么现实意义和应用场景呢,实测CNN5网络,我的i7-9700k大约1-15ms之间 (图片尺寸60x60-200x200)。

此项目以研究学习为目的,禁止用于非法用途,本项目永久开源,笔者将持续维护此项目,并逐步扩展其成为一个完善的深度学习框架。

如有需要欢迎进群交流,落魄算法,在线答疑:

图像识别技术:857149419 (群已满)/ 934889548(2群)

数据矿工:778910502

思知人工智能:90780053

captcha_trainer's People

Contributors

kerlomz avatar ljun20160606 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

captcha_trainer's Issues

channel配置使得Start Training出现的问题

使用的编译版GUI
当我使用默认的Channel配置值 3 时,Start Training会出现
ValueError: zero-size array to reduction operation maximum which has no identity
而将Channel改为1时则正常进行。
请问这是什么问题?

这个项目要怎么停呢?

感谢分享,现在这项目已经跑了28000步了,acc大概在80左右,现在是要等他达到配置的准确率才会停吗?
image
image

请问如何准备自己的训练集和测试集?

请问如何准备自己的训练集与测试集,是否需要将验证码中的每个字符单独切割出来?
还是说每张图片可以整体输入,是不是需要将每个图片用验证码字符命名?
请问能否给一个简单的例子?
谢谢

每隔500次训练,内存占用突增

每隔500次系统卡顿一次,采用cpu训练

2019-04-05 16:54:36.524458: W tensorflow/core/framework/allocator.cc:124] Allocation of 614400000 exceeds 10% of system memory.
2019-04-05 16:55:43.043568: W tensorflow/core/framework/allocator.cc:124] Allocation of 614400000 exceeds 10% of system memory.
2019-04-05 16:55:50.748391: W tensorflow/core/framework/allocator.cc:124] Allocation of 614400000 exceeds 10% of system memory.
0 4 4 [1, 5, 2, 2] [1, 5, 2, 2]
1 4 4 [5, 6, 4, 5] [5, 6, 4, 5]
2 4 4 [9, 9, 10, 7] [9, 9, 10, 7]
3 4 4 [6, 2, 4, 1] [6, 2, 4, 1]
4 4 4 [1, 6, 10, 2] [1, 6, 10, 2]
Epoch: 3, Step: 1500, Accuracy = 0.973, Cost = 0.1232, Time = 89.143, LearningRate: 0.009999999776482582, LastBatchError: 0.006666666828095913

将yaml中Category改为'NUMERIC'后报错

Traceback (most recent call last):
sdk = muggle_ocr.SDK(model_type=muggle_ocr.ModelType.Captcha, conf_path='myyaml.yaml')
File "/project_path/venv/lib/python3.7/site-packages/muggle_ocr/sdk.py", line 1036, in init
self.predict(init_img)
File "/project_path/venv/lib/python3.7/site-packages/muggle_ocr/sdk.py", line 1045, in predict
result = self.interface.predict_batch(image_batch, None)
File "/project_path/venv/lib/python3.7/site-packages/muggle_ocr/sdk.py", line 826, in predict_batch
output_split
File "/project_path/venv/lib/python3.7/site-packages/muggle_ocr/sdk.py", line 850, in predict_func
expression += self.decode_maps(model.category)[i]
KeyError: 13

保持默认的ALPHANUMERIC可以正常执行

raise ValueError("Can't load save_path when it is None.")

WARNING:tensorflow:ParseError: 1:24 : 'model_checkpoint_path: None': Expected string but found: 'None'
WARNING:tensorflow:./projects/demo-CNNX-NoRecurrent-H64-CrossEntropy-C3/model/checkpoint: Checkpoint ignored
INFO:tensorflow:None
WARNING:tensorflow:ParseError: 1:24 : 'model_checkpoint_path: None': Expected string but found: 'None'
WARNING:tensorflow:./projects/demo-CNNX-NoRecurrent-H64-CrossEntropy-C3/model/checkpoint: Checkpoint ignored
Traceback (most recent call last):
File "/Users/da/code_world/git/captcha_trainer/app.py", line 1332, in training_task
self.current_task.train_process()
File "/Users/da/code_world/git/captcha_trainer/trains.py", line 258, in train_process
self.compile_graph(accuracy)
File "/Users/da/code_world/git/captcha_trainer/trains.py", line 76, in compile_graph
saver.restore(predict_sess, tf.train.latest_checkpoint(self.model_conf.model_root_path))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1274, in restore
raise ValueError("Can't load save_path when it is None.")
ValueError: Can't load save_path when it is None.

tf-gpu 1.10.0 报错module 'tensorflow.sparse' has no attribute 'to_dense'

你好,kerlomz,我使用您的代码跑的时候,framework.py中的类GraphOCR中的 self.dense_decoded = tf.sparse.to_dense(self.decoded[0], default_value=-1, name="dense_decoded")这行代码报错,AttributeError: module 'tensorflow.sparse' has no attribute 'to_dense'。请问您确定在TF_GPU 1.10.0这个版本可以运行您的程序?
谢谢~

想咨询下这个结果说明,感谢大神帮忙解答

INFO:tensorflow:Step: 9200 Time: 13.979 sec/batch, Cost = 0.00025, 160x60-BatchSize: 128
INFO:tensorflow:Step: 9300 Time: 13.981 sec/batch, Cost = 0.00025, 160x60-BatchSize: 128
INFO:tensorflow:Step: 9400 Time: 13.941 sec/batch, Cost = 0.00025, 160x60-BatchSize: 128
INFO:tensorflow:Step: 9500 Time: 14.033 sec/batch, Cost = 0.00024, 160x60-BatchSize: 128
INFO:tensorflow:Step: 9600 Time: 14.009 sec/batch, Cost = 0.00024, 160x60-BatchSize: 128
INFO:tensorflow:Step: 9700 Time: 13.956 sec/batch, Cost = 0.00024, 160x60-BatchSize: 128
INFO:tensorflow:Step: 9800 Time: 14.029 sec/batch, Cost = 0.00023, 160x60-BatchSize: 128
INFO:tensorflow:Step: 9900 Time: 14.055 sec/batch, Cost = 0.00023, 160x60-BatchSize: 128
INFO:tensorflow:Step: 10000 Time: 14.234 sec/batch, Cost = 0.00023, 160x60-BatchSize: 128
INFO:tensorflow:0 7 7 [13, 11, 26, 30, 13, 18, 11] [13, 11, 26, 30, 13, 18, 11] --> ['c', 'a', 'p', 't', 'c', 'h', 'a'] ['c', 'a', 'p', 't', 'c', 'h', 'a']
INFO:tensorflow:1 7 7 [13, 11, 26, 30, 13, 18, 11] [13, 11, 26, 30, 13, 18, 11] --> ['c', 'a', 'p', 't', 'c', 'h', 'a'] ['c', 'a', 'p', 't', 'c', 'h', 'a']
INFO:tensorflow:2 7 7 [13, 11, 26, 30, 13, 18, 11] [13, 11, 26, 30, 13, 18, 11] --> ['c', 'a', 'p', 't', 'c', 'h', 'a'] ['c', 'a', 'p', 't', 'c', 'h', 'a']
INFO:tensorflow:3 7 7 [13, 11, 26, 30, 13, 18, 11] [13, 11, 26, 30, 13, 18, 11] --> ['c', 'a', 'p', 't', 'c', 'h', 'a'] ['c', 'a', 'p', 't', 'c', 'h', 'a']
INFO:tensorflow:4 7 7 [13, 11, 26, 30, 13, 18, 11] [13, 11, 26, 30, 13, 18, 11] --> ['c', 'a', 'p', 't', 'c', 'h', 'a'] ['c', 'a', 'p', 't', 'c', 'h', 'a']
ERROR:tensorflow:[]
INFO:tensorflow:Epoch: 1358, Step: 10000, Accuracy = 1.0000, Cost = 0.00023, Time = 15.367 sec/batch, LearningRate: 0.0009800000116229057
INFO:tensorflow:CNN Output: (?, ?, 256)
INFO:tensorflow:./model/myfirsttest.model-10000
INFO:tensorflow:Restoring parameters from ./model/myfirsttest.model-10000
INFO:tensorflow:Froze 40 variables.
Converted 40 variables to const ops.
INFO:tensorflow:Total Time: 33.93611812591553 sec.
INFO:tensorflow:Training completed.

训练时频繁出现与内存有关的报错

Windows 10, Python 3.6.7 64-bit, CUDA 9.0, tensorflow-gpu 1.11, CNN 分支(因为 LSTM 对于我的训练数据而言似乎效果不好)
内存 8GB, 显存 6GB.
训练数据集是 5 万张 240x60 大小的 JPG 图片.

一般是执行 python .\trains.py 一段时间后就报错退出.报错信息有这三种情况.
1

Traceback (most recent call last):
  File ".\trains.py", line 185, in <module>
    train_process()
  File ".\trains.py", line 79, in train_process
    batch_x, batch_y = get_next_batch(64, False)  # 64
  File ".\trains.py", line 115, in get_next_batch
    batch_x = np.zeros([batch_size, IMAGE_HEIGHT * IMAGE_WIDTH])
MemoryError

2
几屏幕的 CUDA 和 tensorflow 的报错信息,大概说的是内存分配失败 (原文是 Memory, 指的是内存还是显存?), 就像这样:

2018-11-04 01:54:01.061494: E tensorflow/stream_executor/cuda/cuda_driver.cc:806] failed to allocate 2.00G (2147483648 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory

3
没有报错信息,执行到这里之后就直接退出了:

Session Initializing...
Loading history archive...
Initialized.
---------------------------------------------------------------------------------

但是我在任务管理器中看到,在报错退出之前,内存和显存的占用率都没有占满.这是怎么回事?应该怎么修复呢?

什么时候支持tf2.0啊

最近在kaggle跑这个,但是kaggle上默认是cuda10,tf2.0,tf降到1.6不兼容cuda10,通过简单粗暴的方法将当前代码转到tf2.0上
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
结果还是一堆报错,跑不通,求救。。。

关于输入图片shape的问题

  1. 模型的图片输入shape不应该是[batch_size, image_width, image_height, image_channel]吗?但是 core.py 里面的采用ctc loss function 时,模型输入shape却是[None, image_height, image_channel]?是我配置错了吗?
  2. 数据从 tfrecords 里面读取出来是一个长串的字节码吧,读取时也没有做任何处理就直接输入模型,不用reshape图片原来大小?或者转换成图片向量?
  3. 现在无法执行训练了,一直报错:(0) Invalid argument: Not enough time for target transition sequence (required: 6, available: 5)11You can turn this error into a warning by using the flag ignore_longer_outputs_than_inputs

大佬我报这个错误之后,程序就停了,好像是gpu内存的问题,你能帮忙看看么?

W T:\src\github\tensorflow\tensorflow\core\common_runtime\bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 538.33MiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.

W T:\src\github\tensorflow\tensorflow\core\common_runtime\bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.02GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.

E T:\src\github\tensorflow\tensorflow\stream_executor\cuda\cuda_driver.cc:936] failed to allocate 378.60M (396990720 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY

E T:\src\github\tensorflow\tensorflow\stream_executor\cuda\cuda_driver.cc:936] failed to allocate 378.60M (396990720 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY

i got this error when training

INFO:tensorflow:Step: 400 Time: 0.846 sec/batch, Cost = 1.53476572, BatchSize: 64, Shape[1]: 18
INFO:tensorflow:Step: 500 Time: 0.792 sec/batch, Cost = 1.08882499, BatchSize: 64, Shape[1]: 18
2019-12-23 15:55:03.028956: W tensorflow/core/common_runtime/bfc_allocator.cc:314] Allocator (GPU_0_bfc) ran out of memory trying to allocate 615.23MiB (rounded to 645120000). Current allocation summary follows.
2019-12-23 15:55:03.035027: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (256): Total Chunks: 128, Chunks in use: 127. 32.0KiB allocated for chunks. 31.8KiB in use in bin. 15.6KiB client-requested in use in bin.
2019-12-23 15:55:03.042178: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (512): Total Chunks: 43, Chunks in use: 43. 21.5KiB allocated for chunks. 21.5KiB in use in bin. 17.8KiB client-requested in use in bin.
2019-12-23 15:55:03.047903: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (1024): Total Chunks: 1, Chunks in use: 1. 1.3KiB allocated for chunks. 1.3KiB in use in bin. 1.0KiB client-requested in use in bin.
2019-12-23 15:55:03.053329: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (2048): Total Chunks: 4, Chunks in use: 4. 14.0KiB allocated for chunks. 14.0KiB in use in bin. 13.5KiB client-requested in use in bin.
2019-12-23 15:55:03.060581: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (4096): Total Chunks: 5, Chunks in use: 4. 31.8KiB allocated for chunks. 24.0KiB in use in bin. 24.0KiB client-requested in use in bin.
2019-12-23 15:55:03.068945: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (8192): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.076905: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (16384): Total Chunks: 9, Chunks in use: 8. 175.0KiB allocated for chunks. 157.0KiB in use in bin. 145.5KiB client-requested in use in bin.
2019-12-23 15:55:03.084378: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (32768): Total Chunks: 5, Chunks in use: 4. 160.0KiB allocated for chunks. 128.0KiB in use in bin. 128.0KiB client-requested in use in bin.
2019-12-23 15:55:03.091372: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (65536): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.098174: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (131072): Total Chunks: 17, Chunks in use: 16. 3.11MiB allocated for chunks. 2.90MiB in use in bin. 2.77MiB client-requested in use in bin.
2019-12-23 15:55:03.105264: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (262144): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.112143: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (524288): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.118394: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (1048576): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.125309: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (2097152): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.131695: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (4194304): Total Chunks: 1, Chunks in use: 0. 7.61MiB allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.139277: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (8388608): Total Chunks: 1, Chunks in use: 0. 8.00MiB allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.145077: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (16777216): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.151896: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (33554432): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.159025: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (67108864): Total Chunks: 0, Chunks in use: 0. 0B allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.165895: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (134217728): Total Chunks: 1, Chunks in use: 0. 128.00MiB allocated for chunks. 0B in use in bin. 0B client-requested in use in bin.
2019-12-23 15:55:03.172894: I tensorflow/core/common_runtime/bfc_allocator.cc:764] Bin (268435456): Total Chunks: 4, Chunks in use: 1. 1.96GiB allocated for chunks. 615.23MiB in use in bin. 615.23MiB client-requested in use in bin.
2019-12-23 15:55:03.179905: I tensorflow/core/common_runtime/bfc_allocator.cc:780] Bin for 615.23MiB was 256.00MiB, Chunk State:
2019-12-23 15:55:03.183511: I tensorflow/core/common_runtime/bfc_allocator.cc:786] Size: 317.34MiB | Requested Size: 247.61MiB | in_use: 0 | bin_num: 20, prev: Size: 615.23MiB | Requested Size: 615.23MiB | in_use: 1 | bin_num: -1, next: Size: 144.0KiB | Requested Size: 144.0KiB | in_use: 1 | bin_num: -1
2019-12-23 15:55:03.193406: I tensorflow/core/common_runtime/bfc_allocator.cc:786] Size: 512.00MiB | Requested Size: 307.62MiB | in_use: 0 | bin_num: 20
2019-12-23 15:55:03.198517: I tensorflow/core/common_runtime/bfc_allocator.cc:786] Size: 558.68MiB | Requested Size: 307.62MiB | in_use: 0 | bin_num: 20, prev: Size: 144.0KiB | Requested Size: 144.0KiB | in_use: 1 | bin_num: -1
2019-12-23 15:55:03.205800: I tensorflow/core/common_runtime/bfc_allocator.cc:793] Next region of size 1048576
2019-12-23 15:55:03.208822: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703600000 next 1 of size 256
2019-12-23 15:55:03.213355: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703600100 next 2 of size 256
2019-12-23 15:55:03.216876: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703600200 next 3 of size 227328
2019-12-23 15:55:03.220694: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703637A00 next 4 of size 256
2019-12-23 15:55:03.224816: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703637B00 next 5 of size 256
2019-12-23 15:55:03.228228: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703637C00 next 6 of size 256
2019-12-23 15:55:03.232721: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703637D00 next 7 of size 256
2019-12-23 15:55:03.236215: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703637E00 next 8 of size 256
2019-12-23 15:55:03.240207: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703637F00 next 9 of size 256
2019-12-23 15:55:03.243924: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703638000 next 10 of size 18432
2019-12-23 15:55:03.247537: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363C800 next 11 of size 512
2019-12-23 15:55:03.251887: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363CA00 next 12 of size 512
2019-12-23 15:55:03.255408: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363CC00 next 13 of size 512
2019-12-23 15:55:03.259702: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363CE00 next 14 of size 512
2019-12-23 15:55:03.263116: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363D000 next 15 of size 512
2019-12-23 15:55:03.267501: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363D200 next 16 of size 256
2019-12-23 15:55:03.270991: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363D300 next 17 of size 256
2019-12-23 15:55:03.274735: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363D400 next 18 of size 3584
2019-12-23 15:55:03.278855: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363E200 next 19 of size 512
2019-12-23 15:55:03.282935: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363E400 next 20 of size 256
2019-12-23 15:55:03.287390: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070363E500 next 21 of size 147456
2019-12-23 15:55:03.291455: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703662500 next 22 of size 256
2019-12-23 15:55:03.295633: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703662600 next 23 of size 256
2019-12-23 15:55:03.299245: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703662700 next 24 of size 256
2019-12-23 15:55:03.303536: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703662800 next 25 of size 6144
2019-12-23 15:55:03.307109: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703664000 next 26 of size 256
2019-12-23 15:55:03.310887: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703664100 next 27 of size 256
2019-12-23 15:55:03.315193: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703664200 next 28 of size 204800
2019-12-23 15:55:03.318711: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703696200 next 29 of size 256
2019-12-23 15:55:03.323267: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703696300 next 30 of size 256
2019-12-23 15:55:03.326718: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703696400 next 31 of size 18944
2019-12-23 15:55:03.331132: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070369AE00 next 32 of size 256
2019-12-23 15:55:03.334594: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070369AF00 next 33 of size 256
2019-12-23 15:55:03.338385: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070369B000 next 34 of size 256
2019-12-23 15:55:03.342615: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070369B100 next 35 of size 147456
2019-12-23 15:55:03.346250: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036BF100 next 36 of size 256
2019-12-23 15:55:03.350587: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036BF200 next 37 of size 256
2019-12-23 15:55:03.354726: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036BF300 next 38 of size 32768
2019-12-23 15:55:03.358855: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C7300 next 39 of size 512
2019-12-23 15:55:03.362387: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C7500 next 40 of size 512
2019-12-23 15:55:03.365897: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C7700 next 41 of size 512
2019-12-23 15:55:03.370651: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C7900 next 42 of size 512
2019-12-23 15:55:03.374030: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C7B00 next 43 of size 512
2019-12-23 15:55:03.378189: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C7D00 next 44 of size 256
2019-12-23 15:55:03.381647: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C7E00 next 45 of size 256
2019-12-23 15:55:03.384917: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C7F00 next 46 of size 256
2019-12-23 15:55:03.389817: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8000 next 47 of size 256
2019-12-23 15:55:03.393262: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8100 next 48 of size 256
2019-12-23 15:55:03.397372: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8200 next 49 of size 256
2019-12-23 15:55:03.400720: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8300 next 50 of size 256
2019-12-23 15:55:03.404964: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8400 next 51 of size 256
2019-12-23 15:55:03.409168: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8500 next 52 of size 256
2019-12-23 15:55:03.412576: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8600 next 53 of size 256
2019-12-23 15:55:03.417357: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8700 next 54 of size 256
2019-12-23 15:55:03.420692: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8800 next 55 of size 256
2019-12-23 15:55:03.426379: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8900 next 56 of size 256
2019-12-23 15:55:03.429848: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8A00 next 57 of size 256
2019-12-23 15:55:03.435081: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8B00 next 58 of size 256
2019-12-23 15:55:03.438870: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8C00 next 59 of size 512
2019-12-23 15:55:03.443106: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C8E00 next 60 of size 512
2019-12-23 15:55:03.446523: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9000 next 61 of size 512
2019-12-23 15:55:03.451070: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9200 next 62 of size 512
2019-12-23 15:55:03.454620: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9400 next 63 of size 512
2019-12-23 15:55:03.458847: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9600 next 64 of size 256
2019-12-23 15:55:03.462621: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9700 next 65 of size 256
2019-12-23 15:55:03.466184: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9800 next 66 of size 256
2019-12-23 15:55:03.470599: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9900 next 67 of size 256
2019-12-23 15:55:03.474181: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9A00 next 68 of size 256
2019-12-23 15:55:03.478221: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9B00 next 69 of size 256
2019-12-23 15:55:03.482325: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9C00 next 70 of size 256
2019-12-23 15:55:03.486454: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9D00 next 71 of size 256
2019-12-23 15:55:03.490066: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9E00 next 72 of size 256
2019-12-23 15:55:03.493746: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036C9F00 next 73 of size 256
2019-12-23 15:55:03.498162: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036CA000 next 74 of size 1280
2019-12-23 15:55:03.501579: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036CA500 next 75 of size 256
2019-12-23 15:55:03.505785: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007036CA600 next 18446744073709551615 of size 219648
2019-12-23 15:55:03.510010: I tensorflow/core/common_runtime/bfc_allocator.cc:793] Next region of size 2097152
2019-12-23 15:55:03.513823: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703800000 next 77 of size 204800
2019-12-23 15:55:03.517277: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703832000 next 78 of size 227328
2019-12-23 15:55:03.521818: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703869800 next 79 of size 512
2019-12-23 15:55:03.525268: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703869A00 next 80 of size 147456
2019-12-23 15:55:03.529328: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070388DA00 next 81 of size 256
2019-12-23 15:55:03.533531: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070388DB00 next 82 of size 256
2019-12-23 15:55:03.537254: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070388DC00 next 83 of size 512
2019-12-23 15:55:03.541323: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070388DE00 next 84 of size 6144
2019-12-23 15:55:03.544864: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070388F600 next 85 of size 18944
2019-12-23 15:55:03.549147: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703894000 next 86 of size 512
2019-12-23 15:55:03.552947: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703894200 next 87 of size 3584
2019-12-23 15:55:03.556378: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703895000 next 88 of size 512
2019-12-23 15:55:03.561158: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703895200 next 89 of size 256
2019-12-23 15:55:03.564551: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703895300 next 90 of size 18432
2019-12-23 15:55:03.568872: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703899B00 next 91 of size 512
2019-12-23 15:55:03.572483: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703899D00 next 92 of size 512
2019-12-23 15:55:03.576986: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703899F00 next 93 of size 512
2019-12-23 15:55:03.580459: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070389A100 next 94 of size 512
2019-12-23 15:55:03.583930: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070389A300 next 95 of size 32768
2019-12-23 15:55:03.588643: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2300 next 96 of size 512
2019-12-23 15:55:03.592075: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2500 next 97 of size 256
2019-12-23 15:55:03.596119: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2600 next 98 of size 512
2019-12-23 15:55:03.599701: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2800 next 99 of size 512
2019-12-23 15:55:03.602993: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2A00 next 100 of size 256
2019-12-23 15:55:03.607754: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2B00 next 101 of size 512
2019-12-23 15:55:03.611233: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2D00 next 102 of size 256
2019-12-23 15:55:03.615535: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2E00 next 103 of size 256
2019-12-23 15:55:03.619511: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A2F00 next 104 of size 256
2019-12-23 15:55:03.623603: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3000 next 105 of size 256
2019-12-23 15:55:03.627092: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3100 next 106 of size 512
2019-12-23 15:55:03.630555: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3300 next 107 of size 256
2019-12-23 15:55:03.634828: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3400 next 108 of size 256
2019-12-23 15:55:03.638848: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3500 next 109 of size 512
2019-12-23 15:55:03.642937: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3700 next 110 of size 512
2019-12-23 15:55:03.646380: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3900 next 111 of size 256
2019-12-23 15:55:03.650475: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3A00 next 112 of size 256
2019-12-23 15:55:03.654036: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3B00 next 113 of size 512
2019-12-23 15:55:03.657806: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3D00 next 114 of size 256
2019-12-23 15:55:03.662041: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3E00 next 115 of size 256
2019-12-23 15:55:03.665886: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A3F00 next 116 of size 256
2019-12-23 15:55:03.670073: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4000 next 117 of size 512
2019-12-23 15:55:03.673576: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4200 next 118 of size 256
2019-12-23 15:55:03.676944: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4300 next 119 of size 256
2019-12-23 15:55:03.681189: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4400 next 120 of size 512
2019-12-23 15:55:03.684591: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4600 next 121 of size 512
2019-12-23 15:55:03.688935: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4800 next 122 of size 256
2019-12-23 15:55:03.692329: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4900 next 123 of size 256
2019-12-23 15:55:03.695737: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4A00 next 124 of size 512
2019-12-23 15:55:03.700272: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4C00 next 125 of size 512
2019-12-23 15:55:03.703679: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4E00 next 126 of size 256
2019-12-23 15:55:03.707751: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A4F00 next 127 of size 256
2019-12-23 15:55:03.711064: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5000 next 128 of size 256
2019-12-23 15:55:03.715780: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5100 next 129 of size 256
2019-12-23 15:55:03.719225: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5200 next 130 of size 512
2019-12-23 15:55:03.722646: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5400 next 131 of size 256
2019-12-23 15:55:03.726832: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5500 next 132 of size 256
2019-12-23 15:55:03.730208: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5600 next 133 of size 256
2019-12-23 15:55:03.734647: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5700 next 134 of size 512
2019-12-23 15:55:03.738104: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5900 next 135 of size 256
2019-12-23 15:55:03.742371: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5A00 next 136 of size 256
2019-12-23 15:55:03.746156: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5B00 next 137 of size 256
2019-12-23 15:55:03.749717: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5C00 next 138 of size 256
2019-12-23 15:55:03.753928: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5D00 next 139 of size 256
2019-12-23 15:55:03.757406: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A5E00 next 140 of size 512
2019-12-23 15:55:03.761853: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6000 next 141 of size 256
2019-12-23 15:55:03.765341: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6100 next 142 of size 256
2019-12-23 15:55:03.769651: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6200 next 143 of size 256
2019-12-23 15:55:03.773187: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6300 next 144 of size 256
2019-12-23 15:55:03.776629: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6400 next 145 of size 256
2019-12-23 15:55:03.781382: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6500 next 146 of size 256
2019-12-23 15:55:03.784928: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6600 next 147 of size 256
2019-12-23 15:55:03.789009: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6700 next 148 of size 256
2019-12-23 15:55:03.793127: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6800 next 149 of size 256
2019-12-23 15:55:03.797284: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6900 next 150 of size 256
2019-12-23 15:55:03.800799: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6A00 next 151 of size 256
2019-12-23 15:55:03.804969: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6B00 next 152 of size 256
2019-12-23 15:55:03.808447: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6C00 next 153 of size 256
2019-12-23 15:55:03.812213: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6D00 next 154 of size 256
2019-12-23 15:55:03.816385: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6E00 next 155 of size 256
2019-12-23 15:55:03.819981: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A6F00 next 156 of size 256
2019-12-23 15:55:03.824627: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7000 next 157 of size 256
2019-12-23 15:55:03.828110: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7100 next 158 of size 256
2019-12-23 15:55:03.832317: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7200 next 159 of size 256
2019-12-23 15:55:03.835825: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7300 next 166 of size 256
2019-12-23 15:55:03.839712: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7400 next 177 of size 256
2019-12-23 15:55:03.843962: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7500 next 172 of size 256
2019-12-23 15:55:03.847500: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7600 next 185 of size 256
2019-12-23 15:55:03.851658: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7700 next 174 of size 256
2019-12-23 15:55:03.855511: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7800 next 161 of size 256
2019-12-23 15:55:03.859561: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7900 next 216 of size 256
2019-12-23 15:55:03.863041: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7A00 next 210 of size 256
2019-12-23 15:55:03.866516: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7B00 next 228 of size 256
2019-12-23 15:55:03.871179: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7C00 next 232 of size 256
2019-12-23 15:55:03.874636: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7D00 next 233 of size 256
2019-12-23 15:55:03.878729: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7E00 next 226 of size 256
2019-12-23 15:55:03.882381: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A7F00 next 229 of size 256
2019-12-23 15:55:03.886829: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8000 next 230 of size 256
2019-12-23 15:55:03.890253: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8100 next 214 of size 512
2019-12-23 15:55:03.893694: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8300 next 163 of size 512
2019-12-23 15:55:03.897987: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8500 next 164 of size 256
2019-12-23 15:55:03.901467: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8600 next 165 of size 256
2019-12-23 15:55:03.905525: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8700 next 181 of size 256
2019-12-23 15:55:03.909268: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8800 next 179 of size 256
2019-12-23 15:55:03.913465: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8900 next 189 of size 256
2019-12-23 15:55:03.917181: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8A00 next 223 of size 256
2019-12-23 15:55:03.920685: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8B00 next 220 of size 256
2019-12-23 15:55:03.925049: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8C00 next 224 of size 256
2019-12-23 15:55:03.928529: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8D00 next 195 of size 256
2019-12-23 15:55:03.932797: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8E00 next 257 of size 256
2019-12-23 15:55:03.936302: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A8F00 next 171 of size 256
2019-12-23 15:55:03.940868: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 00000007038A9000 next 266 of size 256
2019-12-23 15:55:03.944663: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A9100 next 175 of size 256
2019-12-23 15:55:03.947922: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038A9200 next 264 of size 256
2019-12-23 15:55:03.952551: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 00000007038A9300 next 208 of size 7936
2019-12-23 15:55:03.956016: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038AB200 next 215 of size 6144
2019-12-23 15:55:03.960264: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038ACA00 next 231 of size 6144
2019-12-23 15:55:03.963889: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038AE200 next 209 of size 512
2019-12-23 15:55:03.968287: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038AE400 next 218 of size 3584
2019-12-23 15:55:03.971737: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038AF200 next 217 of size 3584
2019-12-23 15:55:03.975156: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 00000007038B0000 next 212 of size 18432
2019-12-23 15:55:03.979327: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038B4800 next 206 of size 18432
2019-12-23 15:55:03.982811: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038B9000 next 213 of size 18432
2019-12-23 15:55:03.987578: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 00000007038BD800 next 211 of size 32768
2019-12-23 15:55:03.991109: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038C5800 next 198 of size 32768
2019-12-23 15:55:03.995759: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038CD800 next 204 of size 32768
2019-12-23 15:55:03.999416: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038D5800 next 168 of size 18944
2019-12-23 15:55:04.002934: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038DA200 next 205 of size 30208
2019-12-23 15:55:04.007278: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007038E1800 next 201 of size 147456
2019-12-23 15:55:04.010826: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703905800 next 199 of size 147456
2019-12-23 15:55:04.015683: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 0000000703929800 next 221 of size 213504
2019-12-23 15:55:04.019174: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070395DA00 next 227 of size 196608
2019-12-23 15:55:04.023370: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000070398DA00 next 225 of size 227328
2019-12-23 15:55:04.026986: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 00000007039C5200 next 18446744073709551615 of size 241152
2019-12-23 15:55:04.030930: I tensorflow/core/common_runtime/bfc_allocator.cc:793] Next region of size 8388608
2019-12-23 15:55:04.035140: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703A00000 next 176 of size 204800
2019-12-23 15:55:04.038806: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000703A32000 next 178 of size 204800
2019-12-23 15:55:04.043366: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 0000000703A64000 next 18446744073709551615 of size 7979008
2019-12-23 15:55:04.047441: I tensorflow/core/common_runtime/bfc_allocator.cc:793] Next region of size 8388608
2019-12-23 15:55:04.051363: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 0000000704200000 next 18446744073709551615 of size 8388608
2019-12-23 15:55:04.055332: I tensorflow/core/common_runtime/bfc_allocator.cc:793] Next region of size 134217728
2019-12-23 15:55:04.058469: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 0000000704A00000 next 18446744073709551615 of size 134217728
2019-12-23 15:55:04.063751: I tensorflow/core/common_runtime/bfc_allocator.cc:793] Next region of size 536870912
2019-12-23 15:55:04.066880: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 000000070EE00000 next 18446744073709551615 of size 536870912
2019-12-23 15:55:04.072355: I tensorflow/core/common_runtime/bfc_allocator.cc:793] Next region of size 1563846144
2019-12-23 15:55:04.075439: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 000000072EE00000 next 246 of size 645120000
2019-12-23 15:55:04.079768: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 000000075553C000 next 219 of size 332759040
2019-12-23 15:55:04.083344: I tensorflow/core/common_runtime/bfc_allocator.cc:800] InUse at 0000000769294000 next 222 of size 147456
2019-12-23 15:55:04.088033: I tensorflow/core/common_runtime/bfc_allocator.cc:800] Free at 00000007692B8000 next 18446744073709551615 of size 585819648
2019-12-23 15:55:04.092059: I tensorflow/core/common_runtime/bfc_allocator.cc:809] Summary of in-use Chunks by size:
2019-12-23 15:55:04.096021: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 127 Chunks of size 256 totalling 31.8KiB
2019-12-23 15:55:04.099440: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 43 Chunks of size 512 totalling 21.5KiB
2019-12-23 15:55:04.102860: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 1 Chunks of size 1280 totalling 1.3KiB
2019-12-23 15:55:04.107029: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 4 Chunks of size 3584 totalling 14.0KiB
2019-12-23 15:55:04.110885: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 4 Chunks of size 6144 totalling 24.0KiB
2019-12-23 15:55:04.114834: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 4 Chunks of size 18432 totalling 72.0KiB
2019-12-23 15:55:04.118602: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 3 Chunks of size 18944 totalling 55.5KiB
2019-12-23 15:55:04.122083: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 1 Chunks of size 30208 totalling 29.5KiB
2019-12-23 15:55:04.126229: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 4 Chunks of size 32768 totalling 128.0KiB
2019-12-23 15:55:04.129866: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 6 Chunks of size 147456 totalling 864.0KiB
2019-12-23 15:55:04.134333: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 1 Chunks of size 196608 totalling 192.0KiB
2019-12-23 15:55:04.138252: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 4 Chunks of size 204800 totalling 800.0KiB
2019-12-23 15:55:04.142353: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 1 Chunks of size 219648 totalling 214.5KiB
2019-12-23 15:55:04.145692: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 3 Chunks of size 227328 totalling 666.0KiB
2019-12-23 15:55:04.149094: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 1 Chunks of size 241152 totalling 235.5KiB
2019-12-23 15:55:04.153582: I tensorflow/core/common_runtime/bfc_allocator.cc:812] 1 Chunks of size 645120000 totalling 615.23MiB
2019-12-23 15:55:04.157423: I tensorflow/core/common_runtime/bfc_allocator.cc:816] Sum Total of in-use chunks: 618.50MiB
2019-12-23 15:55:04.161201: I tensorflow/core/common_runtime/bfc_allocator.cc:818] total_region_allocated_bytes_: 2254857728 memory_limit_: 2254857830 available bytes: 102 curr_region_allocation_bytes_: 2147483648
2019-12-23 15:55:04.169402: I tensorflow/core/common_runtime/bfc_allocator.cc:824] Stats:
Limit: 2254857830
InUse: 648549888
MaxInUse: 2040417280
NumAllocs: 133567
MaxAllocSize: 1083703296

2019-12-23 15:55:04.179973: W tensorflow/core/common_runtime/bfc_allocator.cc:319] _____________________________****************************_______________________________________
2019-12-23 15:55:04.185661: W tensorflow/core/framework/op_kernel.cc:1502] OP_REQUIRES failed at transpose_op.cc:199 : Resource exhausted: OOM when allocating tensor with shape[300,140,60,64] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
Traceback (most recent call last):
File "C:\Users\super\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
return fn(*args)
File "C:\Users\super\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "C:\Users\super\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: 2 root error(s) found.
(0) Resource exhausted: OOM when allocating tensor with shape[300,140,60,64] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[{{node CNNX/batch_normalization_1/FusedBatchNorm-0-0-TransposeNCHWToNHWC-LayoutOptimizer}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

     [[dense_decoded/_281]]

Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

(1) Resource exhausted: OOM when allocating tensor with shape[300,140,60,64] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[{{node CNNX/batch_normalization_1/FusedBatchNorm-0-0-TransposeNCHWToNHWC-LayoutOptimizer}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "app.py", line 1403, in training_task
self.current_task.train_process()
File "C:\Users\super\Desktop\captcha_trainer-master\trains.py", line 196, in train_process
feed_dict=val_feed
File "C:\Users\super\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
run_metadata_ptr)
File "C:\Users\super\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
feed_dict_tensor, options, run_metadata)
File "C:\Users\super\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
run_metadata)
File "C:\Users\super\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: 2 root error(s) found.
(0) Resource exhausted: OOM when allocating tensor with shape[300,140,60,64] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[{{node CNNX/batch_normalization_1/FusedBatchNorm-0-0-TransposeNCHWToNHWC-LayoutOptimizer}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

     [[dense_decoded/_281]]

Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

(1) Resource exhausted: OOM when allocating tensor with shape[300,140,60,64] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[{{node CNNX/batch_normalization_1/FusedBatchNorm-0-0-TransposeNCHWToNHWC-LayoutOptimizer}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

0 successful operations.
0 derived errors ignored.

mac py3.6.3 raise ValueError("Can't load save_path when it is None.")

WARNING:tensorflow:ParseError: 1:24 : 'model_checkpoint_path: None': Expected string but found: 'None'
WARNING:tensorflow:./projects/demo-CNNX-NoRecurrent-H64-CrossEntropy-C3/model/checkpoint: Checkpoint ignored
INFO:tensorflow:None
WARNING:tensorflow:ParseError: 1:24 : 'model_checkpoint_path: None': Expected string but found: 'None'
WARNING:tensorflow:./projects/demo-CNNX-NoRecurrent-H64-CrossEntropy-C3/model/checkpoint: Checkpoint ignored
Traceback (most recent call last):
File "/Users/da/code_world/git/captcha_trainer/app.py", line 1332, in training_task
self.current_task.train_process()
File "/Users/da/code_world/git/captcha_trainer/trains.py", line 258, in train_process
self.compile_graph(accuracy)
File "/Users/da/code_world/git/captcha_trainer/trains.py", line 76, in compile_graph
saver.restore(predict_sess, tf.train.latest_checkpoint(self.model_conf.model_root_path))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1274, in restore
raise ValueError("Can't load save_path when it is None.")
ValueError: Can't load save_path when it is None.

mac环境 python3.6
tensorflow 1.14.0
tensorflow-estimator 1.14.0
使用 tk图形界面或者 trains.py启动报同样的错误

不知道训练集放哪

你好,我在TensorFlow这是个新手,我按照您给的教程,TestSetNum设置为10w之后,运行了trains.py,我看到在进行到1500步的时候,停下来提示训练完成,然后我按照部署教程部署,post之后永远是结果8,换图片都是这样。
请问训练用的验证码图片放在哪?
我的操作是否有误。
image
image
image

关于get_shape的问题

我的图片输入 resize: [200,60] size [200,60]

跑模型的时候提示

x.get_shape() [None, None, 4, 64]

INFO:tensorflow:CNN Output: (?, ?, 256)

image

image

opencv的依赖很难装

Could not find a version that satisfies the requirement opencv-python==3.3.0.10 (from -r requirements.txt (line 3)) (from versions: 3.4.2.16, 3.4.2.17, 3.4.3.18, 3.4.4.19, 3.4.5.20, 4.0.0.21)
No matching distribution found for opencv-python==3.3.0.10 (from -r requirements.txt (line 3))

重复的字符似乎特别容易漏识别

我是个新手,使用本项目在自己生成的一套验证码上达到了 93% 的识别率。结果似乎表明,当答案中包含连续的相同字符(例如 ABCCDE)时,重复的字符特别容易被漏识别(即识别成 ABCDE)。请问是否有什么建议,可能是哪个地方出了问题?

GPU环境下遇到问题,问题如下。

INFO:tensorflow:Start training...
2019-06-05 10:24:19.195228: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at ctc_loss_op.cc:168 : Invalid argument: Labels length is zero in batch 0
Traceback (most recent call last):
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
return fn(*args)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Labels length is zero in batch 0
[[{{node CTCLoss}} = CTCLoss[ctc_merge_repeated=true, ignore_longer_outputs_than_inputs=false, preprocess_collapse_repeated=false, _device="/job:localhost/replica:0/task:0/device:CPU:0"](output/predict/_89, _arg_labels/indices_0_1, _arg_labels/values_0_3, seq_len/_91)]]
[[{{node gradients/Mean_grad/Shape/_104}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_5999_gradients/Mean_grad/Shape", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "trains.py", line 228, in
tf.app.run()
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "trains.py", line 221, in main
train_process()
File "trains.py", line 146, in train_process
feed_dict=feed
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Labels length is zero in batch 0
[[node CTCLoss (defined at /data1/gjl/captcha_trainer/framework.py:119) = CTCLoss[ctc_merge_repeated=true, ignore_longer_outputs_than_inputs=false, preprocess_collapse_repeated=false, _device="/job:localhost/replica:0/task:0/device:CPU:0"](output/predict/_89, _arg_labels/indices_0_1, _arg_labels/values_0_3, seq_len/_91)]]
[[{{node gradients/Mean_grad/Shape/_104}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_5999_gradients/Mean_grad/Shape", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

Caused by op 'CTCLoss', defined at:
File "trains.py", line 228, in
tf.app.run()
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "trains.py", line 221, in main
train_process()
File "trains.py", line 49, in train_process
model.build_graph()
File "/data1/gjl/captcha_trainer/framework.py", line 33, in build_graph
self._build_train_op()
File "/data1/gjl/captcha_trainer/framework.py", line 119, in _build_train_op
time_major=CTC_LOSS_TIME_MAJOR
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/ops/ctc_ops.py", line 158, in ctc_loss
ignore_longer_outputs_than_inputs=ignore_longer_outputs_than_inputs)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/ops/gen_ctc_ops.py", line 286, in ctc_loss
name=name)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/data1/gjl/venv3.6/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1770, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Labels length is zero in batch 0
[[node CTCLoss (defined at /data1/gjl/captcha_trainer/framework.py:119) = CTCLoss[ctc_merge_repeated=true, ignore_longer_outputs_than_inputs=false, preprocess_collapse_repeated=false, _device="/job:localhost/replica:0/task:0/device:CPU:0"](output/predict/_89, _arg_labels/indices_0_1, _arg_labels/values_0_3, seq_len/_91)]]
[[{{node gradients/Mean_grad/Shape/_104}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_5999_gradients/Mean_grad/Shape", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

识别位数

怎么可以改成只识别4位验证码的模型

样本格式是怎么样的,懂的爸爸们教一下

执行 app.py ,会要求设置 sample source
这个应该就是要设置样本的路径吧,也就是作者说的喂数据
SourcePath:
Training: {SourceTrainPath}
Validation: {SourceValidationPath}
但这个文件/目录格式是怎么样的,不太懂。
比如我有图片+正确的码,怎么存放,才可以作为样本,从而让程序跑起来呢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.