MCPcopy Index your code
hub / github.com/CASIA-LMC-Lab/FastSAM / prompt

Function prompt

predict.py:140–159  ·  view source on GitHub ↗
(results, args, box=None, point=None, text=None)

Source from the content-addressed store, hash-verified

138
139
140def prompt(results, args, box=None, point=None, text=None):
141 ori_img = cv2.imread(args.img_path)
142 ori_h = ori_img.shape[0]
143 ori_w = ori_img.shape[1]
144 if box:
145 mask, idx = box_prompt(
146 results[0].masks.data,
147 convert_box_xywh_to_xyxy(args.box_prompt),
148 ori_h,
149 ori_w,
150 )
151 elif point:
152 mask, idx = point_prompt(
153 results, args.point_prompt, args.point_label, ori_h, ori_w
154 )
155 elif text:
156 mask, idx = text_prompt(results, args.text_prompt, args.img_path, args.device)
157 else:
158 return None
159 return mask

Callers 1

predictMethod · 0.85

Calls 4

box_promptFunction · 0.85
point_promptFunction · 0.85
text_promptFunction · 0.85
convert_box_xywh_to_xyxyFunction · 0.50

Tested by

no test coverage detected