summaryrefslogtreecommitdiff
path: root/workflows
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-25 09:08:50 +0200
committerPaul Buetow <paul@buetow.org>2026-03-25 09:08:50 +0200
commita77bbc20621bedc9c674a06440a87d28144bc806 (patch)
tree28e848f7842e3ac0964d39bcb020a2b5b04f23b8 /workflows
parentdd3503c774d8487d6e578240dec83ca8142adaa3 (diff)
photo-enhance: adaptive pipeline with conditional ESRGAN and blended scene grading
Addresses all five priority improvements from photo-enhance-review.md: 1. Conditional ESRGAN (ConditionalESRGANBlend node): portrait and night scenes skip Real-ESRGAN entirely; indoor/golden_hour use a reduced blend (0.25–0.60); landscape/beach keep full strength. Confidence- weighted ratios from CLIP scores soften hard scene-boundary transitions. 2. Blended CLIP scene profiles: CLIPSceneDetect now outputs top-3 scene scores as a normalised JSON string. AdaptivePhotoGrade blends the matching grading profiles weighted by confidence instead of hard- switching on the argmax label — a 55/35/10 landscape/golden_hour/overcast split produces a weighted average of those three profiles. 3. Conservative depth defaults: DepthSelectiveSharpen background_blur changed from 0.50 to 0.0 (disabled by default). Foreground sharpening is kept; background blur can be re-enabled explicitly per shot. 4. EXIF/ICC preservation: copy_exif() in photo-enhance.rb uses exiftool to restore capture time, camera/lens info, GPS, and ICC profile from the source file onto the enhanced JPEG after ComfyUI strips metadata. Embedded thumbnail/preview are excluded to avoid showing the old image. 5. Provenance logging: prompt_id is now passed into the metadata markdown report. WritePhotoMetadata emits scene_scores and esrgan_mode into the JSON sidecar. The markdown report now shows top-3 scene confidences, ESRGAN mode, and ComfyUI prompt ID for reproducibility. Workflow restructured: CLIPSceneDetect now runs on the original image (before ESRGAN) so scene scores are available to gate the upscaler. ConditionalESRGANBlend (node 16) inserted between ESRGAN downscale and CodeFormer. All downstream nodes receive scene_scores via node 11 outputs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'workflows')
-rw-r--r--workflows/photo-enhance.json41
1 files changed, 27 insertions, 14 deletions
diff --git a/workflows/photo-enhance.json b/workflows/photo-enhance.json
index 6db3e1d..7f7b7a4 100644
--- a/workflows/photo-enhance.json
+++ b/workflows/photo-enhance.json
@@ -7,6 +7,13 @@
"upload": "image"
}
},
+ "11": {
+ "class_type": "CLIPSceneDetect",
+ "_meta": {"title": "CLIP Scene Detect — runs on ORIGINAL image so scene scores can gate ESRGAN"},
+ "inputs": {
+ "image": ["1", 0]
+ }
+ },
"3": {
"class_type": "UpscaleModelLoader",
"_meta": {"title": "Load realesr-general-x4v3 (photo-tuned AI upscaler)"},
@@ -31,27 +38,31 @@
"scale_by": 0.25
}
},
+ "16": {
+ "class_type": "ConditionalESRGANBlend",
+ "_meta": {"title": "Conditional ESRGAN Blend — skip/weaken ESRGAN for portrait/night scenes"},
+ "inputs": {
+ "original": ["1", 0],
+ "esrgan": ["5", 0],
+ "scene_type": ["11", 1],
+ "scene_scores": ["11", 2]
+ }
+ },
"6": {
"class_type": "CodeFormerRestore",
"_meta": {"title": "CodeFormer — AI face restoration (GPU, fidelity=0.7)"},
"inputs": {
- "image": ["5", 0],
+ "image": ["16", 0],
"fidelity": 0.7
}
},
- "11": {
- "class_type": "CLIPSceneDetect",
- "_meta": {"title": "CLIP Scene Detect — classifies scene type (portrait/landscape/night/etc)"},
- "inputs": {
- "image": ["6", 0]
- }
- },
"12": {
"class_type": "AdaptivePhotoGrade",
- "_meta": {"title": "Adaptive Photo Grade — scene-tuned exposure/contrast/saturation/detail"},
+ "_meta": {"title": "Adaptive Photo Grade — blends scene profiles weighted by CLIP confidence"},
"inputs": {
- "images": ["11", 0],
- "scene_type": ["11", 1]
+ "images": ["6", 0],
+ "scene_type": ["11", 1],
+ "scene_scores": ["11", 2]
}
},
"13": {
@@ -65,19 +76,21 @@
},
"14": {
"class_type": "DepthSelectiveSharpen",
- "_meta": {"title": "Depth Selective Sharpen — Depth-Anything depth map → foreground sharp, BG soft"},
+ "_meta": {"title": "Depth Selective Sharpen — foreground sharpening only (no background blur)"},
"inputs": {
"images": ["13", 0],
"foreground_sharpen": 1.50,
- "background_blur": 0.50
+ "background_blur": 0.0
}
},
"15": {
"class_type": "WritePhotoMetadata",
- "_meta": {"title": "Write Photo Metadata — saves per-photo JSON report to ComfyUI output dir"},
+ "_meta": {"title": "Write Photo Metadata — saves per-photo JSON with scene scores and ESRGAN mode"},
"inputs": {
"image": ["14", 0],
"scene_type": ["11", 1],
+ "scene_scores": ["11", 2],
+ "esrgan_mode": ["16", 1],
"filename_prefix": "enhanced_",
"source_filename": "NODE_INPUT_IMAGE"
}