Giter Club home page Giter Club logo

darknet_captcha's Introduction

darknet_captcha

项目基于darknet开发了一系列的快速启动脚本,旨在让图像识别新手或者开发人员能够快速的启动一个目标检测(定位)的项目。 如果有没有讲清楚的地方,欢迎提issue和PR,希望能和大家共同完善!

本项目分为两个部分:

  1. 提供两个目标检测(单分类和多分类点选验证码)的例子,你可以通过例子熟悉定位yolo3定位网络的使用方式
  2. 基于darknet提供一系列API,用于使用自己的数据进行目标检测模型的训练,并提供web server的代码

word word word word

目录

项目结构

项目分为darknet、extent、app三部分

  1. darknet: 这部分是darknet项目源码,没有作任何改动。
  2. extent: 扩展部分,包含生成配置生成样本训练识别demoapi程序
  3. app: 每一个新的识别需求都以app区分,其中包含配置文件、样本和标签文件等。

开始一个例子:单类型目标检测

以点选验证码为例 darknet实际上给我们提供了一系列的深度学习算法,我们要做的就是使用比较简单的步骤来调用darknet训练我们的识别模型。

  • 推荐使用的操作系统是ubuntu,遇到的坑会少很多。
  • 如果使用windowns系统,需要先安装cygwin,便于编译darknet。(参考我的博客:安装cygwin

下面的步骤都已经通过ubuntu16.04测试。

1.下载项目

git clone https://github.com/nickliqian/darknet_captcha.git

2.编译darknet

进入darknet_captcha目录,下载darknet项目,覆盖darknet目录:

cd darknet_captcha
git clone https://github.com/pjreddie/darknet.git

进入darknet目录,修改darknet/Makefile配置文件

cd darknet
vim Makefile
  • 如果使用GPU训练则下面的GPU=1
  • 使用CPU训练则下面的GPU=0
GPU=1
CUDNN=0
OPENCV=0
OPENMP=0
DEBUG=0

然后使用make编译darknet

make

不建议使用CPU进行训练,因为使用CPU不管是训练还是预测,耗时都非常久。
如果你需要租用临时且价格低的GPU主机进行测试,后面介绍了一些推荐的GPU云服务。
如果在编译过程中会出错,可以在darknet的issue找一下解决办法,也可以发邮件找我要旧版本的darknet。

3.安装python3环境

使用pip执行下面的语句,并确保你的系统上已经安装了tk:

pip install -r requirement.txt
sudo apt-get install python3-tk

4.创建一个应用

进入根目录,运行下面的程序生成一个应用的基本配置:

cd darknet_captcha
python3 extend/create_app_config.py my_captcha 1

这里的类别默认生成classes_1,你可以修改类别名称;
打开app/my_captcha/my_captcha.names修改classes_1为主机想要的名称即可。

如何查看create_app_config.py的命令行参数解释?
直接运行python create_app_config.py便可以在控制台查看,下面的程序也是如此。

如果你对darknet相关配置有一定的了解,可以直接打开文件修改参数的值,这里我们保持原样即可。

5.生成样本

生成样本使用另外一个项目 nickliqian/generate_click_captcha
这里我已经集成进去了,执行下面的命令生成样本和对应标签到指定应用中yolo规定的目录:

python3 extend/generate_click_captcha.py my_captcha

运行python generate_click_captcha.py查看参数解释。

6.划分训练集和验证集

运行下面的程序,划分训练集和验证集,同时将标签的值转换为yolo认识的格式:

python3 extend/output_label.py my_captcha 1

这里填写的种类需要与上面一致。 运行python output_label.py查看参数解释。

7.开始训练

到这里,我们要准备的东西还差一样,我们需要下载darknet提供的预训练模型放在darknet_captcha目录下:

wget https://pjreddie.com/media/files/darknet53.conv.74

darknet_captcha目录下,执行下面的命令开始训练:

./darknet/darknet detector train app/my_captcha/my_captcha.data app/my_captcha/my_captcha_train.yolov3.cfg darknet53.conv.74

训练过程中模型会每一百次迭代储存一次,储存在app/my_captcha/backup/下,可以进行查看。

8.识别效果

使用GTX 1060训练大概1.5小时,训练迭代到1000次,会有比较明显的效果。

img1
我们找一张验证集的图片使用不同进度下的模型进行识别测试,执行下面的语句开始识别:

python3 extend/rec.py my_captcha 100

这里的100是选择app/my_captcha/images_data/JPEGImages目录下的第一百张图片进行识别。
运行python rec.py查看参数解释。

迭代300次: img1
迭代800次: img1
迭代1000次: img1
迭代1200次: img1

9.图片切割

这部分比较简单,网上有很多示例代码,可以调用darknet_interface.cut_and_save方法把定位到的字符切割下来。
img1 img1 img1

10.分类器

到分类这一步就比较容易了,可以使用darknet自带的分类器,也可以使用cnn_captcha一个使用卷积神经网络识别验证码的项目。

11.总结

我们识别点选验证码的大致流程如下:

  1. 搜集样本
  2. 打标签(标注坐标和字符)
  3. 训练定位器
  4. 检测位置,切割图片
  5. 训练分类器
  6. 使用定位器+分类器识别点选验证码上字符的位置和字符类别

第二个例子:多类型目标检测

步骤和上面基本上一致,直接把命令列出来:

# 生成配置文件
python3 extend/create_app_config.py dummy_captcha 2
# 生成图片
python3 extend/generate_click_captcha.py dummy_captcha 500 True
# 输出标签到txt
python3 extend/output_label.py dummy_captcha 2
# 开始训练w
./darknet/darknet detector train app/dummy_captcha/dummy_captcha.data app/dummy_captcha/dummy_captcha_train.yolov3.cfg darknet53.conv.74
# 识别测试
python3 extend/rec.py dummy_captcha 100

训练自己的数据

下面的过程教你如何训练自己数据。
假定我们要创建一个识别路上的车和人的应用,因此类别数量为2。
假定你现在有一些原始图片,首先你需要给这些图片打上标签,推荐使用labelImg进行打标工作。
使用教程可以自行谷歌,软件界面大致如下: img

给图片中的人和车分别打上person和car的标签,会生成xml标签文件。
接下来,我们创建一个应用,应用名称是car,类别为2类,同时生成一些配置文件:

python3 extend/create_app_config.py car 2

然后把你的原始图片放到指定的路径app/car/JPEGImages,把xml标签文件放在app/car/Annotations
yolo训练的时候需要图片中目标的相对坐标,所以这里需要把xml的坐标计算为相对坐标的形式。
同时car.data中需要分别定义训练集和验证集的样本路径,这里会划分出训练集和验证集,同时生成两个txt文件记录其路径。

python3 extend/output_label.py car 2

要提到的是,这里可以打开car.names,把里面的class_1和class_2分别修改为car和person,这里识别结果就会输出car和person。 然后就可以开始训练了:

./darknet/darknet detector train app/car/car.data app/car/car_train.yolov3.cfg darknet53.conv.74

识别测试和上面也没有上面区别:

# 识别测试
python3 extend/rec.py car 100

web服务

启动web服务:

python3 extend/web_server.py

启动前需要按需修改配置参数:

# 生成识别对象,需要配置参数
app_name = "car"  # 应用名称
config_file = "app/{}/{}_train.yolov3.cfg".format(app_name, app_name)  # 配置文件路径
model_file = "app/{}/backup/{}_train.backup".format(app_name, app_name)  # 模型路径
data_config_file = "app/{}/{}.data".format(app_name, app_name)  # 数据配置文件路径
dr = DarknetRecognize(
    config_file=config_file,
    model_file=model_file,
    data_config_file=data_config_file
)
save_path = "api_images"  # 保存图片的路径

使用下面的脚本request_api.py进行web服务的识别测试(注意修改图片路径):

python3 extend/request_api.py

返回响应,响应包含目标类别和中心点位置:

接口响应: {
  "speed_time(ms)": 16469, 
  "time": "15472704635706885", 
  "value": [
    [
      "word", 
      0.9995613694190979, 
      [
        214.47508239746094, 
        105.97418212890625, 
        24.86412811279297, 
        33.40662384033203
      ]
    ],
    ...
}

API文档

暂无

其他问题

使用阿里云OSS加速下载

如果你使用国外云主机进行训练,训练好的模型的下载速度确实是一个问题。
这里推荐使用阿里云oss,在云主机上把文件上传上去,然后使用oss下载下来。
配置秘钥:

# 从环境变量获取密钥
AccessKeyId = os.getenv("AccessKeyId")
AccessKeySecret = os.getenv("AccessKeySecret")
BucketName = os.getenv("BucketName")

上传图片:

python3 extend/upload2oss.py app/my_captcha/images_data/JPEGImages/1_15463317590530567.jpg
python3 extend/upload2oss.py text.jpg

GPU云推荐

使用租用 vectordash GPU云主机,ssh连接集成了Nvidia深度学习环境的ubuntu16.04系统
包含以下工具或框架:

CUDA 9.0, cuDNN, Tensorflow, PyTorch, Caffe, Keras

vectordash提供了一个客户端,具备远程连接、上传和下载文件、管理多个云主机等。
下面是几种显卡的租用价格:
img1
创建实例后,面板会提供一个秘钥,输入秘钥后,就可以使用客户端操作了:

# 安装客户端
pip install vectordash --upgrade
# 登录
vectordash login
# 列出主机
vectordash list
# ssh登录
vectordash ssh <instance_id>
# 打开jupyter
vectordash jupyter <instance_id>
# 上传文件
vectordash push <instance_id> <from_path> <to_path>
# 下载文件
vectordash pull <instance_id> <from_path> <to_path>

由于vectordash主机在国外,所以上传和下载都很慢,建议临时租用一台阿里云竞价突发型实例(约7分钱一小时)作为中转使用。

CPU和GPU识别速度对比

GTX 1060, 识别耗时1s

[load model] speed time: 4.691879987716675s
[detect image - i] speed time: 1.002530813217163s

CPU, 识别耗时13s

[load model] speed time: 3.313053846359253s
[detect image - i] speed time: 13.256595849990845s

报错解决办法

  1. UnicodeEncodeError: 'ascii' codec can't encode character '\U0001f621' in posit
    参考链接
  2. pip install, locale.Error: unsupported locale setting
    参考链接

TODO

  1. 支持多类别检测的识别和训练 Done
  2. WebServer API调用 Done
  3. 分类器

darknet_captcha's People

Contributors

nickliqian 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

darknet_captcha's Issues

当我想要测试识别结果的时候,输出最后只有speed time:......,我想要看到识别的图片结果就像你的例子上一样要怎么做到

我尝试着执行

python3 extend/rec.py my_captcha 100

得到的结果是

Loading weights from app/my_captcha/backup/my_captcha_train.backup...Done!
[load model] speed time: 5.234357833862305s
[detect image - i] speed time: 0.06003904342651367s

我想要看到可视化的图片从而清楚的知道识别结果,就像你在readme里面提到的样子,我该怎么做

你好,我在nohub训练模型的时候卡住

在执行python3 train_model.py 可以正常执行,在执行 nohub python3 train_model.py &就卡在cpu那里
`[root@instance-4 cnn_captcha-master]# nohup: ignoring input and appending output to ‘nohup.out’

[root@instance-4 cnn_captcha-master]# tail -f nohup.out
WARNING:tensorflow:From /usr/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
2019-07-10 02:49:42.964796: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
^C
`

请教个my_captcha.namesd的问题

请问一下我调用了下面的命令
python3 extend/create_app_config.py my_captcha 1
然后文件my_captcha.names的内容是class_0,请问这个内容是做什么用的呢?需要修改吗?谢谢
@nickliqian

项目文件不存在

请问一下extend/generate_config_file.py这个文件在哪里?好像找不到
python3 extend/generate_config_file.py my_captcha 1
@nickliqian

app/{}/backup/{}_train.backup文件不存在,这个文件是要自己手动创建的吗?

你好,我在执行darknet dector这一步时候,会提示cant not open file my_captcha_train.backup这个文件

./darknet/darknet detector train app/my_captcha/my_captcha.data app/my_captcha/my_captcha_train.yolov3.cfg darknet53.conv.74

我进目录后查看,这个文件是不存在的

自行手动创建{}_train.backup 这个文件,程序倒是能提示:

Loading weights ....  .backup... Done!

但backup文件中并没有写入任何内容,请问这是什么原因。

image

另外,我在执行

python3 extend/rec.py my_captcha 100

image

并没有找到出现识别框的 结果图,还请大佬答疑解惑!

建议作者修改一下readme文件

主要有两处错误:

  1. 在第5步 生成样本 之后需要修改my_captcha.name中的标签值,单类型目标检测需改为word
    多类型目标检测,需改为word dummy
    否则,在output_label.py中第33行:
    if cls not in classes or int(difficult) == 1:
        continue

会判断标签值不在classes中,从而labels_data中的txt文件为空。
在后续训练不会报错,但训练结果一直为:
Avg IOU: -nan, Class: -nan, Obj: -nan, No Obj: 0.001772, .5R: -nan, .75R: -nan, count: 0

  1. 第6步 划分训练集和验证集 代码应为:
    python3 extend/output_label.py my_captcha
    无需参数1

识别测试报错 STB Reason: unknown image type

[root@10-255-20-243 darknet_captcha]# python3 extend/rec.py kz 1
layer filters size input output
0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32 0.299 BFLOPs
1 conv 64 3 x 3 / 2 416 x 416 x 32 -> 208 x 208 x 64 1.595 BFLOPs
2 conv 32 1 x 1 / 1 208 x 208 x 64 -> 208 x 208 x 32 0.177 BFLOPs
3 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64 1.595 BFLOPs
4 res 1 208 x 208 x 64 -> 208 x 208 x 64
5 conv 128 3 x 3 / 2 208 x 208 x 64 -> 104 x 104 x 128 1.595 BFLOPs
6 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BFLOPs
7 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BFLOPs
8 res 5 104 x 104 x 128 -> 104 x 104 x 128
9 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BFLOPs
10 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BFLOPs
11 res 8 104 x 104 x 128 -> 104 x 104 x 128
12 conv 256 3 x 3 / 2 104 x 104 x 128 -> 52 x 52 x 256 1.595 BFLOPs
13 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
14 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
15 res 12 52 x 52 x 256 -> 52 x 52 x 256
16 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
17 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
18 res 15 52 x 52 x 256 -> 52 x 52 x 256
19 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
20 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
21 res 18 52 x 52 x 256 -> 52 x 52 x 256
22 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
23 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
24 res 21 52 x 52 x 256 -> 52 x 52 x 256
25 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
26 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
27 res 24 52 x 52 x 256 -> 52 x 52 x 256
28 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
29 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
30 res 27 52 x 52 x 256 -> 52 x 52 x 256
31 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
32 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
33 res 30 52 x 52 x 256 -> 52 x 52 x 256
34 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
35 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
36 res 33 52 x 52 x 256 -> 52 x 52 x 256
37 conv 512 3 x 3 / 2 52 x 52 x 256 -> 26 x 26 x 512 1.595 BFLOPs
38 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
39 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
40 res 37 26 x 26 x 512 -> 26 x 26 x 512
41 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
42 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
43 res 40 26 x 26 x 512 -> 26 x 26 x 512
44 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
45 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
46 res 43 26 x 26 x 512 -> 26 x 26 x 512
47 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
48 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
49 res 46 26 x 26 x 512 -> 26 x 26 x 512
50 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
51 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
52 res 49 26 x 26 x 512 -> 26 x 26 x 512
53 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
54 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
55 res 52 26 x 26 x 512 -> 26 x 26 x 512
56 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
57 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
58 res 55 26 x 26 x 512 -> 26 x 26 x 512
59 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
60 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
61 res 58 26 x 26 x 512 -> 26 x 26 x 512
62 conv 1024 3 x 3 / 2 26 x 26 x 512 -> 13 x 13 x1024 1.595 BFLOPs
63 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
64 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
65 res 62 13 x 13 x1024 -> 13 x 13 x1024
66 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
67 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
68 res 65 13 x 13 x1024 -> 13 x 13 x1024
69 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
70 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
71 res 68 13 x 13 x1024 -> 13 x 13 x1024
72 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
73 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
74 res 71 13 x 13 x1024 -> 13 x 13 x1024
75 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
76 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
77 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
78 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
79 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
80 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
81 conv 18 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 18 0.006 BFLOPs
82 yolo
83 route 79
84 conv 256 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 256 0.044 BFLOPs
85 upsample 2x 13 x 13 x 256 -> 26 x 26 x 256
86 route 85 61
87 conv 256 1 x 1 / 1 26 x 26 x 768 -> 26 x 26 x 256 0.266 BFLOPs
88 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
89 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
90 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
91 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
92 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
93 conv 18 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 18 0.012 BFLOPs
94 yolo
95 route 91
96 conv 128 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 128 0.044 BFLOPs
97 upsample 2x 26 x 26 x 128 -> 52 x 52 x 128
98 route 97 36
99 conv 128 1 x 1 / 1 52 x 52 x 384 -> 52 x 52 x 128 0.266 BFLOPs
100 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
101 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
102 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
103 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
104 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
105 conv 18 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 18 0.025 BFLOPs
106 yolo
Loading weights from app/kz/backup/kz_train.backup...Done!
[load model] speed time: 9.645345449447632s
Cannot load image "app/kz/images_data/JPEGImages/"
STB Reason: unknown image type
[root@10-255-20-243 darknet_captcha]# python3 extend/rec.py kz 10
layer filters size input output
0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32 0.299 BFLOPs
1 conv 64 3 x 3 / 2 416 x 416 x 32 -> 208 x 208 x 64 1.595 BFLOPs
2 conv 32 1 x 1 / 1 208 x 208 x 64 -> 208 x 208 x 32 0.177 BFLOPs
3 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64 1.595 BFLOPs
4 res 1 208 x 208 x 64 -> 208 x 208 x 64
5 conv 128 3 x 3 / 2 208 x 208 x 64 -> 104 x 104 x 128 1.595 BFLOPs
6 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BFLOPs
7 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BFLOPs
8 res 5 104 x 104 x 128 -> 104 x 104 x 128
9 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BFLOPs
10 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BFLOPs
11 res 8 104 x 104 x 128 -> 104 x 104 x 128
12 conv 256 3 x 3 / 2 104 x 104 x 128 -> 52 x 52 x 256 1.595 BFLOPs
13 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
14 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
15 res 12 52 x 52 x 256 -> 52 x 52 x 256
16 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
17 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
18 res 15 52 x 52 x 256 -> 52 x 52 x 256
19 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
20 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
21 res 18 52 x 52 x 256 -> 52 x 52 x 256
22 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
23 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
24 res 21 52 x 52 x 256 -> 52 x 52 x 256
25 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
26 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
27 res 24 52 x 52 x 256 -> 52 x 52 x 256
28 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
29 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
30 res 27 52 x 52 x 256 -> 52 x 52 x 256
31 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
32 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
33 res 30 52 x 52 x 256 -> 52 x 52 x 256
34 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
35 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
36 res 33 52 x 52 x 256 -> 52 x 52 x 256
37 conv 512 3 x 3 / 2 52 x 52 x 256 -> 26 x 26 x 512 1.595 BFLOPs
38 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
39 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
40 res 37 26 x 26 x 512 -> 26 x 26 x 512
41 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
42 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
43 res 40 26 x 26 x 512 -> 26 x 26 x 512
44 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
45 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
46 res 43 26 x 26 x 512 -> 26 x 26 x 512
47 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
48 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
49 res 46 26 x 26 x 512 -> 26 x 26 x 512
50 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
51 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
52 res 49 26 x 26 x 512 -> 26 x 26 x 512
53 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
54 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
55 res 52 26 x 26 x 512 -> 26 x 26 x 512
56 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
57 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
58 res 55 26 x 26 x 512 -> 26 x 26 x 512
59 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
60 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
61 res 58 26 x 26 x 512 -> 26 x 26 x 512
62 conv 1024 3 x 3 / 2 26 x 26 x 512 -> 13 x 13 x1024 1.595 BFLOPs
63 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
64 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
65 res 62 13 x 13 x1024 -> 13 x 13 x1024
66 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
67 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
68 res 65 13 x 13 x1024 -> 13 x 13 x1024
69 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
70 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
71 res 68 13 x 13 x1024 -> 13 x 13 x1024
72 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
73 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
74 res 71 13 x 13 x1024 -> 13 x 13 x1024
75 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
76 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
77 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
78 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
79 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BFLOPs
80 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs
81 conv 18 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 18 0.006 BFLOPs
82 yolo
83 route 79
84 conv 256 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 256 0.044 BFLOPs
85 upsample 2x 13 x 13 x 256 -> 26 x 26 x 256
86 route 85 61
87 conv 256 1 x 1 / 1 26 x 26 x 768 -> 26 x 26 x 256 0.266 BFLOPs
88 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
89 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
90 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
91 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BFLOPs
92 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BFLOPs
93 conv 18 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 18 0.012 BFLOPs
94 yolo
95 route 91
96 conv 128 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 128 0.044 BFLOPs
97 upsample 2x 26 x 26 x 128 -> 52 x 52 x 128
98 route 97 36
99 conv 128 1 x 1 / 1 52 x 52 x 384 -> 52 x 52 x 128 0.266 BFLOPs
100 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
101 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
102 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
103 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
104 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
105 conv 18 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 18 0.025 BFLOPs
106 yolo
Loading weights from app/kz/backup/kz_train.backup...Done!
[load model] speed time: 7.765070676803589s
Cannot load image "app/kz/images_data/JPEGImages/"
STB Reason: unknown image type

较为复杂的文字点选能识别嘛?

非常感谢您的项目分享,真的对我帮助很大,目前我需要破解文字点选验证码,文字有倾斜处理,也有繁体字,请问这种情况我们darknet识别效果好吗?是不是需要标注样本足够多?
image10
谢谢

在第5步生成样本报错

环境:Mac OS 11.2.3、python3.8
在 5.生成样本
python extend/generate_click_captcha.py my_captcha

报错:

Put word 硬 success!
Template is from extend/exp.xml
Generate 300 images on app/my_captcha/images_data/JPEGImages
Generate 300 .xml label files on app/my_captcha/images_data/Annotations
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "~/opt/anaconda3/lib/python3.8/site-packages/colorama/ansitowin32.py", line 59, in closed
    return stream.closed
ValueError: underlying buffer has been detached

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.