recognize-anything
recognize-anything copied to clipboard
Example for recognising on an open-set of tags
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)