(results, args, box=None, point=None, text=None)
| 138 | |
| 139 | |
| 140 | def 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 |
no test coverage detected