Open kx-kexi opened 5 months ago
in_coordinate, out_coordinate = det(image, "icon", groundingdino_model) 这里返回两个值,但是方法只返回了一个值,是不是有错误啊,代码在Mobile-Agent/run.py 的149行 def det(input_image_path, caption, groundingdino_model, box_threshold=0.05, text_threshold=0.5): image = Image.open(input_image_path) size = image.size
caption = caption.lower() caption = caption.strip() if not caption.endswith('.'): caption = caption + '.' inputs = { 'IMAGE_PATH': input_image_path, 'TEXT_PROMPT': caption, 'BOX_TRESHOLD': box_threshold, 'TEXT_TRESHOLD': text_threshold } result = groundingdino_model(inputs) print(result) boxes_filt = result['boxes'] H, W = size[1], size[0] for i in range(boxes_filt.size(0)): boxes_filt[i] = boxes_filt[i] * torch.Tensor([W, H, W, H]) boxes_filt[i][:2] -= boxes_filt[i][2:] / 2 boxes_filt[i][2:] += boxes_filt[i][:2] boxes_filt = boxes_filt.cpu().int().tolist() filtered_boxes = remove_boxes(boxes_filt, size) # [:9] coordinates = [] for box in filtered_boxes: coordinates.append([box[0], box[1], box[2], box[3]]) return coordinates
感谢纠正,我们不小心混淆了v1和v2的图标检测流程,现在已经修复。
in_coordinate, out_coordinate = det(image, "icon", groundingdino_model) 这里返回两个值,但是方法只返回了一个值,是不是有错误啊,代码在Mobile-Agent/run.py 的149行 def det(input_image_path, caption, groundingdino_model, box_threshold=0.05, text_threshold=0.5): image = Image.open(input_image_path) size = image.size