diff --git a/backend/app/api.py b/backend/app/api.py index 1fb3b6e0361116a8b9821c42e70591e472be46bf..6082912258590e7cff0e793d1c89de9e1af23b51 100644 --- a/backend/app/api.py +++ b/backend/app/api.py @@ -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 diff --git a/backend/requirements.txt b/backend/requirements.txt index 2d8a28f5df71ff9b293817b9c7c3386a4bef02a6..c5e51aa9fca602b3823b860a68bd42baebf22daa 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,2 +1,14 @@ +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