diff --git "a/editing-progress.html" "b/editing-progress.html" --- "a/editing-progress.html" +++ "b/editing-progress.html" @@ -1,288 +1,285 @@ Qwen Pixel-Edit 当前训练进度

Qwen Pixel-Edit:当前训练进度

2026-11-27 15:15:43 北京时间 · 完整实验看板

数据构造:严格合格进度

严格合格监督(相同内容去重)

34,713 / 20,000

独立编辑任务

13,223 / 10,000

最近一小时首次严格通过:102 条;新版流水线完成候选 310。切换后的第一个小时属于不完整观测窗口,暂不据此自动推算完成日期。

所有来源统一要求:指令遵循、区域保留、画质、完整编辑范围均至少4/5,且完整目标判定为真;程序执行、复跑、依赖与英文检查通过。历史库存另列,新严格库存尚未完成全量人工审核。

存储状态:活跃数据已迁至新盘,CPU/API 数据构造已恢复;GPU 任务保持暂停。

迁移快照:SFT素材与构造文件约 69.6 GB;约59 GB的API传输归档已删除,后续不长期保存请求与回复副本。

来源严格 RFT严格 TI合计
anyedit721205926
magicbrush7924261,218
maskedit_en2,2014,1376,338
maskedit_scene1,6972,6484,345
sciforma14,1125,86519,977
ultraedit1,2626471,909

生产线心跳和实际产出

对标Qwen-Image-Edit:fine-grained数据

已从现有官方train索引 3071 个候选任务(尚未全数通过teacher)。重点:文字/数字、局部组件属性、材质、光照与几何辅助线。

2511公开卖点包含一致性、工业材质、光照和几何推理;2509还强调文字样式与多图编辑。当前主线仍是单图source-only程序,多图和新视角是待补齐能力。官方GPU基线尚未重新运行。

官方2511能力说明 · WeEdit文字编辑 · FineEdit区域编辑

单次回答的配对 prompt 测试

同一批24个训练任务,比较原版与执行约束版;相同RGB检查与图像judge。进度 384/384。排队/API错误单列,小样本结果用于选择下一轮实验。

生产线状态心跳近一小时首次严格通过错误重试预算耗尽
rft_and_rescuerunning2026-11-27T15:15:25.645324+08:00190
gpt62running2026-11-27T15:15:39.404129+08:0000
ti_balanced_en_v1running2026-11-27T15:15:42.772355+08:00831
ti_night_sol_v2waiting_for_off_peak2026-11-27T15:15:41.932376+08:0000
sol61_extra_v3waiting_for_new_tasks2026-11-27T15:16:02.369684+08:0000
teacher56_extra_v3waiting_for_new_tasks2026-11-27T15:15:55.523706+08:0000
sol62_extra_v3running2026-11-27T15:15:57.968045+08:0004
finegrained_extra_v1waiting_for_new_tasks2026-11-27T15:16:02.724495+08:0000
Teacher / prompt已完成严格合格通过率基础设施待处理
deepseek/baseline24520.8%0
deepseek/contract_v324520.8%0
gpt55/baseline24625.0%0
gpt55/contract_v324520.8%0
gpt56sol/baseline24729.2%0
gpt56sol/contract_v3241041.7%0
gpt61/baseline24937.5%0
gpt61/contract_v3241145.8%0
gpt62/baseline241145.8%0
gpt62/contract_v3241250.0%0
luna/baseline24833.3%0
luna/contract_v324625.0%0
seed21pro/baseline24312.5%0
seed21pro/contract_v32428.3%0
terra/baseline24729.2%0
terra/contract_v324937.5%0

新任务导入状态:reservoir_full;图片预算 未知 GiB,当前约 0.00 GiB。

路由优先局部像素操作和图形编辑;复杂物体合成占每条生产线滚动24小时尝试预算至多约15%。RFT至多2个teacher、独立TI至多2个Sol、语义失败补救至多1次;排队中的请求持续等待,API错误达到重试预算后保留待处理记录。原始数据与旧实验保留。

历史导出库存与已完成实验

模型输入原图和英文编辑指令,一次输出计划与 Python,程序从原图计算修改后的 RGB。下表保留旧导出口径;新的严格合格库存见上方进度。

20,859 行历史英文导出

RFT 14,417 + TI 6,442 · 独立任务 14,256。这里包含不同 teacher、增强版本及已停用来源的存档,不能作为新版严格训练集规模。新的训练快照对所有来源执行同一质量门槛。

来源RFTTI合计
anyedit1,1044081,512
instructpix2pix1,0143461,360
magicbrush5,2383,6158,853
maskedit_en6856201,305
maskedit_scene6906231,313
sciforma1,8911472,038
ultraedit3,7956834,478

最新 RL smoke:同一批 64 个 MagicBrush dev 任务

SFT 起点

3/64

代码执行 44/64

RL 后

11/64

代码执行 46/64

3 次真实参数更新,初始 SFT reference 权重不变。10 个任务由失败变成功,2 个由成功变失败。

这是自建图像 judge 的语义评估,不是官方像素指标。目前只有一个训练 seed,旧 greedy 推理存在数值重复性问题。正在用固定数值设置重复评测;不能直接归因为稳定 RL 收益。

正在推进:同 teacher、同任务的 RFT/TI 配比实验

每个配置覆盖相同的 256 个真��训练任务,TI 替换 RFT 答案。0%、25%、50% 是样本行数比例,三组总回答 token 预算均为 100 万;实际 TI token 比例另行统计。

ti00 · 157 步 · 1,001,372 / 1,000,000 回答 tokens · loss 0.46102285385131836

固定 dev64:图像 judge 11/64,代码执行 36/64。

实际TI回答token占比 0.0% · 平均每行出现 1.23 次

ti25 · 153 步 · 1,001,002 / 1,000,000 回答 tokens · loss 0.6757060885429382

固定 dev64:图像 judge 8/64,代码执行 34/64。

实际TI回答token占比 28.6% · 平均每行出现 1.20 次

ti50 · 150 步 · 1,003,372 / 1,000,000 回答 tokens · loss 0.7614325284957886

固定 dev64:图像 judge 7/64,代码执行 30/64。

实际TI回答token占比 53.7% · 平均每行出现 1.17 次

此实验限于 RFT 和 TI 都成功的任务,测试监督形式;TI 救回难任务的覆盖收益需要另一组对照。官方 benchmark、独立人工审核、跨数据集与多 seed 结果仍待补齐。

当前重复验证

固定数值设置和6k输出预算,重新测同一批dev64;第二个RL seed采用相同设置。推理完成后展示全量结果。

流程已评任务执行成功图像judge通过
SFT起点64/644311
已有RL模型64/644610
Qwen3.8零样本64/64474

InstructPix2Pix 已停用

按用户要求,不再采集或构造该来源的RFT/TI。已经生成的原始记录、图片与旧实验保留;历史库存数字包含这些存档,新训练快照排除该来源。

持续构造 SFT 数据

任务池 42,569 个 · 本次合格轨迹 8,826 条 · 对应 8,826 个任务

生产心跳:2026-11-27T15:15:06.257565+08:00 · 白天并发配置。任务池会自动读取新数据,不在 128 条或 10k 行时停止。

Teacher / 方式运行或等待 API / 并发上限待处理已完成合格轨迹待重试
GPT-5.5 · RFT0 / 808,0301,78449
GPT-6.1-Sol · RFT7 / 814,65413,0405,1742218
GPT-5.6-Terra · RFT0 / 401,06224734
GPT-5.6-Luna · RFT0 / 401,03821923
GPT-6.1-Sol · TI0 / 803,965339581
GPT-6.2-Sol · RFT4 / 412,2362,0161,06323

自动扩库:任务池已足够,随生成进度继续补充。已接入任务:{"anyedit": 14559, "maskedit_scene": 4804, "maskedit_en": 2266, "maskedit_cn": 523, "ultraedit": 11528, "instructpix2pix": 2902, "sciforma": 7362, "magicbrush": 2491}。

已导出 4,728 条新 SFT 轨迹。原有 8,601 / 12,006 条对照训练集保持冻结,新增数据单独保存,用于后续规模实验。

合格要求:一次 teacher 输出、程序过滤、执行、完整目标区域的图像 judge 和重用执行检查通过。API 或 judge 错误会重试,不计为成功样本。任务按原图内容分组,排除官方 MagicBrush dev 与现有验证图片的内容重叠。TI 在 source-only 失败后补救,学生输入只包含原图和指令。

英文 TI:独立补充训练样本

RFT成功的任务也构造TI,保留两种方法的合格轨迹。新数据只保留英文任务和监督文本;旧实验保留用于复现,中文子集不进入新训练快照。北京时间工作日18:00–09:00、周末全天提高Sol并发。1:1为训练配比对照目标,当前通过率不被人为调整。

独立TI合格样本 2,158 · 生产心跳 2026-11-27T15:15:24.990491+08:00

TI teacher运行/并发上限待处理已完成合格待重试
GPT-6.1-Sol7/816,89510,8453,3712229
GPT-6.2-Sol4/416,2276,3482,197179

非工作时间补充:61/62-Sol TI

状态 waiting_for_off_peak · 心跳 2026-11-27T15:15:18.000275+08:00。仅北京时间工作日18:00–09:00或周末发起新请求;白天保留排队中的调用。优先科研图、文字布局、区域编辑和MagicBrush。

Teacher运行或等待 / 上限待构造合格轨迹
GPT-6.1-Sol0/019,5532,961
GPT-6.2-Sol0/016,5681,924

每个teacher增加至多16个夜间请求槽;额外候选使用独立ID,不改写旧轨迹。并发上限包含可能仍在API队列中的请求,不代表完成速度。

当前英文SFT库存:按样本行数统计,可相加

数据来源RFT行数TI行数合计
anyedit1,1044081,512
instructpix2pix1,0143461,360
magicbrush5,2383,6158,853
maskedit_en6856201,305
maskedit_scene6906231,313
sciforma1,8911472,038
ultraedit3,7956834,478

英文SFT行数 20,859 = RFT 14,417 + TI 6,442;独立任务覆盖 14,256。行数包含不同teacher轨迹和增强版本,后续冻结训练快照另做完全相同监督内容的去重。

展示样本的质量门槛

下方是历史候选的图像展示:自建图像judge通过、画质与保留评分至少4/5。页面顶部的新版严格库存还要求指令遵循、完整编辑范围至少4/5和完整目标判定。InstructPix2Pix已停用,旧记录存档保留,新库存排除。

质量筛选后的候选:Replace the blank white laptop screen with a colorful video editing software interface showing multiple timeline tracks and preview windows. Keep the laptop body, keyboard, surrounding couch fabric, headphones, melodica keyboard, microphone, cables, all other text, lighting, camera perspective, and overall scene unchanged.

maskedit_scene · GPT-6.1-Sol · RFT · 自建图像judge通过 · 画质4/5 · 保留5/5

