LivingLegend3/TextureLens
0
TextureLens — FMD Material Classifier
Classifies texture images into one of 10 material categories using four PyTorch models trained on the Flickr Material Database (FMD).
Classes: fabric · foliage · glass · leather · metal · paper · plastic · stone · water · wood
Architecture
The app is split across two servers:
- This Space (HuggingFace) — serves the frontend only
- API server (AWS EC2) — runs the four models and handles all prediction requests
The frontend calls the AWS API directly from the browser.
API (hosted on AWS)
POST /predict/all
Body: multipart/form-data, field "file" (image)
Returns: { "mlp": {...}, "cnn": {...}, "resnet": {...}, "efficientnet": {...} }
POST /predict
Same interface — ResNet-18 only (best model, 80.5% val accuracy)
Returns: { "prediction": "stone", "confidence": 0.973, "probabilities": { ... } }
GET /api/examples
Returns random FMD image URLs (optional ?classes=metal,glass&count=9)
GET /api/classes
Returns the 10 material class names
GET /health
Returns: { "status": "ok" }Run the API server locally
docker-compose -f docker-compose.server.yml upAPI will be at http://localhost:8000.
