Your Detect service just successfully detected 3 objects (bed, chair, chair) from the test image!
- ✅ Furniture: bed, chair, sofa, couch, table, desk, dresser, bench
- ✅ Electronics: tv, laptop, keyboard, mouse, phone, remote
- ✅ Appliances: microwave, oven, toaster, sink, refrigerator
- ✅ Decor: plant, vase, clock, book, bottle, cup, picture, frame
- ✅ Lighting: lamp, light, chandelier
- ✅ Structural: door, window, curtain, wall, floor, ceiling
- Confidence threshold: 10% (very low = detects more objects)
- IOU threshold: 0.3 (overlap detection)
- Image size: 640px (standard)
- Filter: Interior objects only
Possible Reasons:
- ❌ Image doesn't contain furniture/interior items
- ❌ Objects are too small (< 30px)
- ❌ Poor image quality (blurry, dark)
- ❌ Not a room interior photo (outdoor/landscape)
- ❌ Objects are partially hidden/occluded
Solutions:
# Test with a clear room photo
curl.exe -X POST -F "file=@C:\Users\YourName\Pictures\bedroom.jpg" http://localhost:8001/detect/
# Expected result: JSON with "objects": ["bed", "chair", ...]Tips for Better Detection:
- ✅ Use well-lit photos
- ✅ Show full room view
- ✅ Include recognizable furniture
- ✅ Minimum 640x640px resolution
- ✅ Clear, not blurry images
Example: Detects "chair" but you see a sofa
Why This Happens:
- YOLOv8 trained on COCO dataset (general objects)
- Sometimes misclassifies similar items
- Chair/sofa/couch can be confused
- This is normal AI behavior
Accuracy by Model:
- YOLOv8n (nano): Fast, 70-75% accurate ✅ (current)
- YOLOv8m (medium): Slower, 80-85% accurate
- YOLOv8l (large): Slowest, 85-90% accurate
To Improve Accuracy:
# In detect/app/main.py, change line 65:
model = YOLO("yolov8m.pt") # Instead of yolov8n.pt
# Or increase confidence threshold:
conf=0.25 # Instead of 0.1 (fewer but more accurate)Symptoms:
- Request takes > 30 seconds
- Service crashes/restarts
- "Connection refused" error
Solutions:
Check 1: Service Running?
Invoke-RestMethod http://localhost:8001/healthExpected: {"status":"ok","service":"Detect (YOLOv8)","device":"cpu"}
Check 2: Python Environment Active?
cd f:\Projects\Artistry\Artistry-Redesign\artistry-backend\detect
.\venv\Scripts\Activate.ps1
python -c "import ultralytics; print('OK')"Expected: OK
Check 3: Dependencies Installed?
pip list | Select-String "ultralytics|torch|opencv"Expected: ultralytics, torch, opencv-python
Check 4: Image Size Too Large?
# Resize image before upload (max 2MB recommended)
# Or increase timeout in frontend:
TimeoutSec 60 # Instead of 30Reason: Frontend may have different image encoding
Test Direct API:
# Direct file upload (most reliable)
curl.exe -X POST -F "file=@myroom.jpg" http://localhost:8001/detect/
# Should return:
# {
# "objects": ["bed", "chair", ...],
# "bounding_boxes": [...],
# "confidence": [0.85, 0.72, ...],
# "annotated_image": "data:image/jpeg;base64,..."
# }Test from Frontend:
// In browser console (F12)
const file = document.querySelector('input[type="file"]').files[0]
const formData = new FormData()
formData.append('file', file)
fetch('http://localhost:8001/detect/', {
method: 'POST',
body: formData
}).then(r => r.json()).then(console.log)Reason: Confidence threshold too high
Solution:
# In detect/app/main.py, line 116:
results = model.predict(img, imgsz=640, device=device, verbose=False,
conf=0.05, # Lower = more objects (was 0.1)
iou=0.3)Trade-off:
- Lower threshold → More objects but more false positives
- Higher threshold → Fewer objects but more accurate
Current setting: 0.1 (10%) - good balance
This should NOT happen!
Why: Interior filter is enabled
Check if filter working:
# Look at detect/app/main.py line 129-132:
# if label not in INTERIOR_CLASSES:
# continueIf you see "car", "truck", "bicycle" in results, the filter is broken.
Fix: Interior filter is on lines 129-132, should skip non-interior items.
Invoke-RestMethod http://localhost:8001/healthcd f:\Projects\Artistry\Artistry-Redesign\artistry-backend
.\DETECT_TEST.ps1curl.exe -X POST -F "file=@C:\Users\YourName\Desktop\bedroom.jpg" http://localhost:8001/detect/- Open: http://localhost:5173/mvp
- Upload room photo
- Click "Start AI Analysis"
- Check browser console (F12) for API responses
{
"objects": ["bed", "chair", "table", "lamp", "plant"],
"bounding_boxes": [
{"x1": 120, "y1": 200, "x2": 450, "y2": 380},
...
],
"confidence": [0.85, 0.72, 0.68, 0.55, 0.43],
"annotated_image": "data:image/jpeg;base64,/9j/4AAQ..."
}{
"objects": [],
"bounding_boxes": [],
"confidence": [],
"annotated_image": "data:image/jpeg;base64,..."
}cd f:\Projects\Artistry\Artistry-Redesign\artistry-backend\detect
.\venv\Scripts\python.exe -c "from ultralytics import YOLO; m = YOLO('yolov8n.pt'); print('Model loaded:', m)"# test_detect.py
from ultralytics import YOLO
from PIL import Image
model = YOLO("yolov8n.pt")
img = Image.open("image-asset.webp")
results = model.predict(img, conf=0.1)
for r in results:
for box in r.boxes:
label = model.names[int(box.cls[0])]
conf = float(box.conf[0])
print(f"{label}: {conf:.2f}")Run:
python test_detect.pyWhen service crashes, check terminal output for errors:
ModuleNotFoundError→ Missing dependenciesCUDA error→ GPU issue (switch to CPU)Timeout→ Image too large or model loading slow
- Speed: 1-2 seconds per image (CPU)
- Accuracy: 70-75% (YOLOv8n)
- Memory: ~500MB
# Use GPU (if available)
device = "cuda" if torch.cuda.is_available() else "cpu"
# Reduce image size
imgsz=320 # Faster but less accurate (default: 640)
# Use half precision
half=True # Faster on GPU# Use larger model
model = YOLO("yolov8m.pt") # Medium (slower but better)
# Increase image size
imgsz=1280 # Slower but more accurate
# Raise confidence
conf=0.25 # Higher quality detections- Service responds to /health endpoint
- YOLOv8n.pt model file exists (6.2 MB)
- Test image detects 3 objects (bed, chair, chair)
- Your room photo detects furniture
- No outdoor objects detected (car, tree, etc.)
- Annotated image returned with bounding boxes
- Frontend integration works
- Health endpoint responds
- Detects at least some objects from room photos
- Returns bounding boxes
- Filters out outdoor objects
- Generates annotated image
- Completes in < 5 seconds (CPU) or < 1 second (GPU)
- NOT 100% accurate (AI limitation)
- May miss small objects
- May misclassify similar items (chair vs stool)
- Works best with clear, well-lit photos
- Requires furniture/items to be visible
# Stop current service (Ctrl+C in terminal)
# Then restart:
cd f:\Projects\Artistry\Artistry-Redesign\artistry-backend\detect
f:\Projects\Artistry\Artistry-Redesign\artistry-backend\detect\venv\Scripts\python.exe -m uvicorn app.main:app --port 8001 --reloadcd f:\Projects\Artistry\Artistry-Redesign\artistry-backend\detect
.\venv\Scripts\Activate.ps1
pip install --force-reinstall ultralytics torch opencv-python pillowLook at terminal where uvicorn is running for error messages.
# minimal_test.py
from ultralytics import YOLO
model = YOLO("yolov8n.pt")
print("Model loaded successfully!")Your Detect service IS working! It successfully detected:
- ✅ bed
- ✅ chair
- ✅ chair
If it's "not working" in your use case:
- Check what image you're uploading
- Make sure it's a room interior photo
- Ensure it has visible furniture
- Try the test commands above
- Check browser console for errors (F12)
The service is operational and ready for MVP! 🎉