update ieemoo-ai-isempty.py.

This commit is contained in:
Brainway
2022-11-09 03:34:47 +00:00
committed by Gitee
parent 7a1c101307
commit 40154b9825

View File

@ -134,32 +134,32 @@ def get_isempty():
imgdata = base64.b64decode(pic) imgdata = base64.b64decode(pic)
imgdata_np = np.frombuffer(imgdata, dtype='uint8') imgdata_np = np.frombuffer(imgdata, dtype='uint8')
img_src = cv2.imdecode(imgdata_np, cv2.IMREAD_COLOR) img_src = cv2.imdecode(imgdata_np, cv2.IMREAD_COLOR)
#cv2.imwrite('huanyuan.jpg',img_src) cv2.imwrite('huanyuan.jpg',img_src)
img_data = Image.fromarray(np.uint8(img_src)) #这个转换不能要,会导致判空错误增加 #img_data = Image.fromarray(np.uint8(img_src)) #这个转换不能要,会导致判空错误增加
#img_data = Image.open('huanyuan.jpg') img_data = Image.open('huanyuan.jpg')
result = predictor.normal_predict(img_data, result) # 1==empty, 0==nonEmpty result = predictor.normal_predict(img_data, result) # 1==empty, 0==nonEmpty
#riseresult = lightrise.riseempty(img_data) riseresult = lightrise.riseempty(img_data)
#print(riseresult["rst_cls"]) #print(riseresult["rst_cls"])
# if(result["rst_cls"]==1): if(result["rst_cls"]==1):
# if(riseresult["rst_cls"]==1): if(riseresult["rst_cls"]==1):
# result = {} result = {}
# result["success"] = "true" result["success"] = "true"
# result["rst_cls"] = 1 result["rst_cls"] = 1
# else: else:
# result = {} result = {}
# result["success"] = "true" result["success"] = "true"
# result["rst_cls"] = 0 result["rst_cls"] = 0
# else: else:
# if(riseresult["rst_cls"]==0): if(riseresult["rst_cls"]==0):
# result = {} result = {}
# result["success"] = "true" result["success"] = "true"
# result["rst_cls"] = 0 result["rst_cls"] = 0
# else: else:
# result = {} result = {}
# result["success"] = "true" result["success"] = "true"
# result["rst_cls"] = 1 result["rst_cls"] = 1
return repr(result) return repr(result)