fix: add png handling for LazyLoadingImage (#203)

Loading png images for captioning will cause the following error since PIL loads png images in RGBA mode.

```python
  File "./miniconda3/lib/python3.8/site-packages/torchvision/transforms/functional_tensor.py", line 940, in normalize
    return tensor.sub_(mean).div_(std)
RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0
```
pull/210/head
Jiaming Sun 2 years ago committed by GitHub
parent 0b7692df07
commit a338902ab5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -36,6 +36,7 @@ def blip_model():
def generate_caption(image, min_length=30):
"""Given an image, return a caption."""
image = image.convert("RGB")
gpu_image = (
transforms.Compose(
[

Loading…
Cancel
Save