• 大小: 86.82MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-09-01
  • 语言: Python
  • 标签:

资源简介

CTPN DenseNet CTC based end-to-end Chinese OCR implemented using tensorflow and keras

资源截图

代码片段和文件信息

#-*- coding:utf-8 -*-
import os
import ocr
import time
import shutil
import numpy as np
from PIL import Image
from glob import glob
image_files = glob(‘./test_images/*.*‘)


if __name__ == ‘__main__‘:
    result_dir = ‘./test_result‘
    if os.path.exists(result_dir):
        shutil.rmtree(result_dir)
    os.mkdir(result_dir)

    for image_file in sorted(image_files):
        image = np.array(Image.open(image_file).convert(‘RGB‘))
        t = time.time()
        result image_framed = ocr.model(image)
        output_file = os.path.join(result_dir image_file.split(‘/‘)[-1])
        Image.fromarray(image_framed).save(output_file)
        print(“Mission complete it took {:.3f}s“.format(time.time() - t))
        print(“\nRecognition Result:\n“)
        for key in result:
            print(result[key][1])


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-10-08 03:37  chinese_ocr-master\
     文件         148  2018-10-08 03:37  chinese_ocr-master\.gitignore
     文件       11357  2018-10-08 03:37  chinese_ocr-master\LICENSE
     文件        1962  2018-10-08 03:37  chinese_ocr-master\README.md
     目录           0  2018-10-08 03:37  chinese_ocr-master\ctpn\
     文件        3958  2018-10-08 03:37  chinese_ocr-master\ctpn\README.md
     文件           0  2018-10-08 03:37  chinese_ocr-master\ctpn\__init__.py
     目录           0  2018-10-08 03:37  chinese_ocr-master\ctpn\checkpoints\
     文件    71572976  2018-10-08 03:37  chinese_ocr-master\ctpn\checkpoints\VGGnet_fast_rcnn_iter_50000.ckpt.data-00000-of-00001
     文件        1643  2018-10-08 03:37  chinese_ocr-master\ctpn\checkpoints\VGGnet_fast_rcnn_iter_50000.ckpt.index
     文件      649342  2018-10-08 03:37  chinese_ocr-master\ctpn\checkpoints\VGGnet_fast_rcnn_iter_50000.ckpt.meta
     文件         121  2018-10-08 03:37  chinese_ocr-master\ctpn\checkpoints\checkpoint
     目录           0  2018-10-08 03:37  chinese_ocr-master\ctpn\ctpn\
     文件        3994  2018-10-08 03:37  chinese_ocr-master\ctpn\ctpn\demo.py
     文件         872  2018-10-08 03:37  chinese_ocr-master\ctpn\ctpn\text.yml
     文件        1197  2018-10-08 03:37  chinese_ocr-master\ctpn\ctpn\train_net.py
     目录           0  2018-10-08 03:37  chinese_ocr-master\ctpn\data\
     文件           9  2018-10-08 03:37  chinese_ocr-master\ctpn\data\VOCdevkit2007
     目录           0  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\
     文件      160420  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\001.jpg
     文件       23022  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\002.jpg
     文件      178066  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\003.jpg
     文件      265586  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\004.jpg
     文件      707796  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\005.jpg
     文件      470595  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\006.jpg
     文件       79041  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\007.jpg
     文件      123596  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\008.jpg
     文件      362936  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\009.jpg
     文件       12952  2018-10-08 03:37  chinese_ocr-master\ctpn\data\demo\010.png
     目录           0  2018-10-08 03:37  chinese_ocr-master\ctpn\data\oriented_results\
     文件      210939  2018-10-08 03:37  chinese_ocr-master\ctpn\data\oriented_results\001.jpg
............此处省略96个文件信息

评论

共有 条评论