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 weightslabel_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}}
}
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support
Model tree for bobs24/DeiT-Classification-Apparel
Base model
facebook/deit-base-patch16-224