1.PaddleOCR课表图片一键转电子版由来
最近看到一个手机应用,突然一个想法蹦了出来,客官请看下图
那,这是小米手机自带的小爱课程表,其中有一项就是拍照课表导入。然而我试用了好几次,每次导入都显示空白,可能服务在测试中吧。有小米手机的同学可以测试下,如果结果不一样可以告诉我下。于是我就想自己写个小东西试试。
2.问题来了
2.1 小朋友的课表
幼儿园小朋友的课表长这样:
这种表格很常见,一行一个,我们可以利用PaddleOCR表格识别3行搞定。具体参看:《动手学OCR》系列课程之:文档分析实战-表格识别
2.1 大朋友的课表
我们大朋友的课表一般长这样:
对这种一个单元格多行的就需要好多代码,好费劲,这次就先换个思路做。
3.解决思路
我的解决思路就是问题转换,具体步骤如下:
- 切分表格单元格子
- 每个单元格文字识别 那就开干
4.切分单元格
4.1 引入必要的库
# clone PaddleOCR代码 ! git clone https://gitee.com/PaddlePaddle/PaddleOCR --depth=1
Cloning into 'PaddleOCR'... remote: Enumerating objects: 1237, done.[K remote: Counting objects: 100% (1237/1237), done.[K remote: Compressing objects: 100% (1108/1108), done.[K remote: Total 1237 (delta 204), reused 699 (delta 79), pack-reused 0[K Receiving objects: 100% (1237/1237), 101.41 MiB | 7.16 MiB/s, done. Resolving deltas: 100% (204/204), done. Checking connectivity... done.
%cd ~ !pip install -U pip --user >log.log !pip install -r PaddleOCR/requirements.txt >log.log !pip install shapely >log.log !pip install -e PaddleOCR >log.log
/home/aistudio
%cd ~/PaddleOCR/ import cv2 import numpy as np from paddleocr import PaddleOCR import openpyxl
/home/aistudio/PaddleOCR
4.2 切分表格
其中代码中的
cv2.imshow("二值化图片:", binary) # 展示图片 cv2.waitKey(0)
可以去掉注释,本地查看查看表格分割过程
def seg_pic(img): image = cv2.imread(img, 1) # 灰度图片 gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # 二值化 binary = cv2.adaptiveThreshold(~gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 35, -5) # ret,binary = cv2.threshold(~gray, 127, 255, cv2.THRESH_BINARY) # cv2.imshow("二值化图片:", binary) # 展示图片 # cv2.waitKey(0) rows, cols = binary.shape scale = 40 # 识别横线 kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (cols // scale, 1)) eroded = cv2.erode(binary, kernel, iterations=1) # cv2.imshow("Eroded Image",eroded) dilatedcol = cv2.dilate(eroded, kernel, iterations=1) # cv2.imshow("表格横线展示:", dilatedcol) # cv2.waitKey(0) # 识别竖线 scale = 20 kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (1, rows // scale)) eroded = cv2.erode(binary, kernel, iterations=1) dilatedrow = cv2.dilate(eroded, kernel, iterations=1) # cv2.imshow("表格竖线展示:", dilatedrow) # cv2.waitKey(0) # 标识交点 bitwiseAnd = cv2.bitwise_and(dilatedcol, dilatedrow) # cv2.imshow("表格交点展示:", bitwiseAnd) # cv2.waitKey(0) # cv2.imwrite("my.png",bitwiseAnd) #将二值像素点生成图片保存 # 标识表格 merge = cv2.add(dilatedcol, dilatedrow) # cv2.imshow("表格整体展示:", merge) # cv2.waitKey(0) # 两张图片进行减法运算,去掉表格框线 merge2 = cv2.subtract(binary, merge) # cv2.imshow("图片去掉表格框线展示:", merge2) # cv2.waitKey(0) # 识别黑白图中的白色交叉点,将横纵坐标取出 ys, xs = np.where(bitwiseAnd > 0) mylisty = [] # 纵坐标 mylistx = [] # 横坐标 # 通过排序,获取跳变的x和y的值,说明是交点,否则交点会有好多像素值值相近,我只取相近值的最后一点 # 这个10的跳变不是固定的,根据不同的图片会有微调,基本上为单元格表格的高度(y坐标跳变)和长度(x坐标跳变) i = 0 myxs = np.sort(xs) for i in range(len(myxs) - 1): if (myxs[i + 1] - myxs[i] > 10): mylistx.append(myxs[i]) i = i + 1 mylistx.append(myxs[i]) # 要将最后一个点加入 i = 0 myys = np.sort(ys) # print(np.sort(ys)) for i in range(len(myys) - 1): if (myys[i + 1] - myys[i] > 10): mylisty.append(myys[i]) i = i + 1 mylisty.append(myys[i]) # 要将最后一个点加入 return image, mylistx, mylisty
5.调用PaddleOCR进行识别
def course_ocr(image, mylistx, mylisty): ocr = PaddleOCR(det=True) # 循环y坐标,x坐标分割表格 mylist = [] for i in range(len(mylisty) - 1): row = [] for j in range(len(mylistx) - 1): # 在分割时,第一个参数为y坐标,第二个参数为x坐标 ROI = image[mylisty[i] + 3:mylisty[i + 1] - 3, mylistx[j]:mylistx[j + 1] - 3] # 减去3的原因是由于我缩小ROI范围 # cv2.imshow("分割后子图片展示:", ROI) # cv2.waitKey(0) result = ocr.ocr(ROI, det=True) text_len = len(result) tmptxt = ' ' txt = ' ' if text_len != 0: for line in result: tmptxt, _ = line[-1] txt = txt + '\n' + tmptxt row.append(txt) j = j + 1 i = i + 1 mylist.append(row) return mylist
6.保存识别结果到excel
以大朋友课表为例。
def writeToExcel(file_path, new_list): wb = openpyxl.Workbook() ws = wb.active ws.title = '我的课程表' for r in range(len(new_list)): for c in range(len(new_list[0])): ws.cell(r + 1, c + 1).value = new_list[r][c] ws.cell(r + 1, c + 1).alignment = openpyxl.styles.Alignment(wrapText=True) # excel中的行和列是从1开始计数的,所以需要+1 wb.save(file_path) # 注意,写入后一定要保存 print("成功写入文件: " + file_path + " !") return 1 if __name__ == '__main__': img = '../1.jpg' image, mylistx, mylisty = seg_pic(img) mylist = course_ocr(image, mylistx, mylisty) writeToExcel('../mycourse.xls', mylist)
[2022/04/27 01:34:43] root WARNING: version PP-OCRv2 not support cls models, auto switch to version PP-OCR Namespace(benchmark=False, cls_batch_num=6, cls_image_shape='3, 48, 192', cls_model_dir='/home/aistudio/.paddleocr/2.4/ocr/cls/ch_ppocr_mobile_v2.0_cls_infer', cls_thresh=0.9, cpu_threads=10, crop_res_save_dir='./output', det=True, det_algorithm='DB', det_db_box_thresh=0.6, det_db_score_mode='fast', det_db_thresh=0.3, det_db_unclip_ratio=1.5, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_east_score_thresh=0.8, det_limit_side_len=960, det_limit_type='max', det_model_dir='/home/aistudio/.paddleocr/2.4/ocr/det/ch/ch_PP-OCRv2_det_infer', det_pse_box_thresh=0.85, det_pse_box_type='box', det_pse_min_area=16, det_pse_scale=1, det_pse_thresh=0, det_sast_nms_thresh=0.2, det_sast_polygon=False, det_sast_score_thresh=0.5, draw_img_save_dir='./inference_results', drop_score=0.5, e2e_algorithm='PGNet', e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_limit_side_len=768, e2e_limit_type='max', e2e_model_dir=None, e2e_pgnet_mode='fast', e2e_pgnet_score_thresh=0.5, e2e_pgnet_valid_set='totaltext', enable_mkldnn=False, gpu_mem=500, help='==SUPPRESS==', image_dir=None, ir_optim=True, is_visualize=True, label_list=['0', '180'], label_map_path='./vqa/labels/labels_ser.txt', lang='ch', layout_path_model='lp://PubLayNet/ppyolov2_r50vd_dcn_365e_publaynet/config', max_batch_size=10, max_seq_length=512, max_text_length=25, min_subgraph_size=15, mode='structure', model_name_or_path=None, ocr_version='PP-OCRv2', output='./output', precision='fp32', process_id=0, rec=True, rec_algorithm='CRNN', rec_batch_num=6, rec_char_dict_path='/home/aistudio/PaddleOCR/ppocr/utils/ppocr_keys_v1.txt', rec_image_shape='3, 32, 320', rec_model_dir='/home/aistudio/.paddleocr/2.4/ocr/rec/ch/ch_PP-OCRv2_rec_infer', save_crop_res=False, save_log_path='./log_output/', show_log=True, structure_version='STRUCTURE', table_char_dict_path=None, table_char_type='en', table_max_len=488, table_model_dir=None, total_process_num=1, type='ocr', use_angle_cls=False, use_dilation=False, use_gpu=True, use_mp=False, use_onnx=False, use_pdserving=False, use_space_char=True, use_tensorrt=False, use_xpu=False, vis_font_path='./doc/fonts/simfang.ttf', warmup=False) [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 0, elapse : 0.006531238555908203 [2022/04/27 01:34:44] root DEBUG: rec_res num : 0, elapse : 2.384185791015625e-06 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.0051233768463134766 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.005103349685668945 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.004321575164794922 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.003765106201171875 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.0042073726654052734 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.003260374069213867 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.0038406848907470703 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.003651142120361328 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.0042264461517333984 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.003298044204711914 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.004177093505859375 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.0032699108123779297 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.0044329166412353516 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.004613399505615234 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.007636070251464844 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.016942501068115234 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.007181644439697266 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.028723478317260742 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.006295680999755859 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.010427713394165039 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.005945444107055664 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.01737380027770996 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.006776094436645508 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.00892782211303711 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.005718231201171875 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.009186744689941406 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.012636423110961914 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.0038542747497558594 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.0060460567474365234 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.010711431503295898 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.005934715270996094 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.010719776153564453 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.006722927093505859 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.008838653564453125 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.006777286529541016 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.010182619094848633 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.0057184696197509766 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.009193658828735352 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.005079507827758789 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.010016202926635742 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.005192756652832031 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.0044367313385009766 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.006910085678100586 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.013296365737915039 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 5, elapse : 0.007179975509643555 [2022/04/27 01:34:44] root DEBUG: rec_res num : 5, elapse : 0.020600318908691406 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.00620579719543457 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.011708974838256836 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 5, elapse : 0.006657600402832031 [2022/04/27 01:34:44] root DEBUG: rec_res num : 5, elapse : 0.017567873001098633 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 0, elapse : 0.004624843597412109 [2022/04/27 01:34:44] root DEBUG: rec_res num : 0, elapse : 2.86102294921875e-06 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.006276130676269531 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.010603904724121094 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.004540681838989258 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.003960609436035156 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.017763137817382812 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.012119531631469727 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.005829572677612305 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.01071023941040039 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.0066606998443603516 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.012371301651000977 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.006064891815185547 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.011263370513916016 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 0, elapse : 0.003898143768310547 [2022/04/27 01:34:44] root DEBUG: rec_res num : 0, elapse : 1.9073486328125e-06 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.017630577087402344 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.009505271911621094 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.0038466453552246094 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.003913402557373047 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.005899190902709961 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.014079093933105469 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.006704092025756836 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.012315750122070312 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.006354570388793945 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.011947393417358398 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.0055255889892578125 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.011304855346679688 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 0, elapse : 0.0035974979400634766 [2022/04/27 01:34:44] root DEBUG: rec_res num : 0, elapse : 1.6689300537109375e-06 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 0, elapse : 0.003297567367553711 [2022/04/27 01:34:44] root DEBUG: rec_res num : 0, elapse : 1.9073486328125e-06 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 1, elapse : 0.003625631332397461 [2022/04/27 01:34:44] root DEBUG: rec_res num : 1, elapse : 0.004254579544067383 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 4, elapse : 0.00618743896484375 [2022/04/27 01:34:44] root DEBUG: rec_res num : 4, elapse : 0.01336669921875 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.0070950984954833984 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.012484073638916016 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.008647918701171875 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.012476682662963867 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 3, elapse : 0.0059299468994140625 [2022/04/27 01:34:44] root DEBUG: rec_res num : 3, elapse : 0.012735843658447266 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 0, elapse : 0.004593372344970703 [2022/04/27 01:34:44] root DEBUG: rec_res num : 0, elapse : 2.86102294921875e-06 [2022/04/27 01:34:44] root WARNING: Since the angle classifier is not initialized, the angle classifier will not be used during the forward process [2022/04/27 01:34:44] root DEBUG: dt_boxes num : 0, elapse : 0.004207611083984375 [2022/04/27 01:34:44] root DEBUG: rec_res num : 0, elapse : 3.337860107421875e-06 成功写入文件: ../mycourse.xls !
下载并excel打开长这样:
细看,和目标照片区别不大。
7.下部工作
- 下一步,可以加入自动识别表格方向,并利用小程序、android app来部署,提供更好的体验。
- 完整的代码已放目录下了。
- 大家可以试试自己的课表,看识别效果如何?
- 欢迎提各种好建议、好思路、好点子,晚安!!!