fix deeplabv3p_xception65_humanseg inference client bug
data = cv2.imdecode(data, cv2.IMREAD_COLOR)
return data
+ org_im = cv2.imread("/PATH/TO/IMAGE")
# Send an HTTP request
- data = {'images':[cv2_to_base64(cv2.imread("/PATH/TO/IMAGE"))]}
+ data = {'images':[cv2_to_base64(org_im)]}
headers = {"Content-type": "application/json"}
url = "http://127.0.0.1:8866/predict/deeplabv3p_xception65_humanseg"
- r = requests.post(url=url, headers=headers,
+ r = requests.post(url=url, headers=headers, data=json.dumps(data))
mask =cv2.cvtColor(base64_to_cv2(r.json()["results"][0]['data']), cv2.COLOR_BGR2GRAY)
rgba = np.concatenate((org_im, np.expand_dims(mask, axis=2)), axis=2)
cv2.imwrite("segment_human_server.png", rgba)
