Feature Extraction
Transformers
PyTorch
Safetensors
English
trendyol_dinov2
image-feature-extraction
image-similarity
image-retrieval
computer-vision
e-commerce
dinov2
custom_code
Eval Results (legacy)
Instructions to use Trendyol/trendyol-dino-v2-ecommerce-256d with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Trendyol/trendyol-dino-v2-ecommerce-256d with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Trendyol/trendyol-dino-v2-ecommerce-256d", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Trendyol/trendyol-dino-v2-ecommerce-256d", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
feat: test upload - Trendyol DinoV2 Product Similarity and Retrieval Embedding Model
3ab6d8c verified | language: | |
| - en | |
| license: cc-by-sa-4.0 | |
| library_name: transformers | |
| tags: | |
| - image-similarity | |
| - image-retrieval | |
| - computer-vision | |
| - e-commerce | |
| - dinov2 | |
| - pytorch | |
| - safetensors | |
| datasets: | |
| - e-commerce-product-images | |
| metrics: | |
| - cosine-similarity | |
| - euclidean-distance | |
| pipeline_tag: feature-extraction | |
| model-index: | |
| - name: Trendyol DinoV2 E-commerce Image Similarity | |
| results: | |
| - task: | |
| type: image-similarity | |
| dataset: | |
| type: e-commerce-product-images | |
| name: Product Image Similarity | |
| metrics: | |
| - type: cosine_similarity | |
| value: 0.89 | |
| name: Cosine Similarity Score | |
| # Trendyol DinoV2 Image Similarity Model | |
| This repository contains a fine-tuned DinoV2 model for image similarity and retrieval tasks, specifically trained on e-commerce product images. | |
| ## Model Details | |
| - **Model Type**: Image Similarity/Retrieval | |
| - **Architecture**: DinoV2 ViT-B/14 with ArcFace loss | |
| - **Embedding Dimension**: 256 | |
| - **Input Size**: 224x224 | |
| - **Framework**: PyTorch | |
| - **Format**: SafeTensors | |
| ## Usage | |
| ### Quick Start | |
| ```python | |
| import torch | |
| from PIL import Image | |
| from transformers import AutoModel, AutoImageProcessor | |
| device = 'cuda' | |
| # Load model and processor from Hugging Face Hub | |
| processor = AutoImageProcessor.from_pretrained("Trendyol/trendyol-dino-v2-ecommerce-256d", trust_remote_code=True) | |
| model = AutoModel.from_pretrained("Trendyol/trendyol-dino-v2-ecommerce-256d", trust_remote_code=True) | |
| model.to(device) | |
| # Load and process an image | |
| image = Image.open('your_image.jpg').convert('RGB') | |
| inputs = processor(images=image, return_tensors="pt") | |
| # Move inputs to CUDA | |
| inputs = {k: v.to(device) for k, v in inputs.items()} | |
| # Get embeddings | |
| with torch.no_grad(): | |
| outputs = model(**inputs) | |
| embeddings = outputs.last_hidden_state # Shape: [1, 256] | |
| print("Generated dimensional embedding shape:", embeddings.shape[1]) | |
| ``` | |
| ### Preprocessing Pipeline | |
| The model uses a specific preprocessing pipeline that's crucial for good performance: | |
| 1. **DownScale (Lanczos)**: Resize to max dimension of 332px | |
| 2. **JPEG Compression**: Apply quality=90 compression | |
| 3. **Scale Image**: Scale to max dimension of 332px | |
| 4. **Pad to Square**: Pad with color value 255 | |
| 5. **Resize**: Resize to 224x224 | |
| 6. **ToTensor**: Convert to PyTorch tensor | |
| 7. **Normalize**: ImageNet normalization (mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) | |
| ## Installation | |
| Install the required dependencies: | |
| ```bash | |
| pip install transformers torch torchvision safetensors pillow numpy opencv-python | |
| ``` | |
| ## Model Architecture | |
| The model consists of: | |
| - **Backbone**: DinoV2 ViT-B/14 (frozen during training) | |
| - **Projection Head**: Linear layer mapping to 256 dimensions | |
| - **Normalization**: L2 normalization for similarity computation | |
| ## Training Details | |
| - **Loss Function**: ArcFace loss for metric learning | |
| - **Training Data**: E-commerce product images | |
| - **Epoch**: 9 | |
| - **PyTorch Version**: 2.8.0 | |
| ## Intended Use | |
| This model is designed for: | |
| - Product image similarity search | |
| - Visual product recommendations | |
| - Duplicate product detection | |
| - Content-based image retrieval in e-commerce | |
| ## Limitations | |
| - Optimized specifically for product/e-commerce images | |
| - May not generalize well to other image domains | |
| - Requires specific preprocessing pipeline for optimal performance | |
| - Requires transformers library for feature extractor functionality | |
| ## License | |
| This model is released by Trendyol as a source-available, non-open-source model. See the [LICENSE file](https://huggingface.co/Trendyol/trendyol-dino-v2-ecommerce-256d/blob/main/LICENSE) for full details. | |
| You are allowed to: | |
| - View, download, and evaluate the model weights. | |
| - Use the model for non-commercial research and internal testing. | |
| - Use the model or its derivatives for commercial purposes, provided that: | |
| - You cite Trendyol as the original model creator. | |
| - You notify Trendyol in advance via scr.datascience@trendyol.com or other designated contact. | |
| You are not allowed to: | |
| - Redistribute or host the model or its derivatives on third-party platforms without prior written consent from Trendyol. | |
| - Use the model in applications violating ethical standards, including but not limited to surveillance, misinformation, or harm to individuals or groups. | |
| By downloading or using this model, you agree to the terms above. | |
| © 2025 Trendyol Group. All rights reserved. | |
| ## Citation | |
| ``` | |
| @misc{trendyol-dinov2-ecommerce, | |
| title={Trendyol DinoV2 E-commerce Image Similarity Model}, | |
| author={Trendyol Data Science Team}, | |
| year={2025}, | |
| url={https://huggingface.co/Trendyol/trendyol-dino-v2-ecommerce-256d} | |
| } | |
| ``` | |