Skip to main content

Introduction

StateSet Vision API enables powerful image analysis capabilities for your applications. From product image verification to visual search and quality control, our Vision API leverages advanced computer vision models to extract meaningful insights from images.

Prerequisites

Before you begin, ensure you have:
  • A StateSet account with Vision API access enabled
  • Node.js 16+ installed
  • StateSet SDK (npm install StateSet-node)
  • Valid API credentials

Key Features

  • Object Detection: Identify and locate objects within images
  • Text Extraction (OCR): Extract text from images including labels, receipts, and documents
  • Quality Assessment: Analyze image quality for product listings
  • Visual Search: Find similar products based on image similarity
  • Damage Detection: Identify defects or damage in product images
  • Brand Recognition: Detect logos and brand elements

Getting Started

1

Install Dependencies

2

Initialize the Client

3

Upload and Analyze an Image

Common Use Cases

1. Product Image Verification

Verify that uploaded product images meet quality standards:

2. Return Item Condition Assessment

Automatically assess the condition of returned items:

3. Visual Search for Similar Products

Find similar products based on an uploaded image:

4. Receipt and Document Processing

Extract structured data from receipts and invoices:

Advanced Features

Batch Processing

Process multiple images efficiently:

Webhook Integration

Set up webhooks for async processing:

Best Practices

Image Optimization

  • Resize images before upload (max 4MB recommended)
  • Use appropriate formats (JPEG for photos, PNG for graphics)
  • Compress images without losing quality

Error Handling

Performance Optimization

  • Use image URLs instead of uploads when possible
  • Implement caching for repeated analyses
  • Process images asynchronously for better UX

Troubleshooting

Common Issues

  1. Image Upload Fails
    • Check file size (max 4MB)
    • Verify image format (JPEG, PNG, GIF, BMP)
    • Ensure proper multipart/form-data headers
  2. Low Confidence Results
    • Improve image quality (resolution, lighting)
    • Ensure subject is clearly visible
    • Reduce background noise
  3. Slow Processing
    • Resize images before upload
    • Use batch processing for multiple images
    • Implement webhook callbacks for async processing

API Reference

For detailed API documentation, see:

Next Steps

Integrate with Returns

Use Vision API to automate return condition assessment

Build Visual Search

Create a visual product search experience

Complete Implementation Example

Here’s a production-ready example that combines all the concepts covered in this guide:
This complete example demonstrates:
  • Comprehensive error handling with specific error codes
  • Caching for performance optimization
  • Progress tracking for batch operations
  • Graceful degradation when services fail
  • Proper logging and monitoring
  • Timeout handling for long operations
  • Automatic retry logic
  • Input validation