update
This commit is contained in:
@ -37,9 +37,9 @@ app.logger.addHandler(handler)
|
||||
load model
|
||||
'''
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--weights', nargs='+', type=str, default='weightsv5s', help='model.pt path(s)')
|
||||
parser.add_argument('--weights', nargs='+', type=str, default='../module/ieemoo-ai-predict/', help='model.pt path(s)')
|
||||
parser.add_argument('--Form', type=str, default='')
|
||||
parser.add_argument('--source', type=str, default='data/images', help='source') # file/folder, 0 for webcam
|
||||
parser.add_argument('--source', type=str, default='../module/ieemoo-ai-predict/imgs', help='source') # file/folder, 0 for webcam
|
||||
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
|
||||
parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
|
||||
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
|
||||
@ -65,7 +65,8 @@ def loadModel():
|
||||
device = select_device(opt.device)
|
||||
half = device.type != 'cpu'
|
||||
for name in os.listdir(opt.weights):
|
||||
all_model[name.split('.')[0]] = attempt_load(os.sep.join(['weightsv5s', name]), map_location=device)
|
||||
if '.pt' in name:
|
||||
all_model[name.split('.')[0]] = attempt_load(os.sep.join([opt.weights, name]), map_location=device)
|
||||
return all_model
|
||||
|
||||
def CheckRange(code):
|
||||
@ -177,6 +178,7 @@ def predict():
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
data = request.get_data()
|
||||
print(type(data))
|
||||
data_str = data.decode("utf-8")
|
||||
json_data = json.loads(data_str)
|
||||
pic = json_data.get("file")
|
||||
@ -191,7 +193,7 @@ def predict():
|
||||
section = 'nonentity'
|
||||
else:
|
||||
model = all_model[section]
|
||||
cv2.imwrite(os.sep.join(['data/images',code+'.jpg']), image)
|
||||
cv2.imwrite(os.sep.join(['../module/ieemoo-ai-predict/imgs',code+'.jpg']), image)
|
||||
with torch.no_grad():
|
||||
if section == 'nonentity':
|
||||
tar_res = {'tag':False}
|
||||
@ -201,11 +203,11 @@ def predict():
|
||||
#ocr_res = detectOcr(barcode, ocr, 'data/images/'+code+'.jpg')
|
||||
ocr_res = {"Ocr": {"barcode_rst": "", "barcode_success": "false", "ocr_rst": "", "ocr_success": False}}
|
||||
ocr_res.update(tar_res)
|
||||
os.remove(os.sep.join(['data/images',code+'.jpg']))
|
||||
os.remove(os.sep.join(['../module/ieemoo-ai-predict/imgs',code+'.jpg']))
|
||||
return ocr_res
|
||||
except:
|
||||
return {"Ocr": {"barcode_rst": "", "barcode_success": "false", "ocr_rst": "", "ocr_success": False}, "TargetDetect": {""}, "tag": False}
|
||||
if __name__ == '__main__':
|
||||
#http_server = WSGIServer(('0.0.0.0', 8084), app)
|
||||
#http_server.serve_forever()
|
||||
app.run()
|
||||
http_server = WSGIServer(('0.0.0.0', 8000), app)
|
||||
http_server.serve_forever()
|
||||
#app.run()
|
||||
|
@ -1,80 +1,19 @@
|
||||
absl-py==1.0.0
|
||||
Bottleneck==1.3.2
|
||||
brotlipy==0.7.0
|
||||
cachetools==5.0.0
|
||||
certifi==2021.10.8
|
||||
cffi @ file:///tmp/build/80754af9/cffi_1625807838443/work
|
||||
charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work
|
||||
click==8.0.3
|
||||
contextlib2==21.6.0
|
||||
cryptography @ file:///tmp/build/80754af9/cryptography_1635366571107/work
|
||||
cycler @ file:///tmp/build/80754af9/cycler_1637851556182/work
|
||||
docopt==0.6.2
|
||||
esdk-obs-python==3.21.8
|
||||
faiss==1.7.1
|
||||
Flask @ file:///tmp/build/80754af9/flask_1634118196080/work
|
||||
fonttools==4.25.0
|
||||
gevent @ file:///tmp/build/80754af9/gevent_1628273677693/work
|
||||
google-auth==2.6.0
|
||||
google-auth-oauthlib==0.4.6
|
||||
greenlet @ file:///tmp/build/80754af9/greenlet_1628887725296/work
|
||||
grpcio==1.44.0
|
||||
gunicorn==20.1.0
|
||||
h5py @ file:///tmp/build/80754af9/h5py_1637138879700/work
|
||||
idna @ file:///tmp/build/80754af9/idna_1637925883363/work
|
||||
importlib-metadata==4.11.3
|
||||
itsdangerous @ file:///tmp/build/80754af9/itsdangerous_1621432558163/work
|
||||
Jinja2 @ file:///tmp/build/80754af9/jinja2_1635780242639/work
|
||||
kiwisolver @ file:///tmp/build/80754af9/kiwisolver_1612282420641/work
|
||||
Markdown==3.3.6
|
||||
MarkupSafe @ file:///tmp/build/80754af9/markupsafe_1621528148836/work
|
||||
matplotlib @ file:///tmp/build/80754af9/matplotlib-suite_1638289681807/work
|
||||
mkl-fft==1.3.1
|
||||
mkl-random @ file:///tmp/build/80754af9/mkl_random_1626186064646/work
|
||||
mkl-service==2.4.0
|
||||
ml-collections==0.1.0
|
||||
munkres==1.1.4
|
||||
numexpr @ file:///tmp/build/80754af9/numexpr_1618856167419/work
|
||||
numpy @ file:///tmp/build/80754af9/numpy_and_numpy_base_1634095647912/work
|
||||
oauthlib==3.2.0
|
||||
olefile @ file:///Users/ktietz/demo/mc3/conda-bld/olefile_1629805411829/work
|
||||
opencv-python==4.5.4.60
|
||||
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
|
||||
pandas==1.3.4
|
||||
Pillow==8.4.0
|
||||
pipreqs==0.4.11
|
||||
protobuf==3.19.4
|
||||
pyasn1==0.4.8
|
||||
pyasn1-modules==0.2.8
|
||||
pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
|
||||
pycryptodome==3.10.1
|
||||
pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1635333100036/work
|
||||
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
|
||||
PySocks @ file:///tmp/build/80754af9/pysocks_1605305779399/work
|
||||
python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work
|
||||
pytz==2021.3
|
||||
esdk_obs_python==3.21.8
|
||||
Flask==2.0.0
|
||||
gevent==21.1.2
|
||||
matplotlib==3.4.1
|
||||
numpy==1.20.2
|
||||
esdk-obs-python --trusted-host pypi.org
|
||||
opencv_python==4.5.1.48
|
||||
Pillow==9.1.0
|
||||
scipy==1.6.2
|
||||
setuptools==49.6.0
|
||||
ml-collections==0.1.1
|
||||
coremltools==5.2.0
|
||||
onnx==1.7.0
|
||||
pandas==1.2.4
|
||||
pycocotools==2.0.2
|
||||
PyYAML==6.0
|
||||
requests @ file:///tmp/build/80754af9/requests_1629994808627/work
|
||||
requests-oauthlib==1.3.1
|
||||
rsa==4.8
|
||||
scipy @ file:///tmp/build/80754af9/scipy_1630606796110/work
|
||||
seaborn @ file:///tmp/build/80754af9/seaborn_1629307859561/work
|
||||
sip==4.19.13
|
||||
six @ file:///tmp/build/80754af9/six_1623709665295/work
|
||||
supervisor==4.2.2
|
||||
tensorboard==2.8.0
|
||||
tensorboard-data-server==0.6.1
|
||||
tensorboard-plugin-wit==1.8.1
|
||||
torch==1.8.0
|
||||
torchaudio==0.8.0a0+a751e1d
|
||||
torchvision==0.9.0
|
||||
tornado @ file:///tmp/build/80754af9/tornado_1606942300299/work
|
||||
tqdm @ file:///tmp/build/80754af9/tqdm_1635330843403/work
|
||||
typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1631814937681/work
|
||||
urllib3==1.26.7
|
||||
Werkzeug @ file:///tmp/build/80754af9/werkzeug_1635505089296/work
|
||||
yacs @ file:///tmp/build/80754af9/yacs_1634047592950/work
|
||||
yarg==0.1.9
|
||||
zipp==3.7.0
|
||||
zope.event==4.5.0
|
||||
zope.interface @ file:///tmp/build/80754af9/zope.interface_1625035545636/work
|
||||
requests==2.25.1
|
||||
seaborn==0.11.1
|
||||
tqdm==4.60.0
|
Reference in New Issue
Block a user