change calculation
Browse files
main.py
CHANGED
@@ -41,7 +41,7 @@ async def predict_image(file: UploadFile = File(...)):
|
|
41 |
pil_image= Image.open(io.BytesIO(image_file)).convert("RGB")
|
42 |
|
43 |
# resize image to 512x512
|
44 |
-
pil_image = pil_image.resize((
|
45 |
|
46 |
image_bg_removed= remove(pil_image, bgcolor=(0,0,255,255))
|
47 |
|
@@ -63,7 +63,7 @@ async def predict_image(file: UploadFile = File(...)):
|
|
63 |
if results[i]["label"] == "background":
|
64 |
continue
|
65 |
mask_area = calculate_mask_area(results[i]["mask"])
|
66 |
-
score = mask_area / (
|
67 |
results[i]["score"] = score
|
68 |
|
69 |
|
|
|
41 |
pil_image= Image.open(io.BytesIO(image_file)).convert("RGB")
|
42 |
|
43 |
# resize image to 512x512
|
44 |
+
pil_image = pil_image.resize((500, 500))
|
45 |
|
46 |
image_bg_removed= remove(pil_image, bgcolor=(0,0,255,255))
|
47 |
|
|
|
63 |
if results[i]["label"] == "background":
|
64 |
continue
|
65 |
mask_area = calculate_mask_area(results[i]["mask"])
|
66 |
+
score = mask_area / (500 * 500 - background_area)
|
67 |
results[i]["score"] = score
|
68 |
|
69 |
|