lingcai.wl 3 years ago
parent
commit
d983bdfc8e
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      modelscope/pipelines/multi_modal/image_captioning.py

+ 5
- 2
modelscope/pipelines/multi_modal/image_captioning.py View File

@@ -84,8 +84,11 @@ class ImageCaptionPipeline(Pipeline):
s = torch.cat([s, self.eos_item]) s = torch.cat([s, self.eos_item])
return s return s


patch_image = self.patch_resize_transform(
load_image(input)).unsqueeze(0)
if isinstance(input, Image.Image):
patch_image = self.patch_resize_transform(input).unsqueeze(0)
else:
patch_image = self.patch_resize_transform(
load_image(input)).unsqueeze(0)
patch_mask = torch.tensor([True]) patch_mask = torch.tensor([True])
text = 'what does the image describe?' text = 'what does the image describe?'
src_text = encode_text( src_text = encode_text(


Loading…
Cancel
Save