# What this feature does
# How image search works The app creates numeric image embeddings that describe what an image looks like. The ResNet50 model produces embeddings for each product image, stored as Product Image Embedding records. When a customer uploads a photo, the same model generates an embedding for the query image. The app compares embeddings using cosine similarity and returns the closest matches.
# Installation summary
- 1Place the app in your Frappe bench apps folder.
- 2Run: bench --site your-site install-app website_product_image_search
- 3Then: bench --site your-site migrate
- 4Finally: bench --site your-site clear-cache
Replace your-site with your site name. Confirm installation with bench --site your-site list-apps and check for website_product_image_search. Open the Website workspace in ERPNext Desk to find Image Search Configuration and Product Image Embedding links.
# Create an Image Search Configuration Go to Website > Image Search Configuration and add a new configuration. Key fields:
- Configuration Name and Enabled checkbox.
- Select Product: All Products or Selected Products.
- Preview after Upload (optional).
- Maximum Suggestions (e.g., 5).
- Score Threshold (value between 0 and 1). Save the configuration.
# Choosing a Score Threshold The Score Threshold is the minimum similarity required for a product to appear:
- 0.20 Loose: many results, weaker matches.
- 0.50 Medium: balanced results.
- 0.70 Strict: stronger but fewer matches.
- 0.90 Very strict: often few or no results.
For a live store, begin between 0.60 and 0.75 and adjust based on result quality.
# Selecting which products to include All Products: includes every published Website Item with an image. Simpler setup and full catalog coverage, but large catalogs increase processing time. The app skips unpublished items and items without images.
Selected Products: lets you list specific Website Items in a Products table. Use this for small-scale testing, campaign-limited searches, or excluding low-quality product photos. This mode generates embeddings faster but excludes any product not listed.
# Embeddings and when search works Image search returns results only after you generate embeddings for the chosen products. The app marks embeddings stale when you update an item and deletes them when you delete an item. Generating embeddings requires Python packages torch, torchvision, and Pillow on the site.
# Practical setup notes
- Confirm ERPNext and Webshop are installed before installing the app.
- Install the required Python packages on the site so embeddings can be generated.
- If configuration links don't appear in Website workspace, re-run migrate, clear-cache, then hard-refresh your browser.
- Start with Selected Products for testing to reduce processing time and tune the score threshold, then expand to All Products once performance and relevance meet your needs.
# Quick troubleshooting pointers
- No results: check whether embeddings were generated and whether items are published and have images.
- Missing links in Website workspace: migrate, clear-cache, and hard refresh.
- Slow generation: limit to Selected Products or schedule embedding jobs outside peak traffic windows.