★★★ 本文源自AlStudio社区精品项目,【点击此处】查看更多精品内容 >>>

通用手写文字擦除A榜2,B榜第3方案

一、赛题背景

随着技术发展,OCR扫描在学习、办公等众多场景中被使用,通过技术和算法,对扫描获得的纸张文档上的手写笔迹还原修复,恢复文件本身的样子,使得人们的使用体验越来越便捷。上一期比赛,我们举办了试卷场景下的手写文字擦除,帮助学生党们擦除试卷上的笔迹。本次比赛,我们诚邀各位选手并拓宽场景:不限于试卷,对通用文件上的手写笔迹进行擦除后还原文件,帮助更多人解决扫描上的问题。

二、数据分析

本次比赛的数据集分别为两类,第一类是上期比赛使用的试卷类型图片1081张,第二类是包含手写字迹的类似PDF文档图片12万张左右。

缩减二类数据
首先考虑到二类图片的数量巨大,在有限显存下过大的训练数据集对精度的提高是有限的,其次观测到测试数据集的试卷类型图片所占比重是0.4,所以为了平衡两类型的数据,因此二类图片只选取了二十分之一(6346张)用作训练。

扩增一类数据
接着考虑到一类试卷类型图片的特征基本上都为边缘纹理信息(不管是印刷体,手写体还是批改符号),并且此类图片梯度计算对颜色的依赖性不强,而颜色本身,非常容易受到光照等因素的影响,同类的物体颜色有很多变化,所以颜色本身可能难以提供关键信息。所以将此类图片灰度化后加入原始数据集进行数据增强。最终训练集中此类图片总共是2162张图片(1081张原图+1081张灰度图)。也进一步的平衡了两类型的数据。一类图片的mask采用比赛baseline中mask.

三、模型设计

网络模型,是基于本次比赛的baseline进行了改进。

Refinement
首先参考了上一期手写文字擦除第一名的方案,将Refinement部分替换成了基于Non-Local的深度编解码网络。

Coarse-erasure
然后考虑到本次比赛有把推理时间算作指标,为了轻量化网络模型,所以在Coarse-erasure不再使用swin-T(经过对比swin-T的优化效果较小),而在最深层网络引入ASPP+CBAM,在skip connection处引入了SE attention,通过扩大感受野和注意力来增强特征提取。

模型:

四、调参优化策略

损失函数:L1 loss function + BCE loss function;

学习率调度:StepDecay

训练大致分为三阶段:

第一阶段先从512x512的patch_size开始训练500Epoch,batch_size=4,lr=1e-4;

第二阶段再从256x256的patch_size开始训练500Epoch,batch_size=16,lr=5e-5;

第三阶段再从512x512的patch_size开始训练500Epoch,batch_size=2,lr=1e-5;

由于网络较深,为了模型真正收敛,后期模型改进后又多次进行多阶段的训练,没有最好只有更好,就是练!

五、测试细节

测试trick:
分块测试,为了减少预测的时间,把图像切分为768x768的小块进行预测。

六、文件

loss:定义损失函数
model:定义网络模型
dataloader.py: 加载数据脚本
predict.py: 测试脚本
train.py: 训练脚本

七、代码运行:

# 解压数据集文件
import os!ls /home/aistudio/data/
!unzip -qo /home/aistudio/data/data167667/train_final.zip -d /home/aistudio/data/  #解压训练集
!unzip -qo /home/aistudio/data/data167820/test_dataset.zip -d /home/aistudio/data/  #解压测试集
!ls /home/aistudio/data/
print("load down")
data167667  data167820

训练模型

# step 1,
%cd ~
!python work/train.py \--modelsSavePath /home/aistudio/work/savepath1 \--batchSize 4 \--loadSize 512 \--lr 1e-4 \--num_epochs 500 \--lr_decay_iters 10 \--logPath /home/aistudio/work/log1
/home/aistudio
[09/06 15:46:24] idr INFO: Namespace(batchSize=10, dataRoot='/home/aistudio/data/', gamma=0.92, loadSize=512, logPath='/home/aistudio/work/log1', lr=0.0001, lr_decay_iters=1, mask_dir='mask', modelsSavePath='/home/aistudio/work/savepath1', net='idr', numOfWorkers=4, num_epochs=500, pretrained='/home/aistudio/work/STE_best.pdparams', seed=9421)
[09/06 15:46:24] idr INFO: ========> Random Seed: 9421
============== 200
==============>net use:  idr
W0906 15:46:24.349529  3894 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 10.1
W0906 15:46:24.353334  3894 device_context.cc:465] device: 0, cuDNN Version: 7.6.
loaded
OK!
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/nn/layer/norm.py:653: UserWarning: When training, we now always track global mean and variance."When training, we now always track global mean and variance.")
[09/06 15:48:04] idr INFO: [100/425500] Generator Loss of epoch1 is 0.34888, idr, mask,  Lr:0.0001
[09/06 15:49:40] idr INFO: [200/425500] Generator Loss of epoch1 is 0.34814, idr, mask,  Lr:0.0001
[09/06 15:51:16] idr INFO: [300/425500] Generator Loss of epoch1 is 0.34094, idr, mask,  Lr:0.0001
[09/06 15:52:52] idr INFO: [400/425500] Generator Loss of epoch1 is 0.33687, idr, mask,  Lr:0.0001
[09/06 15:54:29] idr INFO: [500/425500] Generator Loss of epoch1 is 0.34525, idr, mask,  Lr:0.0001
[09/06 15:56:06] idr INFO: [600/425500] Generator Loss of epoch1 is 0.34353, idr, mask,  Lr:0.0001
[09/06 15:57:42] idr INFO: [700/425500] Generator Loss of epoch1 is 0.33961, idr, mask,  Lr:0.0001
[09/06 15:59:19] idr INFO: [800/425500] Generator Loss of epoch1 is 0.34725, idr, mask,  Lr:0.0001
0 [1, 3, 4060, 2828] [1, 3, 4060, 2828]
[09/06 16:00:12] idr INFO: index:0 psnr: 39.12316740874206
1 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:12] idr INFO: index:1 psnr: 39.73780665177327
2 [1, 3, 759, 759] [1, 3, 759, 759]
[09/06 16:00:12] idr INFO: index:2 psnr: 56.21873531296796
3 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:12] idr INFO: index:3 psnr: 40.52212885557168
4 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:12] idr INFO: index:4 psnr: 41.56430428800155
5 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:13] idr INFO: index:5 psnr: 46.31855806228171
6 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:13] idr INFO: index:6 psnr: 49.45672306086962
7 [1, 3, 1106, 1106] [1, 3, 1106, 1106]
[09/06 16:00:13] idr INFO: index:7 psnr: 41.85389424028928
8 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:14] idr INFO: index:8 psnr: 45.59890998206253
9 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:14] idr INFO: index:9 psnr: 42.56992218052834
10 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:14] idr INFO: index:10 psnr: 39.46905200806042
11 [1, 3, 3968, 2992] [1, 3, 3968, 2992]
[09/06 16:00:17] idr INFO: index:11 psnr: 30.676958035124073
12 [1, 3, 1303, 1303] [1, 3, 1303, 1303]
[09/06 16:00:17] idr INFO: index:12 psnr: 36.596694232523916
13 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:17] idr INFO: index:13 psnr: 40.5513939328022
14 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:18] idr INFO: index:14 psnr: 44.06369456299479
15 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:18] idr INFO: index:15 psnr: 40.17776212768399
16 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:18] idr INFO: index:16 psnr: 42.24566474161308
17 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:18] idr INFO: index:17 psnr: 42.778629586488385
18 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:18] idr INFO: index:18 psnr: 41.28397635046352
19 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:19] idr INFO: index:19 psnr: 43.08305073768209
20 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:19] idr INFO: index:20 psnr: 37.99953224917441
21 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:19] idr INFO: index:21 psnr: 39.60650681925876
22 [1, 3, 881, 881] [1, 3, 881, 881]
[09/06 16:00:19] idr INFO: index:22 psnr: 34.69429418625743
23 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:19] idr INFO: index:23 psnr: 39.50363914077295
24 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:20] idr INFO: index:24 psnr: 40.751659676909014
25 [1, 3, 2004, 2700] [1, 3, 2004, 2700]
[09/06 16:00:21] idr INFO: index:25 psnr: 34.54854208486414
26 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:21] idr INFO: index:26 psnr: 39.04385596051836
27 [1, 3, 657, 657] [1, 3, 657, 657]
[09/06 16:00:21] idr INFO: index:27 psnr: 44.9736077587509
28 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:22] idr INFO: index:28 psnr: 41.68218015408904
29 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:22] idr INFO: index:29 psnr: 40.61206697167343
30 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:22] idr INFO: index:30 psnr: 43.60846574056669
31 [1, 3, 4096, 2824] [1, 3, 4096, 2824]
[09/06 16:00:25] idr INFO: index:31 psnr: 41.14815375047886
32 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:25] idr INFO: index:32 psnr: 41.69333354872684
33 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:25] idr INFO: index:33 psnr: 45.31000107783842
34 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:26] idr INFO: index:34 psnr: 42.63911867022572
35 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:26] idr INFO: index:35 psnr: 44.300953983979035
36 [1, 3, 871, 871] [1, 3, 871, 871]
[09/06 16:00:26] idr INFO: index:36 psnr: 35.43800884564381
37 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:26] idr INFO: index:37 psnr: 37.88577444252964
38 [1, 3, 3040, 3708] [1, 3, 3040, 3708]
[09/06 16:00:29] idr INFO: index:38 psnr: 32.40660057218592
39 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:29] idr INFO: index:39 psnr: 42.843663734081986
40 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:30] idr INFO: index:40 psnr: 41.9398567107216
41 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:30] idr INFO: index:41 psnr: 38.97470231198536
42 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:30] idr INFO: index:42 psnr: 40.06239614276901
43 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:30] idr INFO: index:43 psnr: 40.1852866514605
44 [1, 3, 1174, 1174] [1, 3, 1174, 1174]
[09/06 16:00:31] idr INFO: index:44 psnr: 31.746765780116974
45 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:31] idr INFO: index:45 psnr: 38.4916242456792
46 [1, 3, 3984, 2976] [1, 3, 3984, 2976]
[09/06 16:00:34] idr INFO: index:46 psnr: 30.50431826386677
47 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:34] idr INFO: index:47 psnr: 42.32445776242155
48 [1, 3, 3968, 3020] [1, 3, 3968, 3020]
[09/06 16:00:37] idr INFO: index:48 psnr: 32.18790341359288
49 [1, 3, 3984, 2988] [1, 3, 3984, 2988]
[09/06 16:00:40] idr INFO: index:49 psnr: 34.09978893579476
50 [1, 3, 767, 767] [1, 3, 767, 767]
[09/06 16:00:40] idr INFO: index:50 psnr: 35.762771639293945
51 [1, 3, 1288, 1288] [1, 3, 1288, 1288]
[09/06 16:00:41] idr INFO: index:51 psnr: 39.604834580712364
52 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:41] idr INFO: index:52 psnr: 41.10868693041454
53 [1, 3, 2988, 3856] [1, 3, 2988, 3856]
[09/06 16:00:43] idr INFO: index:53 psnr: 35.395368505099775
54 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:44] idr INFO: index:54 psnr: 37.855353239840426
55 [1, 3, 1114, 1114] [1, 3, 1114, 1114]
[09/06 16:00:44] idr INFO: index:55 psnr: 35.93459644732544
56 [1, 3, 794, 596] [1, 3, 794, 596]
[09/06 16:00:44] idr INFO: index:56 psnr: 41.36502948885183
57 [1, 3, 794, 596] [1, 3, 794, 596]
[09/06 16:00:45] idr INFO: index:57 psnr: 41.22497181496591
58 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:45] idr INFO: index:58 psnr: 41.1771169375382
59 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:45] idr INFO: index:59 psnr: 53.723152871972395
60 [1, 3, 1230, 1230] [1, 3, 1230, 1230]
[09/06 16:00:45] idr INFO: index:60 psnr: 39.797982964887396
61 [1, 3, 1015, 1015] [1, 3, 1015, 1015]
[09/06 16:00:46] idr INFO: index:61 psnr: 32.74303529740838
62 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:46] idr INFO: index:62 psnr: 47.082211241055745
63 [1, 3, 3984, 2896] [1, 3, 3984, 2896]
[09/06 16:00:49] idr INFO: index:63 psnr: 30.78206695277144
64 [1, 3, 556, 556] [1, 3, 556, 556]
[09/06 16:00:49] idr INFO: index:64 psnr: 36.01234149376034
65 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:49] idr INFO: index:65 psnr: 45.05396181166462
66 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:49] idr INFO: index:66 psnr: 43.88535125975919
67 [1, 3, 708, 708] [1, 3, 708, 708]
[09/06 16:00:49] idr INFO: index:67 psnr: 32.04842861330942
68 [1, 3, 1070, 1070] [1, 3, 1070, 1070]
[09/06 16:00:50] idr INFO: index:68 psnr: 36.048236069223904
69 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:50] idr INFO: index:69 psnr: 39.869729913710245
70 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:50] idr INFO: index:70 psnr: 37.56142861798856
71 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:50] idr INFO: index:71 psnr: 41.36228311035232
72 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:50] idr INFO: index:72 psnr: 42.49214643067096
73 [1, 3, 5172, 3816] [1, 3, 5172, 3816]
[09/06 16:00:56] idr INFO: index:73 psnr: 30.596045759070094
74 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:56] idr INFO: index:74 psnr: 41.7324371813889
75 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:56] idr INFO: index:75 psnr: 52.805572454555964
76 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:00:57] idr INFO: index:76 psnr: 39.46628623782252
77 [1, 3, 842, 596] [1, 3, 842, 596]
[09/06 16:00:57] idr INFO: index:77 psnr: 38.33035209573889
78 [1, 3, 1297, 1297] [1, 3, 1297, 1297]
[09/06 16:00:57] idr INFO: index:78 psnr: 35.88476210267104
79 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:57] idr INFO: index:79 psnr: 38.29374392004137
80 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:58] idr INFO: index:80 psnr: 45.68249357483042
81 [1, 3, 986, 986] [1, 3, 986, 986]
[09/06 16:00:58] idr INFO: index:81 psnr: 39.783151984843066
82 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:58] idr INFO: index:82 psnr: 48.663501304092414
83 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:00:58] idr INFO: index:83 psnr: 41.09503870588482
84 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:00:58] idr INFO: index:84 psnr: 37.15763933495202
85 [1, 3, 729, 729] [1, 3, 729, 729]
[09/06 16:00:59] idr INFO: index:85 psnr: 41.55915586645804
86 [1, 3, 2744, 2032] [1, 3, 2744, 2032]
[09/06 16:01:00] idr INFO: index:86 psnr: 32.34431039550687
87 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:00] idr INFO: index:87 psnr: 42.47196995301565
88 [1, 3, 842, 596] [1, 3, 842, 596]
[09/06 16:01:00] idr INFO: index:88 psnr: 49.6145290774711
89 [1, 3, 794, 596] [1, 3, 794, 596]
[09/06 16:01:01] idr INFO: index:89 psnr: 43.141009872204265
90 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:01] idr INFO: index:90 psnr: 37.390873354796014
91 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:01] idr INFO: index:91 psnr: 39.54044012165299
92 [1, 3, 1103, 1103] [1, 3, 1103, 1103]
[09/06 16:01:02] idr INFO: index:92 psnr: 41.862371551942715
93 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:02] idr INFO: index:93 psnr: 52.102838855435635
94 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:02] idr INFO: index:94 psnr: 47.947415960456865
95 [1, 3, 888, 888] [1, 3, 888, 888]
[09/06 16:01:02] idr INFO: index:95 psnr: 32.30235564065919
96 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:02] idr INFO: index:96 psnr: 43.114830882730715
97 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:03] idr INFO: index:97 psnr: 42.7166127286562
98 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:03] idr INFO: index:98 psnr: 46.46320665056153
99 [1, 3, 4060, 2876] [1, 3, 4060, 2876]
[09/06 16:01:06] idr INFO: index:99 psnr: 29.57304560646285
100 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:06] idr INFO: index:100 psnr: 40.9006170014121
101 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:06] idr INFO: index:101 psnr: 35.933039948188444
102 [1, 3, 842, 596] [1, 3, 842, 596]
[09/06 16:01:06] idr INFO: index:102 psnr: 48.118100559263574
103 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:06] idr INFO: index:103 psnr: 38.52994407389617
104 [1, 3, 1051, 1051] [1, 3, 1051, 1051]
[09/06 16:01:07] idr INFO: index:104 psnr: 36.15358207699672
105 [1, 3, 675, 477] [1, 3, 675, 477]
[09/06 16:01:07] idr INFO: index:105 psnr: 43.97884856102121
106 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:07] idr INFO: index:106 psnr: 41.46122604835584
107 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:07] idr INFO: index:107 psnr: 43.76644925586869
108 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:08] idr INFO: index:108 psnr: 44.04272538946916
109 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:08] idr INFO: index:109 psnr: 57.74405818291561
110 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:08] idr INFO: index:110 psnr: 40.54736091147766
111 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:08] idr INFO: index:111 psnr: 43.87633974230975
112 [1, 3, 997, 997] [1, 3, 997, 997]
[09/06 16:01:09] idr INFO: index:112 psnr: 41.87660798224179
113 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:09] idr INFO: index:113 psnr: 45.57233236770402
114 [1, 3, 893, 893] [1, 3, 893, 893]
[09/06 16:01:09] idr INFO: index:114 psnr: 38.268195997344975
115 [1, 3, 1272, 1272] [1, 3, 1272, 1272]
[09/06 16:01:10] idr INFO: index:115 psnr: 41.189364768434174
116 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:10] idr INFO: index:116 psnr: 45.51766327214424
117 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:10] idr INFO: index:117 psnr: 41.86261196900041
118 [1, 3, 556, 556] [1, 3, 556, 556]
[09/06 16:01:10] idr INFO: index:118 psnr: 35.21906446439075
119 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:10] idr INFO: index:119 psnr: 42.081887378002506
120 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:11] idr INFO: index:120 psnr: 41.00318055454181
121 [1, 3, 1291, 1291] [1, 3, 1291, 1291]
[09/06 16:01:11] idr INFO: index:121 psnr: 40.26645506694709
122 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:11] idr INFO: index:122 psnr: 39.22401343230594
123 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:11] idr INFO: index:123 psnr: 43.526822679170024
124 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:12] idr INFO: index:124 psnr: 39.39210577736621
125 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:12] idr INFO: index:125 psnr: 40.8342808479894
126 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:12] idr INFO: index:126 psnr: 41.69506456296408
127 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:12] idr INFO: index:127 psnr: 46.328708085948435
128 [1, 3, 573, 573] [1, 3, 573, 573]
[09/06 16:01:12] idr INFO: index:128 psnr: 46.49451696613617
129 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:13] idr INFO: index:129 psnr: 43.70494629119541
130 [1, 3, 1398, 1398] [1, 3, 1398, 1398]
[09/06 16:01:13] idr INFO: index:130 psnr: 35.7519672044886
131 [1, 3, 1430, 1430] [1, 3, 1430, 1430]
[09/06 16:01:14] idr INFO: index:131 psnr: 32.97227559190779
132 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:14] idr INFO: index:132 psnr: 40.06976637524395
133 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:14] idr INFO: index:133 psnr: 55.323322934504446
134 [1, 3, 645, 645] [1, 3, 645, 645]
[09/06 16:01:14] idr INFO: index:134 psnr: 25.79354731905834
135 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:14] idr INFO: index:135 psnr: 47.13832803156224
136 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:14] idr INFO: index:136 psnr: 41.90350763620758
137 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:15] idr INFO: index:137 psnr: 38.53646061887436
138 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:15] idr INFO: index:138 psnr: 46.87382033446596
139 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:15] idr INFO: index:139 psnr: 39.40803050861555
140 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:15] idr INFO: index:140 psnr: 39.35252124612021
141 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:16] idr INFO: index:141 psnr: 36.14028926758908
142 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:16] idr INFO: index:142 psnr: 41.951665193630426
143 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:16] idr INFO: index:143 psnr: 37.39161529561546
144 [1, 3, 2648, 1864] [1, 3, 2648, 1864]
[09/06 16:01:17] idr INFO: index:144 psnr: 34.20447256234717
145 [1, 3, 567, 567] [1, 3, 567, 567]
[09/06 16:01:17] idr INFO: index:145 psnr: 42.81732154939804
146 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:18] idr INFO: index:146 psnr: 45.21678359564274
147 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:18] idr INFO: index:147 psnr: 37.68631330864981
148 [1, 3, 1256, 1256] [1, 3, 1256, 1256]
[09/06 16:01:18] idr INFO: index:148 psnr: 35.85025882096241
149 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:19] idr INFO: index:149 psnr: 41.549630063394105
150 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:19] idr INFO: index:150 psnr: 47.78546367787346
151 [1, 3, 842, 596] [1, 3, 842, 596]
[09/06 16:01:19] idr INFO: index:151 psnr: 41.64881613368902
152 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:19] idr INFO: index:152 psnr: 48.38299151653686
153 [1, 3, 794, 596] [1, 3, 794, 596]
[09/06 16:01:19] idr INFO: index:153 psnr: 41.885842608582415
154 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:20] idr INFO: index:154 psnr: 37.82806651211091
155 [1, 3, 794, 596] [1, 3, 794, 596]
[09/06 16:01:20] idr INFO: index:155 psnr: 45.294859445416044
156 [1, 3, 864, 864] [1, 3, 864, 864]
[09/06 16:01:20] idr INFO: index:156 psnr: 44.53128074695094
157 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:20] idr INFO: index:157 psnr: 39.002173224562945
158 [1, 3, 2716, 2144] [1, 3, 2716, 2144]
[09/06 16:01:22] idr INFO: index:158 psnr: 35.62795253724735
159 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:22] idr INFO: index:159 psnr: 37.65165394181859
160 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:22] idr INFO: index:160 psnr: 39.706496077057785
161 [1, 3, 971, 971] [1, 3, 971, 971]
[09/06 16:01:23] idr INFO: index:161 psnr: 35.87918022707337
162 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:23] idr INFO: index:162 psnr: 43.69144896315276
163 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:23] idr INFO: index:163 psnr: 45.225624012249824
164 [1, 3, 2804, 2068] [1, 3, 2804, 2068]
[09/06 16:01:24] idr INFO: index:164 psnr: 34.94615117635754
165 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:25] idr INFO: index:165 psnr: 41.602804018064006
166 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:25] idr INFO: index:166 psnr: 41.70000750355101
167 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:25] idr INFO: index:167 psnr: 45.29255309470665
168 [1, 3, 794, 596] [1, 3, 794, 596]
[09/06 16:01:25] idr INFO: index:168 psnr: 50.3242744449294
169 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:25] idr INFO: index:169 psnr: 39.34297172010958
170 [1, 3, 842, 596] [1, 3, 842, 596]
[09/06 16:01:26] idr INFO: index:170 psnr: 42.946787475491554
171 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:26] idr INFO: index:171 psnr: 46.38395107650487
172 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:26] idr INFO: index:172 psnr: 42.47766061738099
173 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:26] idr INFO: index:173 psnr: 42.864285135371375
174 [1, 3, 842, 596] [1, 3, 842, 596]
[09/06 16:01:26] idr INFO: index:174 psnr: 37.21174669572365
175 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:27] idr INFO: index:175 psnr: 41.95926349263687
176 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:27] idr INFO: index:176 psnr: 41.427449911107644
177 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:27] idr INFO: index:177 psnr: 41.59022515061159
178 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:27] idr INFO: index:178 psnr: 41.94891798564385
179 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:27] idr INFO: index:179 psnr: 51.01548609315576
180 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:28] idr INFO: index:180 psnr: 38.70061126114004
181 [1, 3, 682, 682] [1, 3, 682, 682]
[09/06 16:01:28] idr INFO: index:181 psnr: 38.31449591964016
182 [1, 3, 1176, 1176] [1, 3, 1176, 1176]
[09/06 16:01:28] idr INFO: index:182 psnr: 43.12236176195298
183 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:29] idr INFO: index:183 psnr: 46.03886002026955
184 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:29] idr INFO: index:184 psnr: 45.093547713052864
185 [1, 3, 2984, 3988] [1, 3, 2984, 3988]
[09/06 16:01:32] idr INFO: index:185 psnr: 43.89869313955099
186 [1, 3, 1175, 1175] [1, 3, 1175, 1175]
[09/06 16:01:32] idr INFO: index:186 psnr: 40.8526608674172
187 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:32] idr INFO: index:187 psnr: 44.01129608327339
188 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:32] idr INFO: index:188 psnr: 37.75595807366984
189 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:33] idr INFO: index:189 psnr: 38.955481824521925
190 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:33] idr INFO: index:190 psnr: 40.35141965759828
191 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:33] idr INFO: index:191 psnr: 39.05312076264889
192 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:33] idr INFO: index:192 psnr: 41.003768285265814
193 [1, 3, 842, 596] [1, 3, 842, 596]
[09/06 16:01:33] idr INFO: index:193 psnr: 45.34882866034956
194 [1, 3, 2972, 3904] [1, 3, 2972, 3904]
[09/06 16:01:36] idr INFO: index:194 psnr: 34.43213224343949
195 [1, 3, 1527, 1000] [1, 3, 1527, 1000]
[09/06 16:01:36] idr INFO: index:195 psnr: 37.7466193506124
196 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:37] idr INFO: index:196 psnr: 37.17387073609066
197 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:37] idr INFO: index:197 psnr: 39.89629717122425
198 [1, 3, 792, 612] [1, 3, 792, 612]
[09/06 16:01:37] idr INFO: index:198 psnr: 49.3846214619217
199 [1, 3, 684, 548] [1, 3, 684, 548]
[09/06 16:01:37] idr INFO: index:199 psnr: 43.90796185457609
epoch:1, psnr:40.9594308354455
[09/06 16:01:38] idr INFO: epoch: 1, ave_psnr: 40.9594308354455, best_psnr: 40.9594308354455
[09/06 16:02:27] idr INFO: [900/425500] Generator Loss of epoch2 is 0.33865, idr, mask,  Lr:9.200000000000001e-05
[09/06 16:04:03] idr INFO: [1000/425500] Generator Loss of epoch2 is 0.34459, idr, mask,  Lr:9.200000000000001e-05
^C
Traceback (most recent call last):File "work/train.py", line 103, in <module>G_loss = criterion(imgs, masks, x_o1, x_o2, x_o3, fake_images, mm, gt, count, epoch)File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 917, in __call__return self._dygraph_call_func(*inputs, **kwargs)File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 907, in _dygraph_call_funcoutputs = self.forward(*inputs, **kwargs)File "/home/aistudio/work/loss/Loss.py", line 57, in forwardholeLoss =  self.l1((1 - mask) * output, (1 - mask) * gt)File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/math_op_patch.py", line 215, in __impl__return scalar_method(self, other_var)File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/math_op_patch.py", line 175, in _scalar_rsub_return _scalar_elementwise_op_(var, -1.0, value)File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/math_op_patch.py", line 109, in _scalar_elementwise_op_return _C_ops.scale(var, 'scale', scale, 'bias', bias)
KeyboardInterrupt
# step 2
%cd ~
!python work/train.py \--modelsSavePath savepath2 \--batchSize 16 \--loadSize 256 \--pretrained /home/aistudio/work/savepath1/best.pdparams \--lr 5e-5 \--num_epochs 500 \--lr_decay_iters 10 \--logPath /home/aistudio/work/log2
# step 3
%cd ~
!python work/train.py \--modelsSavePath savepath3 \--batchSize 2 \--loadSize 512 \--pretrained /home/aistudio/work/savepath2/best.pdparams \--lr 1e-5 \--num_epochs 500 \--lr_decay_iters 10 \--logPath /home/aistudio/work/log3

生成测试结果

%cd ~
!python work/predict.py /home/aistudio/data/dehw_testA_dataset /home/aistudio/work/resultA
#!python work/predict.py /home/aistudio/data/dehw_testB_dataset /home/aistudio/work/resultB
/home/aistudio
W0906 17:14:56.139024  2109 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 10.1
W0906 17:14:56.143882  2109 device_context.cc:465] device: 0, cuDNN Version: 7.6.
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/tensor/creation.py:130: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecationsif data.dtype == np.object:
^C
Traceback (most recent call last):File "work/predict.py", line 104, in <module>process(src_image_dir, save_dir)File "work/predict.py", line 75, in processg_images_clip = g_images_clip.cpu()
KeyboardInterrupt

.objectis a deprecated alias for the builtinobject. To silence this warning, use object` by itself. Doing this will not modify any behavior and is safe.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
if data.dtype == np.object:
^C
Traceback (most recent call last):
File “work/predict.py”, line 104, in
process(src_image_dir, save_dir)
File “work/predict.py”, line 75, in process
g_images_clip = g_images_clip.cpu()
KeyboardInterrupt

百度网盘AI大赛-通用场景手写文字擦除亚军方案相关推荐

  1. 百度网盘AI大赛-水印智能消除赛第3名方案

    百度网盘AI大赛-水印智能消除赛第3名方案 项目简介 本项目是百度网盘AI大赛--图像处理挑战赛:百度水印智能消除赛第3名的解决方案.在该项目中,我们对本次赛题的任务与数据进行了分析,并在此基础上详细 ...

  2. 第三季百度网盘AI大赛盛夏来袭,寻找热爱AI的你!

    青春总会因为热爱一件事,开始闪闪发光,从这里开始吗?没错!第三季百度网盘AI大赛盛大来袭,舞台已经准备好,Are you ready? 参赛福利 划重点!参加比赛有机会获得大手笔奖励呦! 万元现金 报 ...

  3. 【百度网盘AI大赛——表格检测】Mask R-CNN 方案

    ★★★ 本文源自AI Studio社区精品项目,[点击此处]查看更多精品内容 >>> [百度网盘AI大赛-表格检测]MASK R-CNN 方案 一.项目背景 1.1 比赛介绍 背景: ...

  4. 百度网盘AI大赛-图像处理挑战赛:文档检测优化赛 Baseline

    转自AI Studio,原文链接:百度网盘AI大赛-图像处理挑战赛:文档检测优化赛 Baseline - 飞桨AI Studio 百度网盘AI大赛-图像处理挑战赛:文档检测优化赛 使用Resnet15 ...

  5. 百度网盘AI大赛:文档图像摩尔纹消除(赛题一) Baseline

    赛题介绍 百度网盘AI大赛--图像处理挑战赛是 百度网盘开放平台 面向AI开发者和爱好者发起的计算机视觉领域挑战赛.AI时代已到来,百度网盘与百度飞桨AI Studio强强联合,旨在基于个人云存储的生 ...

  6. android历史记录去重,百度网盘有哪些实用的功能_百度网盘实用功能相关介绍_3DM手游...

    现在说到网盘之类的储存工具,就不得不提起百度网盘,相信用过百度网盘的老司机都知道其功能的强大之处.除了大家都知道的储存下载资源之外,百度网盘还有不少实用的功能,下面我们一起来了解下. 1. 手机联系人 ...

  7. 百度AI攻略:手写文字识别

    1.功能描述: 支持对图片中的手写中文.手写数字进行检测和识别,针对不规则的手写字体进行专项优化,识别准确率可达90%以上 2.平台接入 具体接入方式比较简单,可以参考我的另一个帖子,这里就不重复了: ...

  8. 分享软件——百度网盘快速下载和照片转字符文字

    链接:https://pan.baidu.com/s/1Im_8ZU9hHpkK-qnqSMiqAw  提取码:oxgl  复制这段内容后打开百度网盘手机App,操作更方便哦

  9. 百度网盘网页倍速播放视频的小技巧

    百度网盘的客户端软件和手机端软件是需要开会员才能倍速播放的!但是开了会员在网页端缺无法实现倍速播放! 今天就看到一位大佬的解决方法,是通过解析网页代码实现的!具体原理就不说了.具体操作如下: 1.你需 ...

最新文章

  1. 早上突然看明白 shader和材质球的关系
  2. QT的QDesignerFormWindowInterface类的使用
  3. 第三次学JAVA再学不好就吃翔(part16)--方法及方法重载
  4. CentOS下安装网卡驱动
  5. cuda 核函数 for循环_【CUDA 基础】4.4 核函数可达到的带宽
  6. 安全模式下修复电脑故障
  7. STP端口状态特点、STP端口角色特点、链路状态发生变化,STP如何重新收敛? TCN何时发?uplinkfast技术、Portfast技术、backbonefast技术、常见的STP调整命令:
  8. Atitit 工作流之道 艾提拉著 BPM,即业务流程管理 目录 1. 流程入门 思想 历史 分类 1 第二篇 第2章 初识工作流 2 1.1. 2.3 工作流技术相关规范  2.3.1 W
  9. [私人] T460p上运行orbit_js报ERR_NO_ICU的问题
  10. Agent建模之Repast建模编程介绍
  11. WPF QQ群发助手
  12. Windows 10系统下Outlook日历怎么显示农历?
  13. SolidWorks-旋转凸台的使用
  14. Mathtype 花体字 Euclid math one/two 不能显示的问题
  15. 第一次谈兼职写书的经过
  16. 微信小程序校园生活小助手+后台管理系统前后分离VUE
  17. android中app分享小程序卡片及跳转回app
  18. ai智能电话机器人语音识别技术
  19. C语言一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?
  20. latex 公式 (正式,非正式。编号,不编号)

热门文章

  1. 如何禁止WordPress站点前端显示管理工具栏?附3种方法
  2. 计算机视觉:卷积神经网络在计算机视觉领域大放异彩的原因
  3. python爬虫实战(三)——猪八戒网(xpath)
  4. java 异步定时任务_spring 定时任务 异步调用
  5. STM32之TIM定时器
  6. 主梁弹性模量计算_4 主梁作用效应计算
  7. 【有机】祝介平课题组JACS:利用钯催化氧化[2+2]环化合成苯并环丁烯
  8. CAD怎么快速用计算机加面积,建筑设计中如何快速完成面积统计?看这里
  9. 套路太多!这3个号段1.5亿用户将无法携号转网!
  10. 极端天气下的目标检测与测距算法