Skip to content
Snippets Groups Projects
Commit 72f97f36 authored by Anders Langlie's avatar Anders Langlie
Browse files

syncing with server

parent 40b5cff1
No related branches found
No related tags found
1 merge request!37Resolve "rematch function and endpoint"
......@@ -9,7 +9,7 @@ from path_constants import abs_path_imageai_model
from algorithm.train_src.new_straightening import _ACCESS_TF_AND_GPU_SEMA
EXTRACT_DETECTED_OBJECTS = False
MINIMUM_PERCENTAGE_PROBABILITY = 50
MINIMUM_PERCENTAGE_PROBABILITY = 0.1
NMS_TRESHOLD = 0.4
DISPLAY_PERCENTAGE_PROBABILITY = True
DISPLAY_OBJECT_NAME = True
......@@ -120,6 +120,8 @@ def run_estimation(detection_model_path: str = None, configuration_json: str = N
# find the best estimation:
seq = [x['percentage_probability'] for x in output_objects_array]
gender = None
if len(seq)>0:
index = seq.index(max(seq))
gender = output_objects_array[index]
# have to append because for some reason I can't x = [1,2,3]
......@@ -179,7 +181,7 @@ def estimate_image(detection_model_path: str = abs_path_imageai_model,
p = Process(target=run_estimation, args=args)
p.start()
p.join()
if return_dict[0]['name']:
if return_dict[0]:
gender = return_dict[0]['name']
return gender, return_dict[1], return_dict[2], return_dict[3]
return gender, None, None, None
......
......@@ -5,7 +5,7 @@ from path_constants import abs_path_temp_images
def test():
img_path = abs_path_temp_images + "/aspectTest.jpg"
img_path = abs_path_temp_images + "/2.png"
execution_path = os.getcwd()
img = cv2.imread(img_path)
if None is not img:
......
......@@ -38,7 +38,8 @@ class FindSalamanderInfo(Resource):
str_image = cv2.cvtColor(str_image, cv2.COLOR_BGR2RGB)
cv2.imwrite(os.path.join(temp_img_path, str(user_id) + "_str." + image_type), str_image)
encoded = encode(os.path.join(temp_img_path, str(user_id) + "_str." + image_type))[2:-1]
gender, _, _, _ = estimate_image(abs_path_imageai_model,abs_path_imageai_config)
gender, _, _, _ = estimate_image(abs_path_imageai_model,abs_path_imageai_config, img)
print(gender)
return jsonify({"sex": gender, "species": "AI_species", "status": 200, "image": encoded})
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment