recognize-anything icon indicating copy to clipboard operation
recognize-anything copied to clipboard

Example for recognising on an open-set of tags

Open mrdbourke opened this issue 1 year ago • 3 comments

Hi there,

Firstly, fantastic work and thank you for sharing!

Second, do you mind providing a small code example to recognize an open-set of tags?

Eg.

from ram import get_transform, inference_ram, inference_tag2text
from ram.models import ram, tag2text_caption

ram_model = ram(pretrained=ram_checkpoint, image_size=image_size, vit='swin_l').eval().to(device)

# Setup image
image = ... 

# Custom tags
tags = ["house", "car", "pig"] 

# Perform inference
result = inference_ram(model, image, custom_tags)

mrdbourke avatar Jun 30 '23 21:06 mrdbourke