AI-Powered Food Image Generation System at Scale
delivery_hero · E-commerce · 2025 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: Food-delivery menu image generation
Delivery Hero needed to generate high-quality product images at scale because missing menu images hurt conversion, but external image-generation APIs were too expensive for projected volumes.
Constraints:
- Most products lacked images or descriptions
- Generated images must meet brand, positioning, safety, and food-quality guidelines
- The system needed to support local cuisines, non-Latin product names, and very large generation volumes
Architecture
Delivery Hero built a production food-image generation system with two generation paths: text-to-image from product metadata and image inpainting from vendor assets. The production design self-hosted Stable Diffusion variants on GPU-backed EKS, used KEDA to autoscale model workers, evaluated generated images with computer-vision guideline checks, routed requests across model versions for local dishes, and kept restaurant owners/content teams in the final selection loop.
Diagram confidence: explicit (topology described by the source).
flowchart LR product-metadata-extractor["product-metadata-extractor"] text-to-image-generator["text-to-image-generator"] inpainting-pipeline["inpainting-pipeline"] stable-diffusion-serving-cluster["stable-diffusion-serving-cluster"] grounding-dino-detector["grounding-dino-detector"] keda-autoscaler["keda-autoscaler"] quality-scoring-system["quality-scoring-system"] model-routing-layer["model-routing-layer"] restaurant-owner-review["restaurant-owner-review"] post-processing-store["post-processing-store"] product-metadata-extractor --> text-to-image-generator product-metadata-extractor --> inpainting-pipeline text-to-image-generator --> stable-diffusion-serving-cluster inpainting-pipeline --> grounding-dino-detector inpainting-pipeline --> stable-diffusion-serving-cluster stable-diffusion-serving-cluster --> keda-autoscaler stable-diffusion-serving-cluster --> quality-scoring-system stable-diffusion-serving-cluster --> model-routing-layer text-to-image-generator --> post-processing-store inpainting-pipeline --> post-processing-store quality-scoring-system --> restaurant-owner-review post-processing-store --> restaurant-owner-review
Components
| Component | Role | Interacts with |
|---|---|---|
product-metadata-extractor |
pulls product names, categories, descriptions, attributes, and material/background preferences for generation prompts | text-to-image-generator, inpainting-pipeline |
text-to-image-generator |
generates product images directly from textual and categorical product context | stable-diffusion-serving-cluster, post-processing-store |
inpainting-pipeline |
selects vendor images, detects the food object, masks it, and runs image-to-image inpainting | grounding-dino-detector, stable-diffusion-serving-cluster, post-processing-store |
grounding-dino-detector |
detects food objects in vendor images so the inpainting pipeline can mask the right region | inpainting-pipeline |
stable-diffusion-serving-cluster |
hosts Stable Diffusion model variants on GPU-backed Kubernetes workers | keda-autoscaler, quality-scoring-system, model-routing-layer |
keda-autoscaler |
scales inference nodes according to message load | stable-diffusion-serving-cluster |
quality-scoring-system |
uses computer-vision checks for object placement, composition, color, content, and safety | stable-diffusion-serving-cluster, restaurant-owner-review |
model-routing-layer |
routes product requests to general or fine-tuned model versions based on product metadata | stable-diffusion-serving-cluster |
restaurant-owner-review |
lets content teams or restaurant owners choose the most appropriate generated images before production use | post-processing-store |
post-processing-store |
stores generation outputs in Postgres and GCS for review and publishing | restaurant-owner-review |
Data flow
Product names, categories, descriptions, attributes, and vendor background preferences feed a text-to-image prompt path; vendor images feed an inpainting path that selects the right source image, detects and masks the food object, then generates replacements. Model outputs are written to Postgres and GCS, surfaced through Google Forms and later restaurant-owner interfaces, then measured through guideline-scoring CV models and A/B conversion tests.
3 supporting quotes
Why this architecture
The architecture follows the production constraints: DALL-E-like hosted generation was too expensive at tens of millions of images, a single generic model missed local dishes, and image quality could not be optimized without automated measurement. Self-hosting, GPU autoscaling, model routing, and CV quality gates let the team lower cost while preserving restaurant-appropriate output quality.
3 supporting quotes
Models used: Stable Diffusion Juggernaut V9 · Stable Diffusion XL · OpenAI DALL-E · Grounding DINO · Recognize Anything · EasyOCR · CLIP · OneTrainer fine-tuned Stable Diffusion
Scale
- The system covered about 100,000 generated images per day during scale-up.“Depending on the load, our cluster scaled from 0 to 36 nodes and back to 0. This allowed us to already cover around 100,000 images to be generated daily.”article, stated
- Delivery Hero had generated around one million images overall and had more than 100,000 products with generated images on platform.“we have generated around a million images. More than 100,000 products have generated images on our platforms.”article, stated
- The menu-image intervention produced a 6% to 8% menu-to-cart conversion lift.“After conducting the A/B test, we have observed 6% to 8% increase in terms of conversion rate from menu to cart when we add an image to a product.”article, stated
- Inference optimization reached 11.2 seconds per image.“we do inference, it is more optimized. We have reached 11.2 seconds per image.”article, stated
- Self-hosted optimized generation reached less than 0.3 cents per generated image.“We have reached a level of less than 0.3 cents per generated image. On the volume of tens of millions, that was corresponding to around hundreds or even millions of euros in savings”article, stated
- The image-quality benchmark generated 1,000 images for 1,000 preselected products per model version.“We were generating 1000 images for the 1000 preselected products stratified by entities and by categories.”article, stated
Alternatives considered (roads not taken)
Continue hosted DALL-E-style image generation
Rejected because: The team moved to internal hosting because hosted generation cost was too high for expected image volumes.
Thousands of LoRA adapters for local dishes
Rejected because: The number of local dishes would have made adapter generation and serving infrastructure too complex.
Use Stable Diffusion outputs without a repeatable quality benchmark
Rejected because: The team needed automated scoring against product-image guidelines before judging whether a new model was better.
Run every component on the same GPU-heavy environment
Rejected because: Different components had different hardware and driver requirements, so separating environments avoided overprovisioning lighter steps.
Patterns
eval-driven-development (generative-quality-measurement)
Delivery Hero created automated CV evaluators for image guidelines before iterating on model versions and fine-tuning.
safety-policy-enforcement (image-quality-and-safety-filtering)
The production safety layer detects creatures, people, malformed text, and layout violations before images can reach users.
latency-optimization (diffusion-inference-optimization)
The team optimized generation time with GPU choice, float16 precision, Tiny VAE, classifier-free guidance adjustments, and fewer diffusion steps.
cost-aware-routing (self-hosted-generation)
Delivery Hero migrated away from DALL-E toward self-hosted Stable Diffusion and L4 GPUs to lower cost per generated image.
model-routing (food-category-specialization)
Multiple model versions are served in production and requests route by product metadata to avoid fine-tuning regressions on common dishes.
human-in-the-loop-gate (restaurant-owner-review)
Restaurant owners review suggested generated images and choose the image that best represents their menu item.
Tradeoffs
How to support thousands of local dishes.
Chose full model fine-tuning over thousands of separate LoRA adapters.
Rationale: Serving and managing thousands of adapters would have added too much infrastructure complexity.
When to optimize generative AI quality.
Chose automate measurement before fine-tuning over tuning the generator without a repeatable quality metric.
Rationale: The team concluded that model improvement depends on first being able to measure system quality.
Gotchas (what bit them)
CLIP failed unexpectedly on non-Latin product names.
Root cause: Chinese and Arabic names did not work well inside the full Stable Diffusion generation process despite CLIP's multilingual training.
Resolution: Translate non-Latin product names to English before generation.
The multi-cloud architecture slowed delivery.
Root cause: Splitting infrastructure between GCP and AWS introduced integration work that took longer than planned.
Resolution: The talk identifies this as a mistake and a lesson to avoid unnecessary multi-cloud complexity.
Generative image quality lacked a natural ground truth metric.
Root cause: Image generation quality is subjective and cannot be measured with simple supervised accuracy.
Resolution: Use product-guideline-aligned CV models to score positioning, composition, color, and content.
Fine-tuning for local dishes hurt some common foods.
Root cause: Specializing the denoising model on local cuisines changed behavior for broader food categories.
Resolution: Serve several model versions and route by product metadata.
Evaluation
Delivery Hero evaluates generated food images with guideline-specific CV models, benchmark datasets, A/B conversion tests, and cost/time profiling of inference configurations.
Metrics: quality score · conversion lift · cost per image · generation time · daily generated images · restaurant-owner acceptance
Outcomes
- The production system generated around one million images and covered more than 100,000 products.
- A/B testing showed 6-8% conversion lift from menu to cart when product images were added.
- The autoscaled cluster could cover around 100,000 generated images daily.
The EKS inference cluster scaled from 0 to 36 nodes using KEDA, and the economics were evaluated for tens to hundreds of millions of images.