Instructions to use khayreali/vit-base-ecommerce-classification with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use khayreali/vit-base-ecommerce-classification with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="khayreali/vit-base-ecommerce-classification") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("khayreali/vit-base-ecommerce-classification") model = AutoModelForImageClassification.from_pretrained("khayreali/vit-base-ecommerce-classification") - Notebooks
- Google Colab
- Kaggle
| library_name: transformers | |
| license: apache-2.0 | |
| base_model: google/vit-base-patch16-224 | |
| tags: | |
| - generated_from_trainer | |
| model-index: | |
| - name: results | |
| results: [] | |
| <!-- This model card has been generated automatically according to the information the Trainer had access to. You | |
| should probably proofread and complete it, then remove this comment. --> | |
| # E-commerce Classification Model | |
| This model is a fine-tuned version of [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224). | |
| The training and evaluation data consists of product images scraped from e-commerce websites across 50 e-commerce categories. The data was then split into a training set (80%) and a test set (20%). During preprocessing, each image was converted to RGB and resized to 224x224 pixels. | |
| See below to get started: | |
| ```python | |
| from transformers import AutoImageProcessor, AutoModelForImageClassification | |
| from PIL import Image | |
| model = AutoModelForImageClassification.from_pretrained("khayreali/vit-base-ecommerce-classification") | |
| processor = AutoImageProcessor.from_pretrained("khayreali/vit-base-ecommerce-classification") | |
| clf = pipeline('image-classification', | |
| model=model, | |
| image_processor=processor) | |
| test_img = Image.open('IMAGE') | |
| result = clf(test_img) | |
| # Top predicted category | |
| print(result[0]['label']) | |
| ``` |