Skip to content
Snippets Groups Projects
Commit ee96ea3c authored by Aymeric Chaumont's avatar Aymeric Chaumont
Browse files

update dependencies

parent f41e23cc
Branches
No related tags found
1 merge request!1setting up repo
......@@ -33,7 +33,7 @@ contours = {
masks = {}
for key, polygon in contours.items():
mask = np.zeros((1280, 720, 3), dtype='float32')
mask = np.zeros((1280, 720, 3), dtype=np.unit8)
cv2.fillPoly(mask, [polygon], (255, 255, 255))
masks[key] = mask
......@@ -49,16 +49,3 @@ async def estimate_(id: str) -> float:
pred_map = np.squeeze(model.predict(input_image))
count_prediction = np.sum(pred_map)
return count_prediction
@app.get("/estimate/{id}")
async def estimate_(id: str) -> float:
# img = fetch(...)
img = np.zeros((1280, 720, 3))
resized_img = cv2.cvtColor(cv2.resize(img, (1280, 720)), cv2.COLOR_BGR2RGB).astype(np.float32)
masked_img = cv2.bitwise_and(resized_img, mask[id])
treated_img = fix_singular_shape(masked_img, 16)
input_image = np.expand_dims(np.squeeze(norm_by_imagenet([treated_img])), axis=0)
pred_map = np.squeeze(model.predict(input_image))
count_prediction = round(np.sum(pred_map))
return count_prediction
\ No newline at end of file
anyio==3.6.1
asgiref==3.5.2
click==8.1.3
fastapi==0.78.0
h11==0.13.0
idna==3.3
keras==2.9.0
numpy==1.23.0
opencv-python==4.6.0.66
pydantic==1.9.1
sniffio==1.2.0
starlette==0.19.1
typing-extensions==4.2.0
uvicorn==0.17.6
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment