Skip to content

Commit 081f599

Browse files
No public description
PiperOrigin-RevId: 638060434
1 parent f207efa commit 081f599

File tree

1 file changed

+4
-8
lines changed
  • official/projects/waste_identification_ml/docker_solution/prediction_pipeline

1 file changed

+4
-8
lines changed

official/projects/waste_identification_ml/docker_solution/prediction_pipeline/mask_bbox_saver.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ def save_bbox_masks_labels(
6060
threshold: Value between 0 and 1 to filter out the prediction results.
6161
"""
6262
image_new = image.copy()
63-
if 'detection_masks_reframed' in result:
64-
result['detection_masks_reframed'] = result[
65-
'detection_masks_reframed'
66-
].astype(np.uint8)
6763

6864
viz_utils.visualize_boxes_and_labels_on_image_array(
6965
image_new,
@@ -72,11 +68,11 @@ def save_bbox_masks_labels(
7268
result['detection_scores'][0],
7369
category_index=category_index,
7470
use_normalized_coordinates=True,
75-
max_boxes_to_draw=100,
71+
max_boxes_to_draw=70,
7672
min_score_thresh=threshold,
7773
agnostic_mode=False,
78-
instance_masks=result.get('detection_masks_reframed', None),
79-
line_thickness=2,
74+
instance_masks=result.get('detection_masks_resized', None),
75+
line_thickness=4,
8076
)
8177

8278
cv2.imwrite(
@@ -101,7 +97,7 @@ def save_binary_masks(
10197
file_name: The filename for saving the output mask image.
10298
folder: The folder path where the output mask image will be saved.
10399
"""
104-
mask = np.zeros_like(result['detection_masks_reframed'][0])
100+
mask = np.zeros_like(result['detection_masks_reframed'][0], dtype=np.uint8)
105101
result['detection_masks_reframed'] = result[
106102
'detection_masks_reframed'
107103
].astype(np.uint8)

0 commit comments

Comments
 (0)