CoolFace
Apppublic

LivingLegend3/TextureLens

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
App README

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

bash
docker-compose -f docker-compose.server.yml up

API will be at http://localhost:8000.

Models

ModelParamsVal Accuracy
MLP (scratch)26,356,49033.0%
CNN (scratch)1,574,69840.5%
EfficientNet-B04,020,35875.5%
ResNet-18 (fine-tuned)11,181,64280.5%