原图
单次 teacher 代码执行
数据集目标
完整 teacher 计划与代码
{
+.rgb-images{grid-template-columns:repeat(5,1fr)}a{color:var(--accent)}@media(max-width:700px){.rgb-images{grid-template-columns:1fr 1fr}} .gain64-images{grid-template-columns:repeat(4,1fr)}@media(max-width:700px){.gain64-images{grid-template-columns:1fr 1fr}}

Qwen Pixel-Edit:当前训练进度

2026-11-27 15:18:50 北京时间 · 完整实验看板

数据构造:严格合格进度

严格合格监督(相同内容去重)

34,717 / 20,000

独立编辑任务

13,224 / 10,000

最近一小时首次严格通过:103 条;新版流水线完成候选 310。切换后的第一个小时属于不完整观测窗口,暂不据此自动推算完成日期。

所有来源统一要求:指令遵循、区域保留、画质、完整编辑范围均至少4/5,且完整目标判定为真;程序执行、复跑、依赖与英文检查通过。历史库存另列,新严格库存尚未完成全量人工审核。

存储状态:活跃数据已迁至新盘,CPU/API 数据构造已恢复;GPU 任务保持暂停。

迁移快照:SFT素材与构造文件约 69.6 GB;约59 GB的API传输归档已删除,后续不长期保存请求与回复副本。

来源严格 RFT严格 TI合计
anyedit721205926
magicbrush7924261,218
maskedit_en2,2014,1376,338
maskedit_scene1,6972,6484,345
sciforma14,1125,86819,980
ultraedit1,2636471,910

生产线心跳和实际产出

对标Qwen-Image-Edit:fine-grained数据

已从现有官方train索引 3071 个候选任务(尚未全数通过teacher)。重点:文字/数字、局部组件属性、材质、光照与几何辅助线。

2511公开卖点包含一致性、工业材质、光照和几何推理;2509还强调文字样式与多图编辑。当前主线仍是单图source-only程序,多图和新视角是待补齐能力。官方GPU基线尚未重新运行。

官方2511能力说明 · WeEdit文字编辑 · FineEdit区域编辑

单次回答的配对 prompt 测试

同一批24个训练任务,比较原版与执行约束版;相同RGB检查与图像judge。进度 384/384。排队/API错误单列,小样本结果用于选择下一轮实验。

生产线状态心跳��一小时首次严格通过错误重试预算耗尽
rft_and_rescuerunning2026-11-27T15:18:21.496118+08:00210
gpt62running2026-11-27T15:18:45.624613+08:0000
ti_balanced_en_v1running2026-11-27T15:18:58.032657+08:00821
ti_night_sol_v2waiting_for_off_peak2026-11-27T15:19:00.448094+08:0000
sol61_extra_v3waiting_for_new_tasks2026-11-27T15:18:54.044795+08:0000
teacher56_extra_v3waiting_for_new_tasks2026-11-27T15:19:10.014535+08:0000
sol62_extra_v3running2026-11-27T15:19:11.487420+08:0004
finegrained_extra_v1waiting_for_new_tasks2026-11-27T15:18:54.722786+08:0000
Teacher / prompt已完成严格合格通过率基础设施待处理
deepseek/baseline24520.8%0
deepseek/contract_v324520.8%0
gpt55/baseline24625.0%0
gpt55/contract_v324520.8%0
gpt56sol/baseline24729.2%0
gpt56sol/contract_v3241041.7%0
gpt61/baseline24937.5%0
gpt61/contract_v3241145.8%0
gpt62/baseline241145.8%0
gpt62/contract_v3241250.0%0
luna/baseline24833.3%0
luna/contract_v324625.0%0
seed21pro/baseline24312.5%0
seed21pro/contract_v32428.3%0
terra/baseline24729.2%0
terra/contract_v324937.5%0

新任务导入状态:reservoir_full;图片预算 未知 GiB,当前约 0.00 GiB。

路由优先局部像素操作和图形编辑;复杂物体合成占每条生产线滚动24小时尝试预算至多约15%。RFT至多2个teacher、独立TI至多2个Sol、语义失败补救至多1次;排队中的请求持续等待,API错误达到重试预算后保留待处理记录。原始数据与旧实验保留。

历史导出库存与已完成实验

模型输入原图和英文编辑指令,一次输出计划与 Python,程序从原图计算修改后的 RGB。下表保留旧导出口径;新的严格合格库存见上方进度。

20,859 行历史英文导出

RFT 14,417 + TI 6,442 · 独立任务 14,256。这里包含不同 teacher、增强版本及已停用来源的存档,不能作为新版严格训练集规模。新的训练快照对所有来源执行同一质量门槛。

来源RFTTI合计
anyedit1,1044081,512
instructpix2pix1,0143461,360
magicbrush5,2383,6158,853
maskedit_en6856201,305
maskedit_scene6906231,313
sciforma1,8911472,038
ultraedit3,7956834,478

最新 RL smoke:同一批 64 个 MagicBrush dev 任务

SFT 起点

3/64

代码执行 44/64

RL 后

11/64

代码执行 46/64

3 次真实参数更新,初始 SFT reference 权重不变。10 个任务由失败变成功,2 个由成功变失败。

这是自建图像 judge 的语义评估,不是官方像素指标。目前只有一个训练 seed,旧 greedy 推理存在数值重复性问题。正在用固定数值设置重复评测;不能直接归因为稳定 RL 收益。

正在推进:同 teacher、同任务的 RFT/TI 配比实验

每个配置覆盖相同的 256 个真实训练任务,TI 替换 RFT 答案。0%、25%、50% 是样本行数比例,三组总回答 token 预算均为 100 万;实际 TI token 比例另行统计。

ti00 · 157 步 · 1,001,372 / 1,000,000 回答 tokens · loss 0.46102285385131836

固定 dev64:图像 judge 11/64,代码执行 36/64。

实际TI回答token占比 0.0% · 平均每行出现 1.23 次

ti25 · 153 步 · 1,001,002 / 1,000,000 回答 tokens · loss 0.6757060885429382

固定 dev64:图像 judge 8/64,代码执行 34/64。

实际TI回答token占比 28.6% · 平均每行出现 1.20 次

ti50 · 150 步 · 1,003,372 / 1,000,000 回答 tokens · loss 0.7614325284957886

固定 dev64:图像 judge 7/64,代码执行 30/64。

实际TI回答token占比 53.7% · 平均每行出现 1.17 次

此实验限于 RFT 和 TI 都成功的任务,测试监督形式;TI 救回难任务的覆盖收益需要另一组对照。官方 benchmark、独立人工审核、跨数据集与多 seed 结果仍待补齐。

当前重复验证

固定数值设置和6k输出预算,重新测同一批dev64;第二个RL seed采用相同设置。推理完成后展示全量结果。

流程已评任务执行成功图像judge通过
SFT起点64/644311
已有RL模型64/644610
Qwen3.8零样本64/64474

InstructPix2Pix 已停用

按用户要求,不再采集或构造该来源的RFT/TI。已经生成的原始记录、图片与旧实验保留;历史库存数字包含这些存档,新训练快照排除该来源。

持续构造 SFT 数据

任务池 42,569 个 · 本次合格轨迹 8,829 条 · 对应 8,829 个任务

生产心跳:2026-11-27T15:17:43.445622+08:00 · 白天并发配置。任务池会自动读取新数据,不在 128 条或 10k 行时停止。

Teacher / 方式运行或等待 API / 并发上限待处理已完成合格轨迹待重试
GPT-5.5 · RFT0 / 808,0301,78449
GPT-6.1-Sol · RFT6 / 814,64813,0475,1772218
GPT-5.6-Terra · RFT0 / 401,06224734
GPT-5.6-Luna · RFT0 / 401,03821923
GPT-6.1-Sol · TI0 / 803,965339581
GPT-6.2-Sol · RFT4 / 412,2402,0161,06323

自动扩库:任务池已足够,随生成进度继续补充。已接入任务:{"anyedit": 14559, "maskedit_scene": 4804, "maskedit_en": 2266, "maskedit_cn": 523, "ultraedit": 11528, "instructpix2pix": 2902, "sciforma": 7362, "magicbrush": 2491}。

已导出 4,728 条新 SFT 轨迹。原有 8,601 / 12,006 条对照训练集保持冻结,新增数据单独保存,用于后续规模实验。

合格要求:一次 teacher 输出、程序过滤、执行、完整目标区域的图像 judge 和重用执行检查通过。API 或 judge 错误会重试,不计为成功样本。任务按原图内容分组,排除官方 MagicBrush dev 与现有验证图片的内容重叠。TI 在 source-only 失败后补救,学生输入只包含原图和指令。

英文 TI:独立补充训练样本

RFT成功的任务也构造TI,保留两种方法的合格轨��。新数据只保留英文任务和监督文本;旧实验保留用于复现,中文子集不进入新训练快照。北京时间工作日18:00–09:00、周末全天提高Sol并发。1:1为训练配比对照目标,当前通过率不被人为调整。

独立TI合格样本 2,158 · 生产心跳 2026-11-27T15:18:17.989502+08:00

TI teacher运行/并发上限待处理已完成合格待重试
GPT-6.1-Sol8/816,88510,8543,3742226
GPT-6.2-Sol4/416,2336,3482,197179

非工作时间补充:61/62-Sol TI

状态 waiting_for_off_peak · 心跳 2026-11-27T15:18:09.437928+08:00。仅北京时间工作日18:00–09:00或周末发起新请求;白天保留排队中的调用。优先科研图、文字布局、区域编辑和MagicBrush。

Teacher运行或等待 / 上限待构造合格轨迹
GPT-6.1-Sol0/019,5532,961
GPT-6.2-Sol0/016,5681,924

每个teacher增加至多16个夜间请求槽;额外候选使用独立ID,不改写旧轨迹。并发上限包含可能仍在API队列中的请求,不代表完成速度。

当前英文SFT库存:按样本行数统计,可相加

数据来源RFT行数TI行数合计
anyedit1,1044081,512
instructpix2pix1,0143461,360
magicbrush5,2383,6158,853
maskedit_en6856201,305
maskedit_scene6906231,313
sciforma1,8911472,038
ultraedit3,7956834,478

英文SFT行数 20,859 = RFT 14,417 + TI 6,442;独立任务覆盖 14,256。行数包含不同teacher轨迹和增强版本,后续冻结训练快照另做完全相同监督内容的去重。

展示样本的质量门槛

下方是历史候选的图像展示:自建图像judge通过、画质与保留评分至少4/5。页面顶部的新版严格库存还要求指令遵循、完整编辑范围至少4/5和完整目标判定。InstructPix2Pix已停用,旧记录存档保留,新库存排除。

质量筛选后的候选:Surround the bouquet with vibrant butterflies

ultraedit · GPT-6.1-Sol · RFT · 自建图像judge通过 · 画质4/5 · 保留5/5

原图
单次 teacher 代码执行
数据集目标
完整 teacher 计划与代码
{
   "visual_evidence": [
-    "A silver Dell laptop sits diagonally on patterned couch fabric.",
-    "The laptop display is almost entirely blank white, with thin blue edges.",
-    "The keyboard, palm rest, screen bezel, and Dell logo are visible.",
-    "Headphones, a melodica, a desktop microphone, and cables surround the laptop."
+    "A compact bouquet with pink and pale flowers, dark flower centers, and green foliage sits below the center of the image.",
+    "The bouquet rests on a white tablecloth.",
+    "Folded white napkins and softly focused wine glasses occupy the background.",
+    "Open areas above, beside, and below the bouquet provide room for butterflies."
   ],
-  "target_object": "The blank interior of the laptop screen",
-  "target_region": "The tilted quadrilateral inside the screen bezel, excluding the existing blue display edges",
-  "editing_intent": "Replace the blank display with a detailed, colorful video-editing interface containing two preview windows, media thumbnails, playback controls, and six timeline tracks.",
+  "target_object": "The space surrounding the bouquet",
+  "target_region": "Five small areas around the bouquet, without covering its flowers or foliage",
+  "editing_intent": "Add vibrant, detailed butterflies that appear to flutter around the bouquet, while preserving the existing table setting.",
   "editing_plan": [
-    "Define a perspective-aligned mask confined to the white display interior.",
-    "Generate textured scenic preview imagery using gradients, layered terrain, reflections, and noise.",
-    "Construct a detailed editing interface with menus, a media bin, two preview panels, colored video clips, audio waveforms, and level meters.",
-    "Project the interface into the original screen perspective.",
-    "Match screen illumination with subtle glare, shading, and fine noise, then feather the replacement inward at its boundary.",
-    "Return the edited image with every pixel outside the display mask preserved."
+    "Place five butterflies in the open spaces around the bouquet.",
+    "Construct curved, scalloped forewings and hindwings with varied color, textured shading, dark margins, fine veins, and small markings.",
+    "Add shaded bodies, antennae, and delicate legs; vary the butterflies' angles and wing proportions.",
+    "Add restrained, soft shadows beneath the lower butterflies.",
+    "Antialias and alpha-composite the additions, keeping all pixels outside their silhouettes and shadows unchanged."
   ],
   "preservation_constraints": [
-    "Preserve the laptop bezel, Dell logo, keyboard, palm rest, stickers, and indicator lights.",
-    "Preserve the surrounding couch fabric and its patterns.",
-    "Preserve the headphones, melodica, microphone, cables, and all text outside the replaced screen interior.",
-    "Do not change the camera perspective, image dimensions, or surrounding lighting."
+    "Do not change the bouquet, its flowers, foliage, or stems.",
+    "Preserve the existing tablecloth texture, folds, and lighting.",
+    "Do not remove or reposition the glasses, napkins, or cutlery.",
+    "Keep the original framing and background depth of field."
   ]
 }
 
 def edit(image):
     import numpy as np
     import cv2
-    from PIL import Image, ImageDraw, ImageFont
+    from PIL import Image, ImageDraw
 
     w, h = image.size
-    original = np.array(image.convert('RGB'))
-    rng = np.random.default_rng(731)
-    U = max(800, int(round(w * 0.90)))
-    V = int(round(U * 0.625))
-    canvas = Image.new('RGB', (U, V), (43, 48, 58))
-    d = ImageDraw.Draw(canvas)
-
-    def box(x0, y0, x1, y1, fill, outline=None):
-        d.rectangle((int(x0*U), int(y0*V), int(x1*U), int(y1*V)), fill=fill, outline=outline)
-
-    def line(points, fill, width=1):
-        d.line([(int(x*U), int(y*V)) for x, y in points], fill=fill, width=max(1, int(width*U/1200)))
-
-    def text(x, y, value, color=(204, 212, 222), size=0.017):
-        fs = max(8, int(V*size))
-        try:
-            font = ImageFont.load_default(size=fs)
-        except TypeError:
-            font = ImageFont.load_default()
-        d.text((int(x*U), int(y*V)), value, fill=color, font=font)
-
-    def landscape(pw, ph, shift=0.0):
-        yy, xx = np.mgrid[0:ph, 0:pw].astype(np.float32)
-        xx /= max(1, pw-1)
-        yy /= max(1, ph-1)
-        top = np.array([64, 106, 163], np.float32)
-        bottom = np.array([238, 171, 118], np.float32)
-        f = np.clip(yy/0.72, 0, 1)[..., None]
-        a = top[None, None, :]*(1-f) + bottom[None, None, :]*f
-        glow = np.exp(-(((xx-0.68)/0.25)**2 + ((yy-0.37)/0.31)**2))
-        a += glow[..., None]*np.array([26, 18, 4], np.float32)
-        sun = np.exp(-(((xx-0.68)/0.019)**2 + ((yy-0.35)/0.034)**2)*2.5)
-        a = a*(1-sun[..., None]*0.78) + np.array([255, 237, 190])*sun[..., None]*0.78
-        fine = rng.normal(0, 1.8, (ph, pw)).astype(np.float32)
-        cloud = cv2.GaussianBlur(rng.normal(0, 1, (ph, pw)).astype(np.float32), (0, 0), max(1, pw*0.018))
-        a += fine[..., None] + cloud[..., None]*34
-        coords = np.linspace(0, 1, pw)
-        for level, col, amp, seedcount in [(0.48, (111, 111, 137), 0.11, 19), (0.56, (69, 86, 115), 0.105, 27), (0.63, (41, 63, 84), 0.095, 31)]:
-            controls = rng.uniform(-1, 1, seedcount)
-            ridge = level + amp*np.interp(coords, np.linspace(0, 1, seedcount), controls)
-            ridge = cv2.GaussianBlur(ridge.astype(np.float32).reshape(1, -1), (0, 0), max(1, pw*0.006)).ravel()
-            mask = (yy > ridge[None, :]) & (yy < 0.69)
-            terrain = np.asarray(col, np.float32)[None, None, :] + (yy-level)[..., None]*19 + fine[..., None]*1.6
-            a[mask] = terrain[mask]
-        water = yy >= 0.69
-        depth = np.clip((yy-0.69)/0.31, 0, 1)
-        lake = np.array([81, 111, 134])[None, None, :]*(1-depth[..., None]) + np.array([32, 67, 87])[None, None, :]*depth[..., None]
-        reflected = np.exp(-((xx-0.68)/(0.026+depth*0.13))**2)*(1-depth*0.55)
-        ripple = np.sin(yy*ph*1.35 + np.sin(xx*27)*2.2)*0.5 + np.sin(yy*ph*0.42 + xx*18)*0.5
-        lake += reflected[..., None]*np.array([110, 68, 24])*(0.64+0.36*ripple[..., None])
-        lake += ripple[..., None]*4 + fine[..., None]*1.1
-        a[water] = lake[water]
-        bank = yy > (0.955 - 0.045*np.sin(xx*5.8+0.8) + 0.012*np.sin(xx*38))
-        foreground = np.array([22, 40, 42])[None, None, :] + fine[..., None]*2 + yy[..., None]*5
-        a[bank] = foreground[bank]
-        a += np.array([shift, shift*0.25, -shift*0.35])
-        return Image.fromarray(np.clip(a, 0, 255).astype(np.uint8))
-
-    # Application chrome and upper panels.
-    box(0, 0, 1, 0.041, (62, 69, 82))
-    box(0, 0.041, 1, 0.093, (47, 53, 65))
-    text(0.014, 0.007, 'Studio Edit  |  Couch session - Creative cut', size=0.018)
-    text(0.014, 0.056, 'File   Edit   Clip   Sequence   Markers   View   Window   Help', size=0.017)
-    text(0.807, 0.057, 'EDIT   COLOR   AUDIO', (129, 194, 219), 0.015)
-    for i, col in enumerate([(217, 172, 78), (102, 160, 196), (116, 187, 154)]):
-        d.ellipse((int((0.940+i*0.019)*U), int(0.013*V), int((0.948+i*0.019)*U), int(0.025*V)), fill=col)
-    box(0.009, 0.103, 0.226, 0.564, (35, 41, 51), (78, 85, 99))
-    box(0.234, 0.103, 0.588, 0.564, (31, 37, 47), (77, 86, 101))
-    box(0.597, 0.103, 0.964, 0.564, (31, 37, 47), (77, 86, 101))
-    box(0.01, 0.104, 0.226, 0.143, (54, 62, 74))
-    box(0.235, 0.104, 0.588, 0.143, (54, 62, 74))
-    box(0.598, 0.104, 0.964, 0.143, (54, 62, 74))
-    text(0.02, 0.112, 'PROJECT / MEDIA', size=0.016)
-    text(0.246, 0.112, 'SOURCE: Lake_01.mov', size=0.016)
-    text(0.609, 0.112, 'PROGRAM: Creative cut', size=0.016)
-    line([(0.245, 0.143), (0.337, 0.143)], (84, 188, 224), 2)
-    line([(0.608, 0.143), (0.721, 0.143)], (84, 188, 224), 2)
-    box(0.021, 0.157, 0.214, 0.185, (50, 56, 67), (76, 84, 96))
-    text(0.028, 0.161, 'Search media...', (137, 151, 166), 0.015)
-    scene1 = landscape(max(1, int(U*0.335)), max(1, int(V*0.305)), -3)
-    scene2 = landscape(max(1, int(U*0.347)), max(1, int(V*0.305)), 7)
-    canvas.paste(scene1, (int(0.244*U), int(0.155*V)))
-    canvas.paste(scene2, (int(0.607*U), int(0.155*V)))
-    d = ImageDraw.Draw(canvas)
-    for i in range(4):
-        tx = 0.021 + (i % 2)*0.101
-        ty = 0.203 + (i // 2)*0.118
-        thumb = (scene1 if i % 2 == 0 else scene2).resize((max(1, int(0.091*U)), max(1, int(0.078*V))), Image.Resampling.LANCZOS)
-        canvas.paste(thumb, (int(tx*U), int(ty*V)))
-        d = ImageDraw.Draw(canvas)
-        text(tx, ty+0.081, ['Lake_01.mov', 'Sunset_02.mov', 'Wide_03.mov', 'Final_04.mov'][i], size=0.012)
-    line([(0.02, 0.444), (0.215, 0.444)], (75, 84, 96))
-    text(0.021, 0.453, '> Footage     4 clips', size=0.015)
-    text(0.021, 0.485, '> Music       2 files', (140, 204, 165), 0.015)
-    text(0.021, 0.516, '> Sequences   1 item', size=0.015)
-    for x0, x1, tc in [(0.244, 0.577, '00:00:08:12'), (0.607, 0.953, '00:00:18:07')]:
-        text(x0+0.004, 0.473, tc, (130, 208, 231), 0.019)
-        text(x1-0.071, 0.478, 'Fit  100%', (144, 155, 170), 0.014)
-        line([(x0+0.01, 0.508), (x1-0.01, 0.508)], (102, 117, 137))
-        cx = (x0+x1)*0.5
-        for k in [-2, -1, 1, 2]:
-            px = cx+k*0.027
-            line([(px, 0.529), (px, 0.545)], (187, 201, 217), 2)
-            line([(px-0.004, 0.537), (px+0.004, 0.537)], (187, 201, 217), 1)
-        d.polygon([(int((cx-0.005)*U), int(0.527*V)), (int((cx-0.005)*U), int(0.548*V)), (int((cx+0.008)*U), int(0.5375*V))], fill=(196, 214, 228))
-        line([(cx+0.09, 0.527), (cx+0.09, 0.547)], (95, 196, 221), 2)
-    # Timeline panel, ruler, track labels, and individual media segments.
-    box(0.009, 0.580, 0.957, 0.955, (32, 38, 47), (83, 94, 109))
-    box(0.010, 0.581, 0.956, 0.624, (55, 64, 78))
-    text(0.021, 0.591, 'TIMELINE: Creative cut', size=0.018)
-    text(0.297, 0.593, 'Selection  |  Snap ON', (161, 185, 206), 0.014)
-    text(0.748, 0.590, '1080p   24 fps', (140, 198, 218), 0.016)
-    box(0.018, 0.630, 0.155, 0.945, (45, 52, 63))
-    box(0.161, 0.630, 0.945, 0.672, (46, 54, 66))
-    for i in range(33):
-        px = 0.167+i*(0.769/32)
-        line([(px, 0.660 if i % 4 else 0.645), (px, 0.671)], (119, 131, 146))
-        if i % 4 == 0:
-            text(px+0.002, 0.634, '00:%02d' % (i*2), (167, 179, 195), 0.013)
-        line([(px, 0.673), (px, 0.943)], (48, 56, 68))
-    rows = [0.678, 0.723, 0.768, 0.813, 0.858, 0.903]
-    names = ['V3  Titles', 'V2  Overlay', 'V1  Video', 'A1  Dialogue', 'A2  Music', 'A3  Ambience']
-    for i, y in enumerate(rows):
-        box(0.019, y, 0.154, y+0.040, (50, 57, 70) if i < 3 else (43, 62, 61))
-        text(0.025, y+0.009, names[i], (198, 207, 218), 0.014)
-        text(0.127, y+0.010, 'S M', (140, 155, 173), 0.010)
-        line([(0.161, y+0.041), (0.945, y+0.041)], (72, 82, 96))
-
-    def clip(x0, x1, row, col, label, audio=False, thumbnails=False):
-        y0 = rows[row]+0.002
-        y1 = rows[row]+0.039
-        xa, xb = int(x0*U), int(x1*U)
-        ya, yb = int(y0*V), int(y1*V)
-        cw, ch = max(1, xb-xa), max(1, yb-ya)
-        grad = np.linspace(1.08, 0.80, ch, dtype=np.float32)[:, None, None]
-        patch = np.ones((ch, cw, 3), np.float32)*np.array(col, np.float32)*grad
-        patch += rng.normal(0, 0.85, (ch, cw, 1))
-        canvas.paste(Image.fromarray(np.clip(patch, 0, 255).astype(np.uint8)), (xa, ya))
-        nonlocal d
-        d = ImageDraw.Draw(canvas)
-        line([(x0, y0), (x1, y0)], tuple(min(255, int(c*1.35)) for c in col))
-        line([(x0, y0), (x0, y1)], (37, 44, 53))
-        line([(x1, y0), (x1, y1)], (29, 35, 45))
-        if audio:
-            center = int((y0+0.026)*V)
-            available = max(2, int(V*0.010))
-            count = max(8, cw//3)
-            energy = rng.uniform(0.2, 1.0, count)
-            for j in range(count):
-                xp = xa+int(j*cw/count)
-                envelope = 0.28+0.72*abs(np.sin(j*0.22)+0.2*np.cos(j*0.61))/1.2
-                amplitude = max(1, int(available*energy[j]*envelope))
-                d.line((xp, center-amplitude, xp, center+amplitude), fill=(185, 229, 203), width=1)
-        elif thumbnails:
-            tw = max(12, int(U*0.034))
-            th = max(3, int(V*0.014))
-            mini = scene2.resize((tw, th), Image.Resampling.LANCZOS)
-            for xp in range(xa+3, xb-tw, tw+4):
-                canvas.paste(mini, (xp, int((y0+0.021)*V)))
-            d = ImageDraw.Draw(canvas)
-        if cw > U*0.062:
-            text(x0+0.005, y0+0.002, label, (233, 238, 245), 0.011)
-
-    clip(0.214, 0.405, 0, (145, 92, 173), 'Opening title')
-    clip(0.648, 0.844, 0, (167, 97, 166), 'Closing title')
-    clip(0.302, 0.525, 1, (65, 151, 178), 'Color overlay')
-    clip(0.572, 0.786, 1, (60, 148, 180), 'Transition / B-roll')
-    for a, b, label in [(0.165, 0.305, 'Lake_01'), (0.309, 0.492, 'Sunset_02'), (0.496, 0.640, 'Wide_03'), (0.644, 0.809, 'Lake_01'), (0.813, 0.944, 'Final_04')]:
-        clip(a, b, 2, (70, 119, 187), label, thumbnails=True)
-    clip(0.165, 0.456, 3, (53, 138, 121), 'Voice.wav', audio=True)
-    clip(0.465, 0.735, 3, (54, 143, 120), 'Voice take 02', audio=True)
-    clip(0.755, 0.944, 3, (53, 138, 121), 'Voice.wav', audio=True)
-    clip(0.165, 0.944, 4, (84, 148, 98), 'Music - warm sunset.wav', audio=True)
-    clip(0.224, 0.566, 5, (123, 143, 73), 'Lake ambience.wav', audio=True)
-    clip(0.575, 0.944, 5, (126, 142, 74), 'Room tone.wav', audio=True)
-    playx = 0.472
-    line([(playx, 0.665), (playx, 0.946)], (250, 116, 89), 2)
-    d.polygon([(int((playx-0.007)*U), int(0.637*V)), (int((playx+0.007)*U), int(0.637*V)), (int(playx*U), int(0.654*V))], fill=(251, 121, 91))
-    box(0.963, 0.580, 0.994, 0.955, (35, 43, 51), (74, 84, 96))
-    text(0.968, 0.593, 'dB', size=0.012)
-    for k in range(22):
-        yp = 0.914-k*0.012
-        col = (100, 198, 117) if k < 15 else ((220, 192, 83) if k < 19 else (220, 102, 88))
-        for channel in range(2):
-            xx = 0.968+channel*0.010
-            box(xx, yp, xx+0.006, yp+0.008, col if k < 19-channel*2 else (63, 74, 75))
-    box(0, 0.966, 1, 1, (50, 57, 68))
-    text(0.015, 0.974, 'Ready   |   6 tracks   |   Sequence 01', (162, 179, 194), 0.013)
-    text(0.764, 0.974, 'Render: Preview   00:01:04:00', (154, 186, 199), 0.013)
-
-    # Screen-specific optical treatment: slight glare, edge shading, and sensor grain.
-    panel = np.array(canvas).astype(np.float32)
-    gy, gx = np.mgrid[0:V, 0:U].astype(np.float32)
-    gx /= max(1, U-1)
-    gy /= max(1, V-1)
-    glare = 0.032 + 0.047*np.exp(-(((gx-0.18)/0.76)**2+((gy-0.12)/0.90)**2))
-    panel = panel*(1-glare[..., None]) + np.array([218, 227, 242])*glare[..., None]
-    edge = np.minimum.reduce([gx, 1-gx, gy, 1-gy])
-    panel *= (0.95+0.05*np.clip(edge/0.023, 0, 1))[..., None]
-    panel += rng.normal(0, 0.65, panel.shape)
-    panel = cv2.GaussianBlur(np.clip(panel, 0, 255), (0, 0), 0.32)
-
-    # Measured relative coordinates lie inside the existing blue display border.
-    quad = np.float32([[0.0887*w, 0.2276*h], [0.3945*w, 0.0796*h], [0.4502*w, 0.3254*h], [0.1750*w, 0.5125*h]])
-    flat = np.float32([[0, 0], [U-1, 0], [U-1, V-1], [0, V-1]])
-    matrix = cv2.getPerspectiveTransform(flat, quad)
-    warped = cv2.warpPerspective(panel, matrix, (w, h), flags=cv2.INTER_LINEAR, borderMode=cv2.BORDER_REPLICATE)
-    coverage = cv2.warpPerspective(np.ones((V, U), np.float32), matrix, (w, h), flags=cv2.INTER_LINEAR, borderMode=cv2.BORDER_CONSTANT, borderValue=0)
-    hard = np.zeros((h, w), np.uint8)
-    cv2.fillConvexPoly(hard, np.round(quad).astype(np.int32), 255)
-    distance = cv2.distanceTransform(hard, cv2.DIST_L2, 5)
-    feather = max(0.85, w*0.00075)
-    alpha = np.clip(distance/feather, 0, 1)*np.clip(coverage, 0, 1)
-    alpha[hard == 0] = 0
-    # Transfer only weak low-frequency illumination; retain the interface's contrast.
-    source_luma = cv2.cvtColor(original, cv2.COLOR_RGB2GRAY).astype(np.float32)
-    soft_luma = cv2.GaussianBlur(source_luma, (0, 0), max(1, w*0.008))
-    valid = alpha > 0.99
-    if np.any(valid):
-        center_luma = np.median(soft_luma[valid])
-        illumination = np.clip((soft_luma-center_luma)*0.035, -3, 3)
-        warped += illumination[..., None]
-    result = original.astype(np.float32)*(1-alpha[..., None]) + np.clip(warped, 0, 255)*alpha[..., None]
-    out = np.clip(np.rint(result), 0, 255).astype(np.uint8)
-    out[alpha == 0] = original[alpha == 0]
+    base = np.asarray(image.convert('RGB'), dtype=np.float32) / 255.0
+    result = base.copy()
+    rng = np.random.default_rng(37)
+    ss = 3
+    resampling = Image.Resampling
+
+    def bezier(p0, p1, p2, p3, count=28):
+        t = np.linspace(0.0, 1.0, count)[:, None]
+        return (1-t)**3*np.array(p0) + 3*(1-t)**2*t*np.array(p1) + 3*(1-t)*t*t*np.array(p2) + t**3*np.array(p3)
+
+    def butterfly(span, color, kind, left_scale, right_scale, angle):
+        unit = span * ss * 0.5
+        n = max(96, int(np.ceil(span * ss * 1.4)))
+        yy, xx = np.mgrid[0:n, 0:n].astype(np.float32)
+        X = (xx + 0.5 - n/2) / unit
+        Y = (yy + 0.5 - n/2) / unit
+        premult = np.zeros((n, n, 3), np.float32)
+        coverage = np.zeros((n, n), np.float32)
+
+        def over(rgb, alpha):
+            nonlocal premult, coverage
+            alpha = np.clip(alpha, 0, 1).astype(np.float32)
+            premult = np.asarray(rgb, np.float32) * alpha[..., None] + premult * (1-alpha[..., None])
+            coverage = alpha + coverage*(1-alpha)
+
+        def xy(p, side=1, scale=1):
+            return (float(n/2 + p[0]*side*scale*unit), float(n/2 + p[1]*unit))
+
+        def draw_curve(draw, points, fill, width, side=1, scale=1):
+            pts = bezier(*points)
+            draw.line([xy(p, side, scale) for p in pts], fill=fill, width=max(1, int(round(width))))
+
+        fore_start = (0.06, -0.13)
+        fore_curves = [
+            ((0.13,-0.43),(0.43,-0.79),(0.71,-0.91)),
+            ((0.83,-0.95),(1.02,-0.83),(1.00,-0.68)),
+            ((1.01,-0.56),(1.02,-0.46),(0.94,-0.40)),
+            ((0.99,-0.30),(0.94,-0.21),(0.88,-0.20)),
+            ((0.92,-0.10),(0.87,-0.01),(0.81,0.015)),
+            ((0.82,0.11),(0.73,0.22),(0.64,0.23)),
+            ((0.48,0.34),(0.20,0.29),(0.055,0.11)),
+            ((0.07,0.03),(0.07,-0.05),(0.06,-0.13))
+        ]
+        hind_start = (0.055, 0.08)
+        hind_curves = [
+            ((0.27,0.05),(0.59,0.06),(0.69,0.19)),
+            ((0.81,0.27),(0.80,0.39),(0.73,0.42)),
+            ((0.80,0.51),(0.68,0.64),(0.61,0.64)),
+            ((0.61,0.74),(0.47,0.82),(0.40,0.77)),
+            ((0.33,0.86),(0.19,0.83),(0.15,0.72)),
+            ((0.04,0.65),(0.035,0.30),(0.055,0.08))
+        ]
+        texture = rng.normal(0, 1, (n, n)).astype(np.float32)
+        soft_texture = cv2.GaussianBlur(texture, (0, 0), 1.4)
+        dark = np.array([0.075, 0.055, 0.042], np.float32)
+        if kind in ('blue', 'violet'):
+            dark = np.array([0.035, 0.045, 0.070], np.float32)
+
+        for hind in (True, False):
+            for side, scale in ((-1, left_scale), (1, right_scale)):
+                start = hind_start if hind else fore_start
+                curves = hind_curves if hind else fore_curves
+                points = []
+                p = start
+                for c1, c2, end in curves:
+                    points.extend(bezier(p, c1, c2, end).tolist())
+                    p = end
+                mask_image = Image.new('L', (n,n), 0)
+                md = ImageDraw.Draw(mask_image)
+                md.polygon([xy(p, side, scale) for p in points], fill=255)
+                mask = np.asarray(mask_image, np.float32)/255.0
+                distance = cv2.distanceTransform((mask > 0.5).astype(np.uint8), cv2.DIST_L2, 5)
+                local_x = X * side / scale
+                radial = np.sqrt((local_x-0.07)**2 + (Y+0.03)**2)
+                ridge = np.exp(-((local_x-0.49 + 0.12*Y)/0.31)**2)
+                light = 0.70 + 0.19*ridge + 0.08*np.clip(-Y, -0.5, 0.8)
+                light -= 0.15*np.exp(-(radial/0.23)**2)
+                light += 0.021*texture + 0.055*soft_texture
+                light += 0.018*np.sin(68*radial + 8*Y)
+                if hind:
+                    light *= 0.89
+                if side == 1:
+                    light *= 0.95
+                wing_rgb = np.asarray(color, np.float32)[None,None,:]*light[...,None]
+                if kind == 'blue':
+                    iridescence = np.exp(-((local_x-0.53+0.23*Y)/0.28)**2)
+                    wing_rgb[:,:,1] += 0.15*iridescence
+                    wing_rgb[:,:,2] += 0.05*iridescence
+                elif kind == 'violet':
+                    iridescence = np.exp(-((local_x-0.48)/0.31)**2)
+                    wing_rgb[:,:,2] += 0.13*iridescence
+                    wing_rgb[:,:,0] += 0.06*np.sin(radial*5.0)
+                elif kind == 'gold':
+                    stripe = np.exp(-((local_x + 0.16*Y-0.72)/0.045)**2)
+                    stripe += 0.55*np.exp(-((local_x + 0.22*Y-0.43)/0.035)**2)
+                    wing_rgb *= (1-0.55*np.clip(stripe,0,1))[...,None]
+                border_width = unit*(0.067 if kind in ('blue','violet') else 0.052)
+                border_width *= 0.90 + 0.20*np.clip(radial,0,1)
+                border = np.clip((border_width-distance)/(unit*0.027), 0, 1)
+                dark_rgb = dark[None,None,:]*(0.90+0.07*texture[...,None])
+                wing_rgb = wing_rgb*(1-border[...,None]) + dark_rgb*border[...,None]
+
+                vein_image = Image.new('L', (n,n), 0)
+                vd = ImageDraw.Draw(vein_image)
+                if hind:
+                    root = (0.06,0.12)
+                    ends = [(0.69,0.28),(0.72,0.43),(0.62,0.62),(0.42,0.76),(0.20,0.70)]
+                else:
+                    root = (0.07,-0.13)
+                    ends = [(0.70,-0.86),(0.97,-0.63),(0.93,-0.40),(0.88,-0.20),(0.78,0.05),(0.59,0.24)]
+                for j, end in enumerate(ends):
+                    if hind:
+                        c1 = (0.20,0.16)
+                        c2 = (end[0]*0.78,end[1]*0.73)
+                    else:
+                        c1 = (0.21,-0.24+0.022*j)
+                        c2 = (end[0]*0.72,end[1]*0.72-0.045)
+                    draw_curve(vd, (root,c1,c2,end), 235, unit*0.014, side, scale)
+                    if not hind and j in (1,2,3):
+                        branch_start = (0.43,-0.21+0.045*j)
+                        branch_end = (end[0]*0.88,end[1]-0.08)
+                        draw_curve(vd, (branch_start,(0.53,branch_start[1]-0.035),(branch_end[0]*0.9,branch_end[1]+0.035),branch_end), 135, unit*0.007, side, scale)
+                vein = np.asarray(vein_image,np.float32)/255.0
+                vein = cv2.GaussianBlur(vein,(0,0),0.35)
+                strength = 0.49 if kind in ('blue','violet') else 0.73
+                wing_rgb = wing_rgb*(1-strength*vein[...,None]) + dark[None,None,:]*(strength*vein[...,None])
+
+                spots_image = Image.new('L',(n,n),0)
+                sd = ImageDraw.Draw(spots_image)
+                if hind:
+                    spot_positions = [(0.72,0.34),(0.66,0.51),(0.54,0.68),(0.38,0.74),(0.23,0.73)]
+                else:
+                    spot_positions = [(0.71,-0.86),(0.87,-0.75),(0.95,-0.59),(0.91,-0.36),(0.85,-0.17),(0.75,0.055),(0.62,0.20)]
+                for j, p in enumerate(spot_positions):
+                    if kind == 'blue' and j % 2:
+                        continue
+                    px,py = xy(p,side,scale)
+                    r = unit*(0.020 if kind in ('orange','coral','gold') else 0.014)
+                    sd.ellipse((px-r,py-r*0.73,px+r,py+r*0.73),fill=220)
+                spots = cv2.GaussianBlur(np.asarray(spots_image,np.float32)/255.0,(0,0),0.45)*mask
+                spot_color = np.array([0.93,0.87,0.67],np.float32)
+                if kind in ('blue','violet'):
+                    spot_color = np.array([0.69,0.81,0.91],np.float32)
+                wing_rgb = wing_rgb*(1-spots[...,None]) + spot_color*spots[...,None]
+                alpha = cv2.GaussianBlur(mask,(0,0),0.42)
+                over(np.clip(wing_rgb,0,1),alpha)
+
+        appendages_image = Image.new('L',(n,n),0)
+        ad = ImageDraw.Draw(appendages_image)
+        for side in (-1,1):
+            draw_curve(ad, ((0.02,-0.30),(0.045,-0.43),(0.13,-0.51),(0.17,-0.65)), 240, unit*0.010, side)
+            px,py = xy((0.17,-0.65),side)
+            r = unit*0.014
+            ad.ellipse((px-r,py-r*1.6,px+r,py+r*1.6),fill=255)
+            for j in range(3):
+                start = (0.045,-0.11+0.075*j)
+                end = (0.16+0.024*j,0.10+0.095*j)
+                draw_curve(ad,(start,(0.11,start[1]+0.045),(end[0]-0.02,end[1]-0.03),end),175,unit*0.009,side)
+        appendages = cv2.GaussianBlur(np.asarray(appendages_image,np.float32)/255.0,(0,0),0.35)
+        over(np.array([0.12,0.105,0.085],np.float32),appendages)
+
+        def body_ellipse(cx,cy,rx,ry,tint):
+            dx = (X-cx)/rx
+            dy = (Y-cy)/ry
+            q = dx*dx+dy*dy
+            a = np.clip((1-q)*unit*min(rx,ry)+0.55,0,1)
+            surface = np.sqrt(np.clip(1-q,0,1))
+            illumination = 0.44+0.42*surface-0.13*dx
+            illumination += 0.035*texture
+            rgb = np.asarray(tint,np.float32)[None,None,:]*illumination[...,None]
+            rgb += 0.085*np.exp(-((dx+0.4)/0.27)**2)[...,None]*surface[...,None]
+            over(np.clip(rgb,0,1),a)
+
+        body_ellipse(0,0.20,0.039,0.23,[0.25,0.22,0.17])
+        body_ellipse(0,-0.095,0.060,0.13,[0.22,0.20,0.17])
+        body_ellipse(0,-0.275,0.039,0.046,[0.18,0.16,0.13])
+        segment_image = Image.new('L',(n,n),0)
+        segdraw = ImageDraw.Draw(segment_image)
+        for sy in (0.07,0.14,0.21,0.28,0.35):
+            rx = 0.033*np.sqrt(max(0.15,1-((sy-0.20)/0.23)**2))
+            segdraw.line([xy((-rx,sy)),xy((rx,sy+0.009))],fill=110,width=max(1,int(unit*0.008)))
+        segment_alpha = np.asarray(segment_image,np.float32)/255.0
+        over(np.array([0.055,0.048,0.037],np.float32),segment_alpha)
+
+        rgb = premult/np.maximum(coverage[...,None],1e-6)
+        rgba = np.dstack((np.clip(rgb,0,1),np.clip(coverage,0,1)))
+        layer = Image.fromarray(np.round(rgba*255).astype(np.uint8),'RGBA')
+        layer = layer.rotate(angle,resample=resampling.BICUBIC,expand=True)
+        target_size = (max(1,int(round(layer.width/ss))),max(1,int(round(layer.height/ss))))
+        layer = layer.resize(target_size,resampling.LANCZOS)
+        return np.asarray(layer,np.float32)/255.0
+
+    placements = [
+        (0.130,0.630,0.103,[0.98,0.47,0.075],'orange',0.87,1.00,24,0.0),
+        (0.390,0.530,0.098,[0.97,0.80,0.20],'gold',1.00,0.83,-24,0.0),
+        (0.615,0.708,0.122,[0.12,0.60,0.97],'blue',1.00,0.91,-18,0.10),
+        (0.535,0.905,0.101,[0.64,0.28,0.88],'violet',0.86,1.00,30,0.15),
+        (0.112,0.865,0.086,[0.97,0.32,0.22],'coral',1.00,0.88,-32,0.13)
+    ]
+    scale = min(w,h)
+    for px,py,size,color,kind,ls,rs,angle,shadow_opacity in placements:
+        sprite = butterfly(scale*size,color,kind,ls,rs,angle)
+        sh,sw = sprite.shape[:2]
+        x0 = int(round(px*w-sw/2))
+        y0 = int(round(py*h-sh/2))
+        xa,ya = max(0,x0),max(0,y0)
+        xb,yb = min(w,x0+sw),min(h,y0+sh)
+        if xb <= xa or yb <= ya:
+            continue
+        cut = sprite[ya-y0:yb-y0,xa-x0:xb-x0]
+        a = cut[:,:,3]
+        if shadow_opacity > 0:
+            silhouette = np.zeros((h,w),np.float32)
+            silhouette[ya:yb,xa:xb] = a
+            shift_x = scale*0.012
+            shift_y = scale*(0.031 if py<0.8 else 0.017)
+            transform = np.array([[1,0,shift_x],[0,1,shift_y]],np.float32)
+            shadow = cv2.warpAffine(silhouette,transform,(w,h),flags=cv2.INTER_LINEAR,borderMode=cv2.BORDER_CONSTANT)
+            shadow = cv2.GaussianBlur(shadow,(0,0),max(0.8,scale*0.008))
+            result *= (1-shadow_opacity*shadow[...,None])
+        result[ya:yb,xa:xb] = cut[:,:,:3]*a[...,None] + result[ya:yb,xa:xb]*(1-a[...,None])
+
+    output = Image.fromarray(np.round(np.clip(result,0,1)*255).astype(np.uint8),'RGB')
     if image.mode == 'RGBA':
-        return Image.fromarray(np.dstack([out, np.array(image.getchannel('A'))]), 'RGBA')
-    return Image.fromarray(out, 'RGB')

质量筛选后的候选:Remove the yellow paddle held by the surfer on the right, seamlessly filling the area with the surrounding ocean wave, water foam, and surfer details where needed. Keep both surfers, surfboards, ocean, waves, lighting, colors, perspective, and all other elements unchanged.

maskedit_scene · GPT-6.1-Sol · RFT · 自建图像judge通过 · 画质4/5 · 保留5/5

原图
单次 teacher 代码执行
数据集目标
完整 teacher 计划与代码
{
+        output = output.convert('RGBA')
+        output.putalpha(image.getchannel('A'))
+    return output

质量筛选后的候选:Remove the rising sun from the top-center of the image, seamlessly blending the surrounding warm sunrise sky and atmospheric haze to maintain a natural savanna sunrise appearance. Preserve all zebras, acacia trees, tall golden grass, lighting, shadows, colors, composition, and the realistic photographic style completely unchanged.

maskedit_scene · GPT-6.1-Sol · RFT · 自建图像judge通过 · 画质5/5 · 保留5/5

原图
单次 teacher 代码执行
数据集目标
完整 teacher 计划与代码
{
   "visual_evidence": [
-    "Two surfers in dark wetsuits are riding separate boards on a breaking ocean wave.",
-    "The surfer on the right holds a dark paddle shaft across his hands and torso.",
-    "The paddle has a bright yellow blade extending leftward over the green wave.",
-    "Blue water, green wave faces, and white foam surround the paddle."
+    "A small, bright white sun disk appears in the upper sky, slightly left of center.",
+    "Warm yellow-orange sky and atmospheric haze surround the sun.",
+    "Acacia silhouettes line the distant horizon below the sun.",
+    "Zebras and tall golden grass occupy the middle ground and foreground."
   ],
-  "target_object": "The entire paddle held by the right surfer, including its yellow blade, dark shaft, and end grip.",
-  "target_region": "The diagonal paddle running from the yellow blade near the image center to the grip beside the right surfer's upper body.",
-  "editing_intent": "Remove the paddle and reconstruct the exposed wave, foam, and small obscured wetsuit areas while preserving both surfers and everything else.",
+  "target_object": "The visible rising sun disk",
+  "target_region": "A small circular sky region centered near 39.1% of image width and 9.7% of image height",
+  "editing_intent": "Remove the sun disk and its immediate white rim, replacing them with continuous warm sky while retaining the surrounding sunrise illumination.",
   "editing_plan": [
-    "Create separate, closely fitted masks for the yellow blade, diagonal shaft, and end grip using relative coordinates.",
-    "Protect the visible hands and the adjacent left surfer from the removal mask.",
-    "Inpaint the narrow shaft and grip using surrounding water, foam, and wetsuit pixels.",
-    "Find a clean ocean patch in the source image whose boundary colors and texture match the blade region.",
-    "Use the selected ocean texture to replace the blade, blending it with Poisson cloning.",
-    "Restore fine local texture along the removed shaft and feather the edit strictly inside the removal mask."
+    "Create a tightly localized circular mask around the sun with a feathered outer boundary.",
+    "Inpaint the masked disk using surrounding sky pixels.",
+    "Fit a robust smooth color gradient to nearby unobstructed sky to reconstruct natural sunrise shading.",
+    "Restore fine texture using a nearby sky patch and a small amount of the inpainted residual.",
+    "Blend only inside the mask and preserve every pixel outside it."
   ],
   "preservation_constraints": [
-    "Keep both surfers, their visible hands, faces, clothing, and poses unchanged.",
-    "Keep both surfboards and their visible details unchanged.",
-    "Preserve the ocean, foam, wave shapes, and lighting outside the paddle mask.",
-    "Preserve the original image dimensions, perspective, and overall colors.",
-    "Do not introduce any new objects."
+    "Preserve every zebra, including stripes, poses, and outlines.",
+    "Preserve all acacia trees and distant vegetation.",
+    "Preserve the tall golden grass and atmospheric haze.",
+    "Keep lighting, shadows, surrounding colors, composition, and photographic style unchanged.",
+    "Do not alter pixels outside the small feathered sun-removal region."
   ]
 }
 
@@ -293,418 +290,155 @@ def edit(image):
 
     w, h = image.size
     original = np.asarray(image.convert('RGB')).copy()
-    scale = max(0.5, min(w, h) * 0.001)
-
-    def points(coords):
-        return np.array([(int(round(x * w)), int(round(y * h))) for x, y in coords], dtype=np.int32)
-
-    def polygon(coords):
-        out = np.zeros((h, w), dtype=np.uint8)
-        cv2.fillPoly(out, [points(coords)], 255)
-        return out
-
-    def kernel(radius):
-        r = max(1, int(round(radius)))
-        return cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * r + 1, 2 * r + 1))
-
-    blade = polygon([
-        (0.4248, 0.3770), (0.4293, 0.3672), (0.4384, 0.3613),
-        (0.4515, 0.3574), (0.4678, 0.3584), (0.4814, 0.3623),
-        (0.4906, 0.3662), (0.4958, 0.3701), (0.4938, 0.3770),
-        (0.4860, 0.3887), (0.4762, 0.4023), (0.4645, 0.4131),
-        (0.4541, 0.4180), (0.4423, 0.4199), (0.4326, 0.4170),
-        (0.4280, 0.4102), (0.4254, 0.4004), (0.4241, 0.3887)
-    ])
-    blade = cv2.dilate(blade, kernel(2.0 * scale))
-
-    shaft = np.zeros((h, w), dtype=np.uint8)
-    cv2.line(shaft, tuple(points([(0.4910, 0.3710)])[0]),
-             tuple(points([(0.7244, 0.3018)])[0]), 255,
-             max(3, int(round(0.0073 * w))), cv2.LINE_8)
-    cv2.ellipse(shaft, tuple(points([(0.7244, 0.3018)])[0]),
-                (max(2, int(round(0.0043 * w))), max(3, int(round(0.0118 * h)))),
-                -12, 0, 360, 255, -1)
-
-    left_person = polygon([
-        (0.349, 0.233), (0.360, 0.208), (0.385, 0.205),
-        (0.394, 0.227), (0.393, 0.263), (0.407, 0.285),
-        (0.415, 0.321), (0.4173, 0.366), (0.4230, 0.391),
-        (0.4226, 0.418), (0.414, 0.472), (0.405, 0.489),
-        (0.414, 0.518), (0.437, 0.562), (0.450, 0.601),
-        (0.412, 0.608), (0.409, 0.576), (0.383, 0.531),
-        (0.373, 0.502), (0.374, 0.463), (0.374, 0.436),
-        (0.363, 0.461), (0.350, 0.468), (0.344, 0.455),
-        (0.349, 0.440), (0.359, 0.411), (0.363, 0.363),
-        (0.362, 0.315), (0.363, 0.293), (0.351, 0.277)
-    ])
-
-    hand_regions = polygon([
-        (0.571, 0.341), (0.575, 0.328), (0.585, 0.324),
-        (0.594, 0.334), (0.596, 0.345), (0.591, 0.358),
-        (0.580, 0.357), (0.573, 0.349)
-    ])
-    hand_regions |= polygon([
-        (0.683, 0.303), (0.687, 0.298), (0.695, 0.296),
-        (0.704, 0.303), (0.708, 0.316), (0.704, 0.325),
-        (0.694, 0.326), (0.686, 0.319)
-    ])
-    colors = original.astype(np.float32)
-    r, g, b = colors[:, :, 0], colors[:, :, 1], colors[:, :, 2]
-    skin = ((r > g + 4) & (r > b + 9) & (g > b + 2) & (r > 32))
-    hands = ((hand_regions > 0) & skin).astype(np.uint8) * 255
-    hands = cv2.morphologyEx(hands, cv2.MORPH_CLOSE, kernel(scale))
-    hands = cv2.dilate(hands, kernel(scale))
-    hands[hand_regions == 0] = 0
-
-    blade[left_person > 0] = 0
-    mask = cv2.bitwise_or(blade, shaft)
-    mask[(hands > 0) | (left_person > 0)] = 0
-    blade[mask == 0] = 0
-
-    # Narrow holes are filled from their immediate water and clothing boundaries.
-    result = cv2.inpaint(original, mask, max(2.0, 4.0 * scale), cv2.INPAINT_TELEA)
-
-    # Exclude all people, boards, and the paddle from ocean texture donors.
-    forbidden = cv2.dilate(cv2.bitwise_or(mask, left_person), kernel(5.0 * scale))
-    right_person = polygon([
-        (0.572, 0.173), (0.731, 0.173),
-        (0.731, 0.591), (0.572, 0.591)
-    ])
-    boards = polygon([
-        (0.310, 0.532), (0.776, 0.532),
-        (0.776, 0.670), (0.310, 0.670)
-    ])
-    forbidden |= right_person
-    forbidden |= boards
-    integral = cv2.integral((forbidden > 0).astype(np.uint8))
-
-    ys, xs = np.nonzero(blade)
-    if len(xs):
-        padding = max(4, int(round(8.0 * scale)))
-        x0, x1 = max(0, int(xs.min()) - padding), min(w, int(xs.max()) + padding + 1)
-        y0, y1 = max(0, int(ys.min()) - padding), min(h, int(ys.max()) + padding + 1)
-        bw, bh = x1 - x0, y1 - y0
-        patch_mask = blade[y0:y1, x0:x1].copy()
-
-        outer = cv2.dilate(blade, kernel(7.0 * scale))
-        exclusion = cv2.dilate(mask, kernel(1.0 * scale))
-        ring = (outer > 0) & (blade == 0) & (exclusion == 0)
-        ring &= (left_person == 0) & (right_person == 0)
-        ring = ring[y0:y1, x0:x1]
-        if np.count_nonzero(ring) < 8:
-            ring = (cv2.dilate(patch_mask, kernel(3.0 * scale)) > 0) & (patch_mask == 0)
-
-        smooth = cv2.GaussianBlur(colors, (0, 0), max(0.6, 2.5 * scale))
-        texture_energy = np.mean(np.abs(colors - smooth), axis=2)
-        target_values = smooth[y0:y1, x0:x1][ring]
-        target_energy = float(np.mean(texture_energy[y0:y1, x0:x1][ring]))
-
-        def donor_score(dx, dy):
-            if dx < 0 or dy < 0 or dx + bw > w or dy + bh > h:
-                return None
-            count = (integral[dy + bh, dx + bw] - integral[dy, dx + bw]
-                     - integral[dy + bh, dx] + integral[dy, dx])
-            if count:
-                return None
-            donor_values = smooth[dy:dy + bh, dx:dx + bw][ring]
-            difference = target_values - donor_values
-            offset = np.clip(np.mean(difference, axis=0), -25.0, 25.0)
-            error = float(np.mean((difference - offset) ** 2))
-            error += 0.12 * float(np.mean(offset ** 2))
-            energy = float(np.mean(texture_energy[dy:dy + bh, dx:dx + bw][ring]))
-            error += 0.35 * (energy - target_energy) ** 2
-            return error, offset
-
-        step_x = max(2, int(round(0.005 * w)))
-        step_y = max(2, int(round(0.004 * h)))
-        best = None
-        for dy in range(int(0.342 * h), min(int(0.490 * h), h - bh) + 1, step_y):
-            for dx in range(int(0.180 * w), min(int(0.560 * w), w - bw) + 1, step_x):
-                score = donor_score(dx, dy)
-                if score is not None and (best is None or score[0] < best[0]):
-                    best = (score[0], dx, dy, score[1])
-
-        if best is not None:
-            _, coarse_x, coarse_y, _ = best
-            refinement = max(1, int(round(1.5 * scale)))
-            for dy in range(max(0, coarse_y - step_y), min(h - bh, coarse_y + step_y) + 1, refinement):
-                for dx in range(max(0, coarse_x - step_x), min(w - bw, coarse_x + step_x) + 1, refinement):
-                    score = donor_score(dx, dy)
-                    if score is not None and score[0] < best[0]:
-                        best = (score[0], dx, dy, score[1])
-            _, donor_x, donor_y, offset = best
-        else:
-            donor_x = min(max(0, int(0.260 * w)), w - bw)
-            donor_y = min(max(0, int(0.400 * h)), h - bh)
-            donor_values = smooth[donor_y:donor_y + bh, donor_x:donor_x + bw][ring]
-            offset = np.clip(np.mean(target_values - donor_values, axis=0), -25.0, 25.0)
-
-        donor = original[donor_y:donor_y + bh, donor_x:donor_x + bw].astype(np.float32)
-        donor = np.clip(donor + offset[None, None, :], 0, 255).astype(np.uint8)
-        center = (x0 + bw // 2, y0 + bh // 2)
-        result = cv2.seamlessClone(donor, result, patch_mask, center, cv2.NORMAL_CLONE)
-
-    # Retain authentic fine texture in the narrow reconstructed areas.
-    fine = colors - cv2.GaussianBlur(colors, (0, 0), max(0.5, 0.9 * scale))
-    displacement = max(3, int(round(12.0 * scale)))
-    below_color = np.roll(smooth if len(xs) else colors, -displacement, axis=0)
-    above_color = np.roll(smooth if len(xs) else colors, displacement, axis=0)
-    current = result.astype(np.float32)
-    use_below = np.sum((below_color - current) ** 2, axis=2) < np.sum((above_color - current) ** 2, axis=2)
-    below_detail = np.roll(fine, -displacement, axis=0)
-    above_detail = np.roll(fine, displacement, axis=0)
-    detail = np.where(use_below[:, :, None], below_detail, above_detail)
-    narrow = (mask > 0) & (blade == 0)
-    textured = np.clip(current + 0.55 * np.clip(detail, -8.0, 8.0), 0, 255)
-    current[narrow] = textured[narrow]
-
-    # No pixel outside the tightly bounded removal mask is changed.
-    distance = cv2.distanceTransform((mask > 0).astype(np.uint8), cv2.DIST_L2, 3)
-    alpha = np.clip(distance / max(1.0, 1.5 * scale), 0.0, 1.0)[:, :, None]
-    final = np.clip(colors * (1.0 - alpha) + current * alpha, 0, 255).astype(np.uint8)
-    final[mask == 0] = original[mask == 0]
-    return Image.fromarray(final, 'RGB')

质量筛选后的候选:Change the background to a mystical forest with glowing orbs floating around the bench

ultraedit · GPT-6.1-Sol · RFT · 自建图像judge通过 · 画质4/5 · 保留4/5

原图
单次 teacher 代码执行
数据集目标
完整 teacher 计划与代码
{
+    cx, cy = 0.3906 * w, 0.0967 * h
+    rx, ry = 0.0193 * w, 0.0258 * h
+
+    # Work locally; this region contains sky, not foreground subjects.
+    x0 = max(0, int(np.floor(cx - 2.15 * rx)))
+    x1 = min(w, int(np.ceil(cx + 2.15 * rx)) + 1)
+    y0 = max(0, int(np.floor(cy - 2.15 * ry)))
+    y1 = min(h, int(np.ceil(cy + 2.15 * ry)) + 1)
+    patch = original[y0:y1, x0:x1].copy()
+    yy, xx = np.mgrid[y0:y1, x0:x1].astype(np.float64)
+    u = (xx - cx) / rx
+    v = (yy - cy) / ry
+    distance = np.sqrt(u * u + v * v)
+    removal = (distance < 1.0).astype(np.uint8) * 255
+
+    filled = cv2.inpaint(patch, removal, max(2.0, 0.14 * min(rx, ry)), cv2.INPAINT_TELEA).astype(np.float64)
+
+    # Exclude the sun, distant silhouettes, and the horizon from shading samples.
+    samples = (distance > 1.08) & (distance < 1.90) & (yy < 0.115 * h)
+    terms = np.stack([np.ones_like(u), u, v, u * u, u * v, v * v], axis=-1)
+    design = terms[samples]
+    values = patch.astype(np.float64)[samples]
+    weights = np.ones(len(values), dtype=np.float64)
+    coefficients = None
+    for _ in range(5):
+        root_weights = np.sqrt(weights)[:, None]
+        coefficients = np.linalg.lstsq(design * root_weights, values * root_weights, rcond=None)[0]
+        errors = np.sqrt(np.mean((values - design @ coefficients) ** 2, axis=1))
+        scale = max(0.5, 1.4826 * np.median(np.abs(errors - np.median(errors))))
+        weights = np.minimum(1.0, (2.5 * scale) / np.maximum(errors, 1e-6))
+    shading = terms @ coefficients
+
+    # Borrow only fine sky texture, not the donor patch's different brightness.
+    sigma = max(0.65, 0.0009 * w)
+    source_float = original.astype(np.float32)
+    fine_texture = source_float - cv2.GaussianBlur(source_float, (0, 0), sigmaX=sigma, sigmaY=sigma)
+    shift = max(1, int(round(0.056 * w)))
+    donor_x = np.clip(xx.astype(np.int32) - shift, 0, w - 1)
+    donor_y = np.clip(yy.astype(np.int32), 0, h - 1)
+    texture = np.clip(fine_texture[donor_y, donor_x], -1.5, 1.5)
+    smooth_fill = cv2.GaussianBlur(filled.astype(np.float32), (0, 0), sigmaX=max(1.0, 0.12 * rx), sigmaY=max(1.0, 0.12 * ry))
+    inpaint_detail = np.clip(filled - smooth_fill, -1.0, 1.0)
+    replacement = np.clip(shading + 0.85 * texture + 0.15 * inpaint_detail, 0, 255)
+
+    # Full replacement covers the disk and white rim; only the edge feathers.
+    transition = np.clip((1.0 - distance) / 0.25, 0.0, 1.0)
+    alpha = transition * transition * (3.0 - 2.0 * transition)
+    blended = np.rint(patch.astype(np.float64) * (1.0 - alpha[..., None]) + replacement * alpha[..., None]).astype(np.uint8)
+    result = original.copy()
+    local_result = result[y0:y1, x0:x1]
+    affected = alpha > 0
+    local_result[affected] = blended[affected]
+    output = Image.fromarray(result, 'RGB')
+    if image.mode == 'RGBA':
+        output = output.convert('RGBA')
+        output.putalpha(image.getchannel('A'))
+    return output
+

质量筛选后的候选:Remove the street sign located on the left side of the image, seamlessly filling its space with the surrounding background (including the road, parked cars, and nearby trees), while keeping all other elements, including the bus, buildings, trees, lighting, and reflections, completely unchanged.

maskedit_scene · GPT-6.1-Sol · RFT · 自建图像judge通过 · 画质4/5 · 保留5/5

原图
单次 teacher 代码执行
数据集目标
完整 teacher 计划与代码
{
   "visual_evidence": [
-    "Two dark birds are perched on the left side of a weathered wooden bench.",
-    "The background contains a pale sky, distant land, and shoreline scenery.",
-    "The bench has a broad wooden backrest, a lower seat, and visible supports.",
-    "Grass and small plants occupy the lower foreground."
+    "A small rectangular sign with a red cross and blue border stands near the left edge.",
+    "Its narrow metal pole extends downward in front of parked vehicles and roadside rubble.",
+    "Dark building texture is visible beside the sign, and a large blue-and-white bus occupies most of the image."
   ],
-  "target_object": "The scenery behind the bench",
-  "target_region": "The sky and distant landscape above the backrest, plus the background visible through the bench openings",
-  "editing_intent": "Replace the existing background with a misty, mystical forest and luminous floating orbs while retaining the bench, birds, and foreground grass.",
+  "target_object": "The left-side street sign, including its supporting pole.",
+  "target_region": "The narrow area near the left edge, approximately 0–3.5% of image width and 39.5–69% of image height.",
+  "editing_intent": "Remove the sign and pole, reconstructing the obscured background using neighboring image pixels.",
   "editing_plan": [
-    "Mask the wooden bench and its supports using their visible outlines, and isolate the birds using local brightness segmentation.",
-    "Preserve the lower foreground and feather the foreground boundaries.",
-    "Synthesize a layered forest with irregular trunks, textured bark, foliage, mossy ground, atmospheric mist, and soft light shafts.",
-    "Create floating orbs with shaded cores, highlights, and broad colored bloom behind the preserved foreground.",
-    "Composite the forest through the background mask and match the synthetic scenery with fine image grain."
+    "Create separate, tightly localized masks for the sign face and its pole.",
+    "Inpaint the masked areas to reconstruct background continuity, especially across parked vehicles and rubble.",
+    "Replace the broad sign-face fill with textured building pixels sampled immediately to its right and blend them with seamless cloning.",
+    "Restore subtle texture in the narrow pole fill and feather the edit boundaries.",
+    "Copy original pixels everywhere outside the removal mask."
   ],
   "preservation_constraints": [
-    "Keep both birds in their original positions and preserve their silhouettes.",
-    "Preserve the bench's wooden texture, shape, seat, and supports.",
-    "Retain the lower foreground grass and plants.",
-    "Keep the original image dimensions and framing."
+    "Keep the bus, its lettering, windows, reflections, and wheels unchanged.",
+    "Preserve all visible buildings, trees, parked vehicles, road markings, rubble, and curb outside the removal mask.",
+    "Do not change the image dimensions, framing, overall lighting, or color balance."
   ]
 }
 
 def edit(image):
-    import numpy as np
     import cv2
+    import numpy as np
     from PIL import Image
 
-    image = image.convert('RGB')
     w, h = image.size
-    src = np.asarray(image).astype(np.float32)
-    rng = np.random.default_rng(7419)
-    yy, xx = np.mgrid[0:h, 0:w].astype(np.float32)
-    X, Y = xx / max(w - 1, 1), yy / max(h - 1, 1)
-    scale = min(w, h)
-
-    def noise(nx, ny):
-        a = rng.random((max(2, ny), max(2, nx))).astype(np.float32)
-        return cv2.resize(a, (w, h), interpolation=cv2.INTER_CUBIC)
-
-    broad = noise(7, 8)
-    medium = noise(27, 30)
-    detail = noise(100, 110)
-    fine = rng.normal(0, 1, (h, w)).astype(np.float32)
-    texture = .49 * broad + .31 * medium + .20 * detail
-
-    # Foreground geometry follows the visible bench, rather than a rectangle.
-    keep = np.zeros((h, w), np.uint8)
-    def polygon(points):
-        p = np.array([(round(a * (w - 1)), round(b * (h - 1))) for a, b in points], np.int32)
-        cv2.fillPoly(keep, [p], 255)
-
-    polygon([(0,.426),(.115,.438),(.24,.433),(.36,.424),(.52,.418),(.72,.414),(.88,.415),(1,.417),
-             (1,.613),(.90,.629),(.75,.641),(.58,.650),(.39,.662),(.19,.676),(0,.682)])
-    polygon([(0,.748),(.18,.731),(.39,.703),(.60,.684),(.80,.662),(1,.639),
-             (1,.782),(.79,.803),(.57,.824),(.32,.845),(0,.865)])
-    polygon([(.069,.674),(.102,.674),(.101,.725),(.078,.733)])
-    polygon([(.326,.659),(.355,.657),(.354,.707),(.328,.709)])
-    polygon([(.679,.634),(.708,.632),(.707,.674),(.681,.677)])
-    polygon([(.921,.620),(.950,.617),(.945,.654),(.918,.657)])
-    # Everything beneath the seat remains the original foreground.
-    polygon([(0,.861),(.30,.843),(.58,.823),(.80,.801),(1,.783),(1,1),(0,1)])
-
-    lum = .299 * src[:,:,0] + .587 * src[:,:,1] + .114 * src[:,:,2]
-    bird_roi = np.zeros((h,w), np.uint8)
-    for x0,y0,x1,y1 in [(0,.263,.132,.448),(.145,.318,.323,.443)]:
-        bird_roi[int(y0*h):min(h,int(y1*h)+1), int(x0*w):min(w,int(x1*w)+1)] = 255
-    dark = ((lum < 103) & (bird_roi > 0)).astype(np.uint8)
-    count, labels, stats, _ = cv2.connectedComponentsWithStats(dark, 8)
-    birds = np.zeros((h,w), np.uint8)
-    for label in range(1,count):
-        if stats[label,cv2.CC_STAT_AREA] >= max(3, int(w*h*.000025)):
-            birds[labels == label] = 255
-    radius = max(1, int(round(scale*.002)))
-    kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(2*radius+1,2*radius+1))
-    extension = cv2.dilate(birds,kernel)
-    birds = np.maximum(birds, ((extension>0)&(lum<177)&(bird_roi>0)).astype(np.uint8)*255)
-    keep = np.maximum(keep,birds)
-    alpha = cv2.GaussianBlur(keep.astype(np.float32)/255,(0,0),max(.45,scale*.0011))
-
-    # Cool, naturally uneven atmospheric background.
-    clearing = np.exp(-((X-.57)/.37)**2-((Y-.35)/.45)**2)
-    mist = np.exp(-((Y-.47)/.18)**2) * (.58 + .42*broad)
-    forest = np.empty((h,w,3),np.float32)
-    forest[:,:,0] = 17 + 32*clearing + 18*mist + 13*texture
-    forest[:,:,1] = 35 + 47*clearing + 21*mist + 22*texture
-    forest[:,:,2] = 36 + 47*clearing + 28*mist + 17*texture
-
-    # Distant trunks, then progressively darker and more detailed near trees.
-    for depth, number in [(0,19),(1,13),(2,8)]:
-        for j in range(number):
-            xbase = rng.uniform(-.07,1.07)
-            if depth == 2 and .39 < xbase < .70:
-                xbase += .22 if xbase > .54 else -.23
-            root = rng.uniform(.57,.85)
-            half = rng.uniform(.004,.013) * (1 + depth*.85)
-            lean = rng.uniform(-.075,.075)
-            phase = rng.uniform(0,6.28)
-            center = xbase + lean*(root-Y) + .007*np.sin(Y*8+phase)
-            width = half*(.42+.66*np.clip(Y/root,0,1))
-            width += half*.32*np.exp(-((Y-root)/.047)**2)
-            signed = (np.abs(X-center)-width)*w
-            trunk_mask = np.clip(.7-signed,0,1)
-            trunk_mask *= np.clip((root-Y)*h+1,0,1)
-            t = (X-center)/(width+1e-5)
-            ridges = np.sin((t*7+medium*1.6+Y*5)*3.3)
-            narrow = np.sin(t*44+detail*4+Y*18)
-            bark = 4.0*ridges + 2.1*narrow + 7*(medium-.5) + 2*fine
-            side = 7*np.exp(-((t+.43)/.38)**2)-5*np.clip(t,0,1)
-            if depth == 0:
-                base = np.array([51,76,76],np.float32)
-                opacity = .36
-            elif depth == 1:
-                base = np.array([33,52,46],np.float32)
-                opacity = .76
-            else:
-                base = np.array([23,37,30],np.float32)
-                opacity = .94
-            color = base[None,None,:] + (bark+side)[:,:,None]
-            moss = np.clip((medium-.55)*5,0,1)*np.clip((Y-.23)*2,0,1)
-            color += moss[:,:,None]*np.array([0,12,-3],np.float32)
-            m = (trunk_mask*opacity)[:,:,None]
-            forest = forest*(1-m)+color*m
-
-            # Thin organic branching, with softly anti-aliased edges.
-            if depth > 0:
-                branchmask = np.zeros((h,w),np.uint8)
-                for b in range(int(rng.integers(2,5))):
-                    sy = rng.uniform(.07,.32)
-                    sx = xbase + lean*(root-sy)+.007*np.sin(sy*8+phase)
-                    direction = -1 if rng.random()<.5 else 1
-                    length = rng.uniform(.065,.18)
-                    pts = []
-                    for t0 in np.linspace(0,1,16):
-                        px = sx + direction*length*t0
-                        py = sy-.075*t0-.05*t0*t0+.005*np.sin(t0*5)
-                        pts.append((int(px*w),int(py*h)))
-                    cv2.polylines(branchmask,[np.array(pts,np.int32)],False,255,
-                                  max(1,int(half*w*.38)),cv2.LINE_AA)
-                bm = cv2.GaussianBlur(branchmask.astype(np.float32)/255,(0,0),max(.35,scale*.0008))*.75
-                forest = forest*(1-bm[:,:,None])+(base+3)[None,None,:]*bm[:,:,None]
-
-    # Irregular, multi-scale canopy masses: no flat leaf polygons.
-    canopy_field = np.zeros((h,w),np.float32)
-    for j in range(38):
-        cx = rng.uniform(-.1,1.1)
-        cy = rng.uniform(-.15,.23)
-        rx = rng.uniform(.04,.19)
-        ry = rng.uniform(.04,.14)
-        field = np.exp(-((X-cx)/rx)**2-((Y-cy)/ry)**2)
-        canopy_field = np.maximum(canopy_field,field)
-    foliage = np.clip((canopy_field+.32*(medium-.5)+.16*(detail-.5)-.29)*2.5,0,.91)
-    leaf_color = np.stack([15+19*texture,36+39*texture,25+29*texture],axis=2)
-    forest = forest*(1-foliage[:,:,None])+leaf_color*foliage[:,:,None]
-    leaves = np.zeros((h,w,3),np.uint8)
-    leafmask = np.zeros((h,w),np.uint8)
-    for j in range(2200):
-        px = int(rng.uniform(0,w))
-        py = int(rng.uniform(0,.37*h))
-        if rng.random() > float(np.clip(canopy_field[py,px],0,1)):
-            continue
-        size = rng.uniform(.0013,.005)*scale
-        axes = (max(1,int(size)),max(1,int(size*.43)))
-        angle = float(rng.uniform(0,180))
-        light = float(rng.uniform(.70,1.35))
-        color = tuple(int(v*light) for v in (31,65,41))
-        cv2.ellipse(leaves,(px,py),axes,angle,0,360,color,-1,cv2.LINE_AA)
-        cv2.ellipse(leafmask,(px,py),axes,angle,0,360,150,-1,cv2.LINE_AA)
-    lm = cv2.GaussianBlur(leafmask.astype(np.float32)/255,(0,0),max(.3,scale*.00065))
-    forest = forest*(1-lm[:,:,None])+leaves.astype(np.float32)*lm[:,:,None]
-
-    # Forest floor visible through the bench openings.
-    floor_alpha = np.clip((Y-.56)/.20,0,1)
-    floor_light = 7*np.sin(X*12+Y*19)+21*(texture-.5)
-    floor = np.stack([30+floor_light,47+floor_light,29+floor_light*.7],axis=2)
-    forest = forest*(1-floor_alpha[:,:,None])+floor*floor_alpha[:,:,None]
-    ground_marks = np.zeros((h,w,3),np.uint8)
-    ground_mask = np.zeros((h,w),np.uint8)
-    for j in range(550):
-        gx,gy = rng.uniform(0,1),rng.uniform(.58,.89)
-        height = rng.uniform(.004,.026)*(gy+.25)
-        pts = np.array([(int(gx*w),int(gy*h)),
-                        (int((gx+rng.uniform(-.007,.007))*w),int((gy-height*.6)*h)),
-                        (int((gx+rng.uniform(-.011,.011))*w),int((gy-height)*h))],np.int32)
-        color = (int(rng.integers(30,56)),int(rng.integers(52,86)),int(rng.integers(29,48)))
-        cv2.polylines(ground_marks,[pts],False,color,max(1,int(scale*.001)),cv2.LINE_AA)
-        cv2.polylines(ground_mask,[pts],False,170,max(1,int(scale*.001)),cv2.LINE_AA)
-    gm = cv2.GaussianBlur(ground_mask.astype(np.float32)/255,(0,0),max(.35,scale*.001))
-    forest = forest*(1-gm[:,:,None])+ground_marks.astype(np.float32)*gm[:,:,None]
-
-    # Pale forest mist and diffuse shafts create depth and match the soft source light.
-    fog = (.13+.20*np.exp(-((Y-.48)/.13)**2))*clearing
-    fog *= .75+.25*broad
-    forest = forest*(1-fog[:,:,None])+np.array([115,149,145],np.float32)*fog[:,:,None]
-    shafts = np.zeros((h,w),np.float32)
-    for cx, strength, width in [(.55,.12,.028),(.67,.10,.021),(.37,.065,.035)]:
-        line = cx-.22*Y
-        shafts += strength*np.exp(-((X-line)/width)**2)*np.exp(-Y*1.7)
-    shafts *= .7+.3*medium
-    forest = forest*(1-shafts[:,:,None])+np.array([165,193,156],np.float32)*shafts[:,:,None]
-
-    # Floating light spheres. Rendering them before compositing provides correct occlusion.
-    orbs = [(.19,.280,.0075,(157,239,218)),
-            (.355,.345,.010,(225,244,166)),
-            (.535,.190,.0065,(160,222,250)),
-            (.650,.365,.0115,(225,247,180)),
-            (.842,.302,.0085,(139,239,215)),
-            (.936,.390,.006,(210,236,163)),
-            (.290,.120,.004,(159,231,240)),
-            (.755,.130,.0048,(217,239,178)),
-            (.455,.681,.005,(155,233,202))]
-    for ox,oy,rgb_radius,color in orbs:
-        radius = max(.9,rgb_radius*scale)
-        dx,dy = xx-ox*w, yy-oy*h
-        d2 = dx*dx+dy*dy
-        halo = np.exp(-d2/(2*(radius*4.7)**2))*.20
-        bloom = np.exp(-d2/(2*(radius*1.8)**2))*.42
-        c = np.array(color,np.float32)
-        glow = np.clip(halo+bloom,0,.6)
-        forest = forest*(1-glow[:,:,None])+c[None,None,:]*glow[:,:,None]
-        distance = np.sqrt(d2)/radius
-        core = np.clip((1.06-distance)*radius/max(.7,scale*.0013),0,1)
-        shade = .73+.20*np.clip(-dx/radius,0,1)+.12*np.clip(-dy/radius,0,1)
-        sphere = np.clip(c[None,None,:]*shade[:,:,None]+18,0,255)
-        forest = forest*(1-core[:,:,None])+sphere*core[:,:,None]
-        highlight = np.exp(-((dx+radius*.28)**2+(dy+radius*.32)**2)/(2*(radius*.29)**2))*.86
-        forest = forest*(1-highlight[:,:,None])+np.array([252,255,240],np.float32)*highlight[:,:,None]
-
-    # Small, soft illuminated motes supplement the larger orbs.
-    for j in range(34):
-        ox,oy = rng.uniform(.03,.98),rng.uniform(.12,.70)
-        radius = rng.uniform(.0007,.0017)*scale
-        d2 = (xx-ox*w)**2+(yy-oy*h)**2
-        spot = np.exp(-d2/(2*max(.55,radius)**2))*rng.uniform(.25,.55)
-        forest = forest*(1-spot[:,:,None])+np.array([171,213,167],np.float32)*spot[:,:,None]
-
-    original_gray = lum.astype(np.float32)
-    grain = original_gray-cv2.GaussianBlur(original_gray,(0,0),max(.6,scale*.0018))
-    grain = np.clip(grain,-5,5)
-    forest += (.65*fine+.33*grain)[:,:,None]
-    forest = np.clip(forest,0,255)
-    result = forest*(1-alpha[:,:,None])+src*alpha[:,:,None]
-    return Image.fromarray(np.clip(result,0,255).astype(np.uint8),'RGB')
\ No newline at end of file + original = np.asarray(image.convert('RGB')).copy() + src = cv2.cvtColor(original, cv2.COLOR_RGB2BGR) + + def polygon_mask(vertices): + result = np.zeros((h, w), dtype=np.uint8) + points = np.array([(int(round(x * (w - 1))), int(round(y * (h - 1)))) + for x, y in vertices], dtype=np.int32) + cv2.fillPoly(result, [points], 255) + return result + + # Include the sign's outer frame and a small background margin. + sign = polygon_mask([ + (0.0000, 0.3950), (0.0338, 0.3950), + (0.0350, 0.3985), (0.0350, 0.4800), + (0.0335, 0.4820), (0.0000, 0.4820) + ]) + # The slender support crosses the background vehicles and ends in rubble. + pole = polygon_mask([ + (0.0140, 0.4775), (0.0221, 0.4775), + (0.0214, 0.6888), (0.0140, 0.6888) + ]) + removal = cv2.bitwise_or(sign, pole) + radius = max(2, int(round(w * 0.0030))) + filled = cv2.inpaint(src, removal, radius, cv2.INPAINT_TELEA) + + # Sample the neighboring unobstructed facade at the same vertical position. + # This retains actual photographic texture rather than a broad smooth fill. + shift = max(1, int(round(w * 0.0370))) + donor_indices = np.minimum(np.arange(w) + shift, w - 1) + donor = src[:, donor_indices].copy() + + # Padding makes Poisson blending safe even where the mask meets the left edge. + pad = max(8, int(round(w * 0.0120))) + donor_pad = cv2.copyMakeBorder(donor, pad, pad, pad, pad, cv2.BORDER_REFLECT_101) + filled_pad = cv2.copyMakeBorder(filled, pad, pad, pad, pad, cv2.BORDER_REFLECT_101) + sign_pad = cv2.copyMakeBorder(sign, pad, pad, pad, pad, cv2.BORDER_CONSTANT, value=0) + x, y, bw, bh = cv2.boundingRect(sign_pad) + center = (x + bw // 2, y + bh // 2) + cloned_pad = cv2.seamlessClone(donor_pad, filled_pad, sign_pad, center, cv2.NORMAL_CLONE) + cloned = cloned_pad[pad:pad + h, pad:pad + w] + edited = filled.astype(np.float32) + edited[sign > 0] = cloned[sign > 0].astype(np.float32) + + # Add restrained local high-frequency texture only to the narrow pole repair. + texture_shift = max(1, int(round(w * 0.0110))) + texture_indices = np.minimum(np.arange(w) + texture_shift, w - 1) + texture_sample = src[:, texture_indices].astype(np.float32) + sigma = max(0.5, w * 0.00055) + low_frequency = cv2.GaussianBlur(texture_sample, (0, 0), sigmaX=sigma, sigmaY=sigma) + detail = np.clip(texture_sample - low_frequency, -5.0, 5.0) + pole_only = (pole > 0) & (sign == 0) + rng = np.random.default_rng(21) + noise = rng.normal(0.0, 0.45, (h, w, 1)).astype(np.float32) + textured = edited + 0.45 * detail + noise + edited[pole_only] = textured[pole_only] + + # Feather inward within the small safety margin; all other pixels remain exact. + distance = cv2.distanceTransform(removal, cv2.DIST_L2, 3) + feather_width = max(1.0, w * 0.0010) + alpha = np.clip(distance / feather_width, 0.0, 1.0)[..., None] + result = np.clip(np.rint(src.astype(np.float32) * (1.0 - alpha) + edited * alpha), 0, 255).astype(np.uint8) + result[removal == 0] = src[removal == 0] + result_rgb = cv2.cvtColor(result, cv2.COLOR_BGR2RGB) + if image.mode == 'RGBA': + return Image.fromarray(np.dstack((result_rgb, np.asarray(image.getchannel('A')))), 'RGBA') + return Image.fromarray(result_rgb, 'RGB')
\ No newline at end of file