MCPcopy
hub / github.com/chenfei-wu/TaskMatrix / get_mask

Method get_mask

visual_chatgpt.py:1448–1462  ·  view source on GitHub ↗

Description: given an image path, return the mask of the main object. Args: image_path (string): the file path of the image Outputs: mask (numpy.ndarray): H x W

(self, image_path)

Source from the content-addressed store, hash-verified

1446 return updated_image_path
1447
1448 def get_mask(self, image_path):
1449 '''
1450 Description:
1451 given an image path, return the mask of the main object.
1452 Args:
1453 image_path (string): the file path of the image
1454 Outputs:
1455 mask (numpy.ndarray): H x W
1456 '''
1457 vqa_input = f"{image_path}, what is the main object in the image?"
1458 text_prompt = self.vqa.inference(vqa_input)
1459
1460 mask = self.obj_segmenting.get_mask(image_path,text_prompt)
1461
1462 return mask
1463
1464
1465class ConversationBot:

Callers 1

inferenceMethod · 0.95

Calls 2

inferenceMethod · 0.45
get_maskMethod · 0.45

Tested by

no test coverage detected