File size: 2,068 Bytes
2c4d5c7 9307a3f 2c4d5c7 65cbc93 9307a3f 927dd7c 9307a3f 93c3e12 9307a3f bbe4f57 9307a3f dcd2b19 9307a3f c47b5c5 9307a3f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
---
license: apache-2.0
tags:
- image-captioning
languages:
- en
pipeline_tag: image-to-text
datasets:
- michelecafagna26/hl
language:
- en
metrics:
- sacrebleu
- rouge
library_name: transformers
---
## BLIP-base fine-tuned for Image Captioning on High-Level descriptions of Actions
[BLIP](https://arxiv.org/abs/2201.12086) base trained on the [HL dataset](https://huggingface.co/datasets/michelecafagna26/hl) for **action generation of images**
## Model fine-tuning 🏋️
- Trained for 6 epochs
- lr: 5e−5,
- Adam optimizer,
- half-precision (fp16)
## Test set metrics 🧾
| Cider | SacreBLEU | Rouge-L|
|--------|------------|--------|
| 123.07 | 17.16 | 32.16 |
## Model in Action 🚀
```python
import requests
from PIL import Image
from transformers import BlipProcessor, BlipForConditionalGeneration
processor = BlipProcessor.from_pretrained("michelecafagna26/blip-base-captioning-ft-hl-actions")
model = BlipForConditionalGeneration.from_pretrained("michelecafagna26/blip-base-captioning-ft-hl-actions").to("cuda")
img_url = 'https://datasets-server.huggingface.co/assets/michelecafagna26/hl/--/default/train/0/image/image.jpg'
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
inputs = processor(raw_image, return_tensors="pt").to("cuda")
pixel_values = inputs.pixel_values
generated_ids = model.generate(pixel_values=pixel_values, max_length=50,
do_sample=True,
top_k=120,
top_p=0.9,
early_stopping=True,
num_return_sequences=1)
processor.batch_decode(generated_ids, skip_special_tokens=True)
>>> "she is holding an umbrella."
```
## BibTex and citation info
```BibTeX
@inproceedings{cafagna2023hl,
title={{HL} {D}ataset: {V}isually-grounded {D}escription of {S}cenes, {A}ctions and
{R}ationales},
author={Cafagna, Michele and van Deemter, Kees and Gatt, Albert},
booktitle={Proceedings of the 16th International Natural Language Generation Conference (INLG'23)},
address = {Prague, Czech Republic},
year={2023}
}
``` |