Optimising Performance (Accuracy and Response Time)

Maximising the accuracy and speed of your integration with Taggun's API can significantly enhance your application's overall performance.

This guide outlines tips for optimising Taggun's receipt processing capabilities.

Understanding Performance Factors

Several factors influence the speed and accuracy of your API requests:

  • Image Quality: Clear, high-quality images boost both processing speed and extraction accuracy.
  • Lighting: Well-lit receipts ensure more accurate and faster processing.
  • Clean Background: Using a plain background for photographs leads to more accurate data extraction by eliminating distractions.
  • Single Document per Image: Submit one receipt or invoice per API request.
  • Image Size: Smaller image files upload and process faster, giving quicker results.
  • Network Latency: Minimising latency improves real-time processing performance.
  • Request Complexity: Simplifying requests by reducing the number of data points or validation rules can speed up processing times.
  • Document Complexity: Receipts with numerous line items, unusual formats, or unique layouts may require further optimisation. If our models don't recognise a particular format, additional training can be provided to support it.

Extraction Accuracy Optimisation

Accuracy in data extraction is critical. Here are key tips to achieve it:

  • Image Quality: Ensure images are clear, well-lit, and free from blur.
  • Proper Framing: The receipt should be fully visible and properly aligned within the image.
  • Provide User Guidelines: Give users clear guidelines. More details here.
  • Language Hints: Specify the receipt's language in your API request if known. More details here.
  • Unexpected Results: Contact us via [email protected] if the results are not expectated.

Response Time Optimisation

1. Optimise Image Uploads

  • Image Compression: Compress images before uploading to reduce file size while maintaining quality.
  • Ideal Resolution: A resolution of 300 DPI is optimal for OCR performance.
  • File Format: Use JPEG for photographs and PNG for digitally generated receipts.

Example of image compression using Python:

from PIL import Image
import io

def compress_image(image_file, quality=85):
    img = Image.open(image_file)
    buffer = io.BytesIO()
    img.save(buffer, format="JPEG", quality=quality)
    return buffer.getvalue()

2. Implementing Efficient Error Handling

  • Use appropriate HTTP status codes for different error types.
  • Implement exponential backoff when receiving 429 (Too Many Requests) errors.

Example of exponential backoff in Python:

import time
import requests

def make_api_request(url, max_retries=3, base_delay=1):
    for attempt in range(max_retries):
        response = requests.post(url, data=payload)
        if response.status_code == 429:
            delay = base_delay * (2 ** attempt)
            time.sleep(delay)
        else:
            return response
    raise Exception("Max retries reached")

Rate Limits

Type of limitUsage limit
MB per request20 MB
Requests per second5
Requests per minute300
Requests per hour2000

Conclusion

Optimising your integration with Taggun's API can result in faster processing times, fewer errors, and an improved user experience. By following these best practices and continuously monitoring your application's performance, you can maximise the efficiency of Taggun's powerful receipt processing capabilities.

For further assistance, contact our support team at [email protected] for personalised optimisation advice.