# 起步-下载 坐标验证码识别训练案例.rar ![image.png](http://upload-images.jianshu.io/upload_images/4907501-d65c60ef905507c4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) # 开始准备样本 `samples-label.txt` ``` samples/0.jpg 204 50 239 85 306 79 341 114 samples/1.jpg 315 129 350 164 142 66 177 101 95 127 130 162 samples/2.jpg 154 93 189 128 85 147 120 182 108 21 143 56 299 44 334 79 216 67 251 102 samples/3.jpg 177 113 212 148 17 118 52 153 262 60 297 95 41 34 76 69 153 78 188 113 samples/4.jpg 77 159 112 194 150 135 185 170 235 47 270 82 156 79 191 114 samples/5.jpg 98 97 133 132 48 67 83 102 samples/6.jpg 320 84 355 119 172 38 207 73 samples/7.jpg 78 121 113 156 91 39 126 74 samples/8.jpg 309 136 344 171 99 138 134 173 51 163 86 198 250 69 285 104 140 60 175 95 samples/9.jpg 301 128 336 163 44 86 79 121 236 68 271 103 18 50 53 85 ``` 这是是坐标数据. ![image.png](http://upload-images.jianshu.io/upload_images/4907501-cb556d012d10a782.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 一个坐标一个点 # 1.生成样本 运行后会生成出来样本 `make_data.py` ![image.png](http://upload-images.jianshu.io/upload_images/4907501-aa93130f523b41ad.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](http://upload-images.jianshu.io/upload_images/4907501-060652d737a68338.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) | 名称 | 描述 | | --- | --- | | negative | 0 负样本,重叠程度小于30% | | part | -1 部分样本,重叠程度大于40%但是小于65% | | positive | 1 正样本,重叠程度大于65% 确定样本 | ![image.png](http://upload-images.jianshu.io/upload_images/4907501-2fd206317dea86eb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) [图片上传失败...(image-622082-1521099986521)] ![image.png](http://upload-images.jianshu.io/upload_images/4907501-e4379339eeacf491.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](http://upload-images.jianshu.io/upload_images/4907501-1696c636854e6d9d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) # 2.聚合训练样本 `make_list.py` 没什么提示 执行就好了 ![image.png](http://upload-images.jianshu.io/upload_images/4907501-514a2c711b3862fe.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](http://upload-images.jianshu.io/upload_images/4907501-ce938491b6cb844a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 实际上就是把3个文件合并到一个文件上,需要注意·neg_48.txt·里面的需要补-1 ,其他都是直接合并。 例如 ``` 48/negative/26714.jpg 0 -1 -1 -1 -1 48/negative/26715.jpg 0 -1 -1 -1 -1 ``` # 3.生成数据库 `make-lmdb-48.bat` ![image.png](http://upload-images.jianshu.io/upload_images/4907501-c95c464062c3515f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](http://upload-images.jianshu.io/upload_images/4907501-141ff51114b6fcbf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) # 4.开始训练 loss 到 0.0几就可以了. `train-48.bat` ![image.png](http://upload-images.jianshu.io/upload_images/4907501-29507004799b667e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](http://upload-images.jianshu.io/upload_images/4907501-958f39bfa463dbdb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) # 5.调用 把训练好的模型调用起来 ![image.png](http://upload-images.jianshu.io/upload_images/4907501-abc2bb120dc18e1c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](http://upload-images.jianshu.io/upload_images/4907501-2d2608f2f18446b2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![image.png](http://upload-images.jianshu.io/upload_images/4907501-52d2a34a8e4f61fa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)