Downloads · 30 days
10
2% of all-time downloads
hieudinhpro/git-base-on-diffuision-dataset2
git-base-on-diffuision-dataset2 is a image-to-text model from hieudinhpro. Use it when you need a caption or text from an image. It is set up for transformers. The card lists the license as mit.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
10
2% of all-time downloads
All-time downloads
561
Public
Repo size
17 GB
Likes
0
Public
Click a slice to open those files.
.bin707 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of microsoft/git-base on hieudinhpro/diffuision-dataset2 dataset.
GIT (short for GenerativeImage2Text) model, base-sized version.
It was introduced in the paper GIT: A Generative Image-to-text Transformer for Vision and Language
Model train for task : Sketch Scene image to text
# Load model directly
from transformers import AutoProcessor, AutoModelForCausalLM
processor = AutoProcessor.from_pretrained("microsoft/git-base")
model = AutoModelForCausalLM.from_pretrained("hieudinhpro/git-base-on-diffuision-dataset2")
# load image
from PIL import Image
image = Image.open('/content/image_3.jpg')
# pre image
inputs = processor(images=image, return_tensors="pt")
pixel_values = inputs.pixel_values
# predict
generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
# decode to text
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_caption)
The following hyperparameters were used during training: