update
This commit is contained in:
@ -20,10 +20,11 @@ app = Flask(__name__)
|
||||
app.use_reloader=False
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
#parser.add_argument('--weights', nargs='+', type=str, default='runs/zhanting/yolov5l/best_1_30.pt', help='model.pt path(s)')
|
||||
parser.add_argument('--weights', nargs='+', type=str, default='../module/ieemoo-ai-zhanting/best.pt', help='model.pt path(s)')
|
||||
parser.add_argument('--source', type=str, default='../module/ieemoo-ai-zhanting/imgs/1.jpg', 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('--conf-thres', type=float, default=0.50, help='object confidence threshold')
|
||||
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
|
||||
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
||||
parser.add_argument('--view-img', type=bool, default=True, help='display results')
|
||||
@ -51,29 +52,31 @@ def get_isempty():
|
||||
# getdateend = time.time()
|
||||
# print('get date use time: {0:.2f}s'.format(getdateend - start))
|
||||
|
||||
pic = json_data.get("file")
|
||||
pic = json_data.get("pic")
|
||||
result = {"success": "false",
|
||||
"rst_cls": '-1',
|
||||
}
|
||||
|
||||
imgdata = base64.b64decode(pic)
|
||||
image_path = '../module/ieemoo-ai-zhanting/imgs/1.jpg'
|
||||
file = open(image_path, 'wb')
|
||||
file.write(imgdata)
|
||||
pred = detect.detect(opt)
|
||||
print('pred', pred)
|
||||
getdateend = time.time()
|
||||
now_time = datetime.datetime.now()
|
||||
print('now_time', now_time)
|
||||
print('get date use time: {0:.2f}s'.format(getdateend - start))
|
||||
|
||||
try:
|
||||
imgdata = base64.b64decode(pic)
|
||||
image_path = '../module/ieemoo-ai-zhanting/imgs/1.jpg'
|
||||
file = open(image_path, 'wb')
|
||||
file.write(imgdata)
|
||||
pred = detect.detect(opt)
|
||||
print('pred', pred)
|
||||
getdateend = time.time()
|
||||
now_time = datetime.datetime.now()
|
||||
print('now_time', now_time)
|
||||
print('get date use time: {0:.2f}s'.format(getdateend - start))
|
||||
except:
|
||||
return repr(pred)
|
||||
|
||||
return repr(pred)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
#http_server = WSGIServer(('0.0.0.0', 8083), app)
|
||||
#http_server = WSGIServer(('0.0.0.0', 8082), app)
|
||||
#http_server.serve_forever()
|
||||
|
||||
|
||||
@ -83,9 +86,3 @@ if __name__ == "__main__":
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user