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

Method load_image

visual_chatgpt.py:1045–1057  ·  view source on GitHub ↗
(self,image_path)

Source from the content-addressed store, hash-verified

1043 if not os.path.exists(self.model_config_path):
1044 wget.download(config_url,out=self.model_config_path)
1045 def load_image(self,image_path):
1046 # load image
1047 image_pil = Image.open(image_path).convert("RGB") # load image
1048
1049 transform = T.Compose(
1050 [
1051 T.RandomResize([512], max_size=1333),
1052 T.ToTensor(),
1053 T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
1054 ]
1055 )
1056 image, _ = transform(image_pil, None) # 3, h, w
1057 return image_pil, image
1058
1059 def load_model(self):
1060 args = SLConfig.fromfile(self.model_config_path)

Callers 4

inferenceMethod · 0.95
inferenceMethod · 0.80
get_maskMethod · 0.80
inference_replace_samMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected