Clothing segmentation with Hugging Face
Python, Computer Vision, Image Segmentation, Hugging Face, REST API, Deep Learning, Data Science, NumPy, Matplotlib, Pillow
Fashion Trend Intelligence – Clothing Segmentation with Hugging Face
Context
As part of a demonstration project, I developed a prototype to evaluate the use of a computer vision model hosted on Hugging Face Serverless endpoints to automatically identify clothing present in images. The objective was to validate the technical feasibility before a larger-scale deployment for trend analysis in the fashion industry.
Objectives
- Integrate an image segmentation model via a REST API.
- Automatically segment different clothing items.
- Generate visualizations of the results.
- Evaluate model performance.
- Estimate the operating cost of the solution at scale.
Architecture
Images
│
▼
Script Python
│
▼
API Hugging Face Inference
(segformer_b3_clothes)
│
▼
Masques de segmentation
│
▼
Visualisation + Évaluation
Technologies Used
- Python
- Requests
- Pillow (PIL)
- NumPy
- Matplotlib
- python-dotenv
- API Hugging Face Inference
- Git
- Visual Studio Code
Achievements
AI Service Integration
- Secure authentication via API token.
- Environment variable management (.env).
- Communication with a Serverless AI API.
- Automatic image processing.
Image Segmentation
- Sending images to the SegFormer Clothes model.
- Retrieval of segmentation masks.
- Association of detected classes with clothing items.
- Generation of visualizations (original image / segmentation).
Model Evaluation
Implementation of an evaluation approach including:
-
dataset separation
- training
- validation
- test
-
definition of performance indicators such as:
- Intersection over Union (IoU)
- Dice Score
- F1 Score
-
qualitative analysis of the obtained results.
Cost Study
Evaluation of the cost of using Hugging Face Serverless endpoints for a production scenario of 500,000 images over 30 days, to estimate the economic viability of the solution.
Demonstrated Skills
Artificial Intelligence
- Use of a pre-trained model
- Computer Vision
- Semantic Segmentation
- AI API Consumption
Python Development
- Image manipulation
- HTTP Requests
- Error handling
- Environment variables
- Python project organization
Data Science
- Model evaluation
- Selection of appropriate metrics
- Performance analysis
- Experimental validation
Cloud & API
- Use of a Serverless AI service
- Token authentication
- Estimation of operating costs
Outcome
This project allowed me to put into practice the integration of a ready-to-use AI service to quickly build a functional computer vision prototype, while applying a comprehensive approach ranging from API calls to performance evaluation and deployment cost analysis.
Acquired Skills
- Python
- Computer Vision
- Image Segmentation
- Hugging Face Inference API
- REST API
- Requests
- Pillow
- Matplotlib
- NumPy
- python-dotenv
- AI Model Evaluation
- IoU
- Dice Score
- F1 Score
- Data Visualization
- Git
- Secret Management
- Cloud Cost Analysis