MCPcopy Create free account
hub / github.com/EmbodiedGPT/EmbodiedGPT_Pytorch / load_image

Function load_image

demo/script.py:195–206  ·  view source on GitHub ↗
(image, input_size=224)

Source from the content-addressed store, hash-verified

193 return image
194
195def load_image(image, input_size=224):
196 crop_pct = 224 / 256
197 size = int(input_size / crop_pct)
198 transform = T.Compose([
199 T.Lambda(lambda img: img.convert('RGB') if img.mode != 'RGB' else img),
200 T.Resize(size, interpolation=InterpolationMode.BICUBIC),
201 T.CenterCrop(input_size),
202 T.ToTensor(),
203 T.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225))
204 ])
205 image = transform(image)
206 return image
207
208def load_video(video_path, num_segments=8):
209 vr = VideoReader(video_path, ctx=cpu(0))

Callers 1

get_image_embeddingMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected