CLIP时尚推荐系统
STDIO基于CLIP的时尚服装推荐系统
基于CLIP的时尚服装推荐系统
This is a CLIP-Based Fashion Recommender with MCP.
A user uploads a clothing image → YOLO detects clothing → CLIP encodes → Recommend similar
/project-root
│
├── /backend
│ ├── Dockerfile
│ ├── /app
│ ├── /aws
│ │ │ └── rekognition_wrapper.py # AWS Rekognition logic
│ │ ├── /utils
│ │ │ └── image_utils.py # Bounding box crop utils
│ │ ├── /controllers
│ │ │ └── clothing_detector.py # Coordinates Rekognition + cropping
│ │ ├── /tests
│ │ │ ├── test_rekognition_wrapper.py
│ │ │ └── test_clothing_tagging.py
│ │ ├── server.py # FastAPI app code
│ │ ├── /routes
│ │ │ └── clothing_routes.py
│ │ ├── /controllers
│ │ │ ├── clothing_controller.py
│ │ │ ├── clothing_tagging.py
│ │ │ └── tag_extractor.py # Pending: define core CLIP functionality
│ │ ├── schemas/
│ │ │ └── clothing_schemas.py
│ │ ├── config/
│ │ │ ├── tag_list_en.py $ Tool for mapping: https://jsoncrack.com/editor
│ │ │ ├── database.py
│ │ │ ├── settings.py
│ │ │ └── api_keys.py
│ │ └── requirements.txt
│ └── .env
│
├── /frontend
│ ├── Dockerfile
│ ├── package.json
│ ├── package-lock.json
│ ├── /public
│ │ └── index.html
│ ├── /src
│ │ ├── /components
│ │ │ ├── ImageUpload.jsx
│ │ │ ├── DetectedTags.jsx
│ │ │ └── Recommendations.jsx
│ │ ├── /utils
│ │ │ └── api.js
│ │ ├── App.js # Main React component
│ │ ├── index.js
│ │ ├── index.css
│ │ ├── tailwind.config.js
│ │ └── postcss.config.js
│ └── .env
├── docker-compose.yml
└── README.md
python -m venv venv
source venv/bin/activate # On macOS or Linux
venv\Scripts\activate # On Windows
pip install -r requirements.txt
uvicorn backend.app.server:app --reload
Once the server is running and the database is connected, you should see the following message in the console:
Database connected
INFO: Application startup complete.
Database connected INFO: Application startup complete.
npm install
npm start
Once running, the server logs a confirmation and opens the app in your browser: http://localhost:3000/
PYTHONPATH=. pytest backend/app/tests/test_rekognition_wrapper.py
PYTHONPATH=. pytest backend/app/tests/test_clothing_tagging.py
Detecting garments using AWS Rekognition
Cropping the image around detected bounding boxes
Tagging the cropped image using CLIP
Negative Test Case | Description |
---|---|
No Detection Result | AWS doesn't detect any garments — should return an empty list. |
Image Not Clothing | CLIP returns vague or empty tags — verify fallback behavior. |
AWS Returns Exception | Simulate rekognition.detect_labels throwing an error — check try-except . |
Corrupted Image File | Simulate a broken (non-JPEG) image — verify it raises an error or gives a hint. |
PYTHONPATH=. pytest backend/app/tests/test_clothing_tagging.py
python3 -m venv venv
pip install -r requirements.txt
pip install git+https://github.com/openai/CLIP.git
python -m backend.app.tests.test_tag_extractor
Next Step: