Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tool/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ def run_grounding(self, origin_frame, grounding_caption, box_threshold, text_thr
transfered_boxes: nd.array [N, 4]: [[x0, y0], [x1, y1]]
'''
height, width, _ = origin_frame.shape
img_pil = PIL.Image.fromarray(origin_frame)
# width, height = origin_frame.size
# If origin_frame is already a PIL Image object, you don't need to do anything
if isinstance(origin_frame, PIL.Image.Image):
img_pil = origin_frame
else:
# Convert origin_frame to a NumPy array and then to a PIL Image
origin_frame = np.array(origin_frame)
img_pil = PIL.Image.fromarray(origin_frame)
re_width, re_height = img_pil.size
_, image_tensor = self.image_transform_grounding(img_pil)
# img_pil = self.image_transform_grounding_for_vis(img_pil)
Expand Down