DeiT-Classification-Apparel πŸ·οΈπŸ‘•

A Deep Learning Model for Apparel Image Classification using DeiT

πŸ“ Model Overview

The DeiT-Classification-Apparel model is a Vision Transformer (DeiT) trained to classify different types of apparel. It leverages Data-efficient Image Transformers (DeiT) for improved image recognition with minimal computational resources.

  • Architecture: Vision Transformer (DeiT)
  • Use Case: Apparel classification
  • Framework: PyTorch
  • Model Size: 343MB
  • Files:
    • DeiT_Model_Parameter.pth – Trained model weights
    • label_encoder.pkl – Label encoder for class mapping

πŸ“‚ Files and Usage

1️⃣ Load the Model

import torch
from torchvision import transforms
from PIL import Image
import pickle

# Load Model
model = torch.load_state_dict(torch.load("DeiT_Model_Parameter.pth", map_location=device))
model.eval()

# Load Label Encoder
with open("label_encoder.pkl", "rb") as f:
    label_encoder = pickle.load(f)

2️⃣ Perform Inference

def predict(image_path):
    # Load and preprocess image
    image = Image.open(image_path).convert("RGB")
    transform = transforms.Compose([
        transforms.Resize((224, 224)),
        transforms.ToTensor(),
    ])
    input_tensor = transform(image).unsqueeze(0)

    # Make prediction
    with torch.no_grad():
        output = model(input_tensor)
        predicted_label = output.argmax(1).item()
    
    return label_encoder.inverse_transform([predicted_label])[0]

# Example Usage
image_path = "sample.jpg"
prediction = predict(image_path)
print(f"Predicted Apparel: {prediction}")

πŸ“Œ Applications

βœ… Fashion e-commerce product categorization
βœ… Retail inventory management
βœ… Virtual try-on solutions
βœ… Automated fashion recommendation

πŸ› οΈ Training Details

  • Dataset: Custom apparel dataset
  • Optimizer: Adam
  • Loss Function: CrossEntropyLoss
  • Hardware Used: NVIDIA T4 GPU

πŸ“’ Citation

If you use this model, please cite:

@misc{bobs24_deit_classification_2024,
  author = {bobs24},
  title = {DeiT-Classification-Apparel},
  year = {2024},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/bobs24/DeiT-Classification-Apparel}}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for bobs24/DeiT-Classification-Apparel

Finetuned
(288)
this model

Space using bobs24/DeiT-Classification-Apparel 1