Instructions to use SIYAKSARES/fine-tuned-blip-for-car-brands with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SIYAKSARES/fine-tuned-blip-for-car-brands with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="SIYAKSARES/fine-tuned-blip-for-car-brands")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("SIYAKSARES/fine-tuned-blip-for-car-brands") model = AutoModelForMultimodalLM.from_pretrained("SIYAKSARES/fine-tuned-blip-for-car-brands", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fine-tuned BLIP for Car Brands
This repository hosts a fine-tuned BLIP image captioning model specialized for car brand identification from images via captions. The model is trained from Salesforce/blip-image-captioning-base and produces captions like: "A photo of a car from the brand Audi." Then, a simple brand-extraction layer maps captions to the final brand prediction.
- Model page:
https://huggingface.co/SIYAKSARES/fine-tuned-blip-for-car-brands - Base model:
Salesforce/blip-image-captioning-base - Task: Image-to-Text (captioning), used for brand classification
- License: Apache-2.0
Results (Summary)
- Validation Accuracy: 81.09%
- Test Accuracy: 79.68%
Dataset: Kaggle Car Brand Classification Dataset (33 brands; class-balanced splits)
Usage
from transformers import BlipProcessor, BlipForConditionalGeneration
from PIL import Image
processor = BlipProcessor.from_pretrained("SIYAKSARES/fine-tuned-blip-for-car-brands")
model = BlipForConditionalGeneration.from_pretrained("SIYAKSARES/fine-tuned-blip-for-car-brands")
image = Image.open("your_test_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
generated_ids = model.generate(**inputs, num_beams=3, max_new_tokens=16)
caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print("Generated caption:", caption)
Notes
- The model is optimized for generating brand-explicit captions. For classification, extract the brand name from the caption string.
- For faster inference, consider
num_beams=1(greedy decoding).
Citation
If you use this model, please also cite the BLIP paper:
@article{blip2022,
title={BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation},
author={Li, Junnan and Li, Dongxu and Xiong, Caiming and Hoi, Steven},
journal={ICML},
year={2022}
}
- Downloads last month
- 4
Model tree for SIYAKSARES/fine-tuned-blip-for-car-brands
Base model
Salesforce/blip-image-captioning-base