1. fix yaml error

2. fix model load path error
pull/251/merge
文贤平 2019-06-13 11:37:16 +08:00
parent 6fa4020593
commit f50e597192
4 changed files with 13 additions and 12 deletions

View File

@ -100,10 +100,8 @@
```
- 自动更换ip软件目前已支持TPLINK和小米路由器只限家庭网络[点我跳转](https://github.com/testerSunshine/AutoRouterIP)
- 关于登录接口需要识别DEVICES_ID的情况可以使用本地打开12306在任意一接口里面抓取DEVICES_ID填于login.py文件中的141行
```
原来的 devicesId = eval(devicesIdRsp.split("(")[1].split(")")[0].replace("'", ""))["dfp"]
更换为 devicesId = 刚才抓取的DEVICES_ID填上即可
```
- `原来的 devicesId = eval(devicesIdRsp.split("(")[1].split(")")[0].replace("'", ""))["dfp"]`
- `更换为 devicesId = 刚才抓取的DEVICES_ID填上即可`
- 浏览器截图
![image](https://github.com/testerSunshine/12306/blob/master/uml/REIL_DEVICEID.png)

View File

@ -1,6 +1,4 @@
# -*- coding: utf8 -*-
from config import configCommon
__author__ = 'MR.wen'
import os
import yaml
@ -14,10 +12,10 @@ def _get_yaml():
path = os.path.join(os.path.dirname(__file__) + '/ticket_config.yaml')
try: # 兼容2和3版本
with open(path, encoding="utf-8") as f:
s = yaml.load(f, Loader=yaml.FullLoader)
s = yaml.load(f)
except Exception:
with open(path) as f:
s = yaml.load(f, Loader=yaml.FullLoader)
s = yaml.load(f)
return s.decode() if isinstance(s, bytes) else s

View File

@ -1,9 +1,9 @@
beautifulsoup4==4.5.3
bs4==0.0.1
PyYAML==4.2b1
PyYAML>5.1.1
six==1.10.0
requests==2.18.4
Pillow==5.0.0
Pillow
wrapcache==1.0.8
ntplib==0.3.3
sklearn

View File

@ -1,5 +1,7 @@
# coding: utf-8
import base64
import os
import cv2
import numpy as np
from keras import models
@ -7,6 +9,9 @@ from keras import models
from verify import pretreatment
from verify.mlearn_for_image import preprocess_input
PATH = lambda p: os.path.abspath(
os.path.join(os.path.dirname(__file__), p)
)
def get_text(img, offset=0):
@ -38,7 +43,7 @@ def verify(fn):
imgs = preprocess_input(imgs)
text_list = []
# 识别文字
model = models.load_model('model.v2.0.h5')
model = models.load_model(PATH('../model.v2.0.h5'))
label = model.predict(text)
label = label.argmax()
text = verify_titles[label]
@ -59,7 +64,7 @@ def verify(fn):
text_list.append(text)
print("题目为{}".format(text_list))
# 加载图片分类器
model = models.load_model('12306.image.model.h5')
model = models.load_model(PATH('../12306.image.model.h5'))
labels = model.predict(imgs)
labels = labels.argmax(axis=1)
results = []