Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,16 +41,13 @@ def predict(pilimg,Threshold):
|
|
| 41 |
|
| 42 |
image_np = pil_image_as_numpy_array(pilimg)
|
| 43 |
if type(Threshold) is None:
|
| 44 |
-
Threshold=threshold_d
|
| 45 |
|
| 46 |
-
return predict2(image_np,Threshold),predict3(image_np,Threshold),Threshold
|
| 47 |
|
| 48 |
def predict2(image_np,Threshold):
|
| 49 |
|
| 50 |
results = detection_model(image_np)
|
| 51 |
-
|
| 52 |
-
if type(Threshold) is None:
|
| 53 |
-
Threshold=threshold_d
|
| 54 |
|
| 55 |
# different object detection models have additional results
|
| 56 |
result = {key:value.numpy() for key,value in results.items()}
|
|
@@ -66,7 +63,7 @@ def predict2(image_np,Threshold):
|
|
| 66 |
category_index,
|
| 67 |
use_normalized_coordinates=True,
|
| 68 |
max_boxes_to_draw=20,
|
| 69 |
-
min_score_thresh=
|
| 70 |
agnostic_mode=False,
|
| 71 |
line_thickness=2)
|
| 72 |
|
|
@@ -77,9 +74,6 @@ def predict2(image_np,Threshold):
|
|
| 77 |
|
| 78 |
def predict3(image_np,Threshold):
|
| 79 |
|
| 80 |
-
if type(Threshold) is None:
|
| 81 |
-
Threshold=threshold_d
|
| 82 |
-
|
| 83 |
results = detection_model2(image_np)
|
| 84 |
|
| 85 |
# different object detection models have additional results
|
|
@@ -96,7 +90,7 @@ def predict3(image_np,Threshold):
|
|
| 96 |
category_index,
|
| 97 |
use_normalized_coordinates=True,
|
| 98 |
max_boxes_to_draw=20,
|
| 99 |
-
min_score_thresh=
|
| 100 |
agnostic_mode=False,
|
| 101 |
line_thickness=2)
|
| 102 |
|
|
|
|
| 41 |
|
| 42 |
image_np = pil_image_as_numpy_array(pilimg)
|
| 43 |
if type(Threshold) is None:
|
| 44 |
+
Threshold=threshold_d.astype(int)
|
| 45 |
|
| 46 |
+
return predict2(image_np,Threshold),predict3(image_np,Threshold),Threshold.astype(int)
|
| 47 |
|
| 48 |
def predict2(image_np,Threshold):
|
| 49 |
|
| 50 |
results = detection_model(image_np)
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
# different object detection models have additional results
|
| 53 |
result = {key:value.numpy() for key,value in results.items()}
|
|
|
|
| 63 |
category_index,
|
| 64 |
use_normalized_coordinates=True,
|
| 65 |
max_boxes_to_draw=20,
|
| 66 |
+
min_score_thresh=Threshold,#0.38,
|
| 67 |
agnostic_mode=False,
|
| 68 |
line_thickness=2)
|
| 69 |
|
|
|
|
| 74 |
|
| 75 |
def predict3(image_np,Threshold):
|
| 76 |
|
|
|
|
|
|
|
|
|
|
| 77 |
results = detection_model2(image_np)
|
| 78 |
|
| 79 |
# different object detection models have additional results
|
|
|
|
| 90 |
category_index,
|
| 91 |
use_normalized_coordinates=True,
|
| 92 |
max_boxes_to_draw=20,
|
| 93 |
+
min_score_thresh=Threshold,#.38,
|
| 94 |
agnostic_mode=False,
|
| 95 |
line_thickness=2)
|
| 96 |
|