Skip to main content

LoserTalk 废物说

废物说聚焦于一个废物想要说的话,不一定是废话,但是费话
  1. 老师,我看 PR #46163 的实现发现一个设计卡点。十六个模型的 post_process_semantic_segmentation 函数,在 return_segmentation_scores 为 True 的路径下都是先无条件执行 argmax,再把硬分类图塞进 segmentation 字段,把 per-class logits 塞进 segmentation_scores 字段。每个 model 都在自己的 post processor 内部把 argmax 做完了才往外吐。

    具体代码可以看 image_processing_beit.py 第 230 行附近,或者 image_processing_detr.py 第 910 行附近,十六个模型都是同一个 pattern,先算 seg_maps = logits.argmax(dim=1),再构造 SemanticSegmentationPostProcessorOutput(segmentation=seg_maps[i], segmentation_scores=logits[i])。

    我的看法是 post_process_semantic_segmentation 这个函数的语义定位应该再往前退一步,止于 probability 或者 logits 这一层。argmax 是下游的解码决策,不应该由 model family 这一层强加。现在这个函数名虽然叫 post_process,但做的事情其实是 decode,把 argmax 这一步嵌死在 image processor 内部,等于 model 这一层把解码策略替所有下游选好了,下游消费者想跳过 argmax 直接拿概率图去解码,没有任何 API 路径可以选。

    还有一个相关位置是 pipelines/image_segmentation.py 第 207 行那个 semantic 分支,目前它直接消费 self.image_processor.post_process_semantic_segmentation 的返回值做 outputs.numpy(),这一行也说明 pipeline 现在的设计是把 image processor 的输出当作硬 mask 来用,等于默认接受 argmax 嵌死的现状。

    我想讨论的方向是 post_process_semantic_segmentation 函数的职责边界,应该是把 logits 或者 probability 暴露给下游,至于要不要 argmax、用什么 metric-aware 解码,应该交给 pipeline 或者消费者来决定。这样语义更干净,也不会让每一个 model 都在自己的 post processor 内部重复 argmax 这一步。

    这个改动对短期 RankSEG 集成没有阻塞,消费 segmentation_scores 字段就够,但长期方向值得在 PR 下面定下来,避免 argmax 嵌死在 image processor 里成为技术债。

    老师您觉得这个方向值得直接发 comment,还是开 follow-up issue 更稳。同学也可以去看一下这两个位置再讨论。
  2. 《Every Agentic Engineering Hack I Know (June 2026)》

    作者:Matt Van Horn(June Oven & Lyft 联合创始人)
    原文:https://x.com/mvanhorn/status/2061877533885473181

    ---

    三个月前我发了《Every Claude Code Hack I Know》,913 万阅读。Kevin Rose 问我用什么 IDE,我说:"不用 IDE。只用 plan.md 和语音。"

    以前叫 vibe coding,去年感恩节模型够强了,玩具变真了,现在叫 Agentic Engineering。我用这套方法今年出了 last30days(27K stars)、Printing Press(4K stars)、Agent Cookie,还成了 Python、Go、GStack、Paperclip 的核心贡献者。高中以后没写过别人在意的软件。这些是我的技巧。

    ---

    1. 有想法就写 plan.md
    最重要的规则。有想法 → 立即 /ce-plan。不是"让我想想",不是"让我开始写代码"。产品创意、GitHub Issue、终端报错截图、设计稿,什么都往里丢。
    底层:/ce-plan 并行派出多个 Agent 研究你的代码库、搜历史方案、查外部文档,然后写一份结构化的 plan.md——问题、方案、改哪些文件、验收标准。/ce-work 拿 plan 去构建。Context 爆了开新 session 指向 plan 继续。Plan 是能存活一切的 checkpoint。
    传统开发 80% 编码 20% 规划。这翻转了。

    2. 不要读 plan.md
    Plan 是给 agent 看的。有 plan 的 agent 交付完成的工作,没 plan 的偷工减料。Plan 是牵 agent 的绳子。
    我瞄一眼标题跑 /ce-work。有问题直接问:"TLDR?" "eli5 this plan" "wait, why this approach?" 不读 300 行 markdown,那是 agent 的作业。
    Make the plan. Trust the plan. Don't read the plan.

    3. 非代码工作也用 /ce-plan
    策略文档、产品 spec、竞争分析、董事会汇报,全跑同一个循环。关键技巧:先让它 plan 怎么写这个文档,再执行。直接问产出它偷懒,先 plan 再执行它给你深度版本。

    4. 语音输入
    语音转 LLM 不需要完美转录,因为对面够聪明能补上。Mac 用 Monologue 或 Wispr Flow,手机用 Apple 内置听写。买个鹅颈麦克风。

    5. cmux 4-6 个标签并行
    一个写 plan、一个执行 plan、一个跑任务、一个修 bug。/ce-plan 研究时切另一个窗口 /ce-work,循环回来第一个已完成。

    6. 终端默认进 Claude 不是 Shell
    新 tab 直接打开 Claude Code,不需要 cd 或打命令。一个快捷键 = 一个新 session。

    7. 远程控制 + AgentMail
    每个 session 从手机 app 接管。AgentMail 给 Claude 一个邮箱,发邮件就触发任务。晚餐发现 bug?手机发邮件,回到屏幕前已修好。

    8. Codex 也配一套
    Claude 计划强,Codex 并行快,两边都配。

    9. 浏览器 Agent
    Vercel Agent Browser 让 agent 操作浏览器,看页面、填表单、调试前端。

    10-11. 远程机器
    Mac Mini 当服务器 + 两台远程机器全天候跑。你睡觉时它们在构建。

    12-16. 记忆系统
    Granola 记会议、Bear 记笔记、last30days 管近期上下文、Supermemory 管长期记忆、让 agent 学你的代码风格。

    17. 重复两次的事做成 Skill
    找一个已有的好 skill,让 agent 参照结构写你的。last30days 从个人 skill 变 26K stars 开源。
    Write the skill once. Every session after is faster.

    18. 开源贡献
    同一套 /ce-plan + /ce-work 循环贡献开源。不是 typo fix,是真正功能。PR 是敲门砖,Discord 里交朋友才是收获。

    19. M5 Max + 电池砖
    6 个 Claude session + Codex 全天跑,1 小时没电。Anker 电池砖随身带,车里放充电器。sudo pmset -a disablesleep 1。

    20. Printing Press CLI 跑真实生活
    一队包裹真实服务的 CLI:Tesla 预热、Instacart 购物、ESPN 比赛监控、Alaska Airlines 订票。Agent Cookie 把浏览器 session 给 CLI 免密码。
    不是"AI 帮我写代码"。Agentic Engineering 跑腿、看比赛、暖车、订 trip,而你在做别的事。

    21. AI Psychosis
    用 agent 构建是有史以来最好的电子游戏。陷阱不是空的发布会,是消失在构建中失去身边的人。休息。摸摸草。和你爱的人说话。

    22. 这篇文章就是这样写的
    Claude Code in cmux,对着 Monologue 说话。没有 IDE,没有打字。说、规划、构建。从书桌、沙发、车里、足球场。

    ---

    核心工具:
    Compound Engineering(plan 插件)| cmux(多标签)| Monologue/Wispr Flow(语音)| Granola(会议记录)| last30days(近期记忆)| Supermemory(长期记忆)| Printing Press(真实生活 CLI)| Agent Cookie(免密认证)| AgentMail(邮件触发任务)

    一句话总结:80% 规划 20% 执行。写 plan 给 agent,不要自己读。语音输入。多 tab 并行。重复两次的事做成 skill。
  3. Jasen,我重新看了 [torchgeo/torchgeo#3768](https://github.com/torchgeo/torchgeo/issues/3768)、RankSEG README、以及 TorchGeo trainer 代码。我的判断是:**现在不应该强推 TorchGeo core trainer 级别集成,最好的切入点是“post-predict probability decoder / recipe”,然后用 PRUE FTW 做更扎实的验证。**

    核心判断

    TorchGeo 不是完全没有 probability 接口。相反,[segmentation.py](/Users/lev1s/Documents/GitHub/rankseg/promote/torchgeo/torchgeo/trainers/segmentation.py:322) 的 predict_step 已经返回 probabilities`、`bounds`、`transform`,这对 geospatial inference 很关键。Change detection 和 spatiotemporal segmentation 也在 `predict_step 做了 sigmoid/softmax,只是返回格式没有 semantic segmentation 那么 metadata-aware。

    真正缺的是:**probabilities 之后的 final mask decoder 抽象**。现在 TorchGeo 里 hard mask 基本还是散落在 visualization 或用户代码里,比如 argmax/threshold。RankSEG 的位置正好是:

    
    logits -> softmax/sigmoid probabilities -> RankSEG/probability decoder -> mask
    


    不是:

    
    training -> checkpoint -> RankSEG
    


    也不是:

    
    loss/metric/trainer core -> RankSEG
    


    我建议的方案排序

    1. 最推荐:先做 RankSEG/TorchGeo recipe + PRUE FTW 实验

    这是当前最稳的路线。用 TorchGeo 的 FTW dataset + PRUE weights,冻结 checkpoint,只比较 default argmax vs RankSEG。这个直接回应 Isaac 的关切,也不会给 TorchGeo core 增加维护负担。

    实验应该做:
    - `Unet_Weights.SENTINEL2_FTW_PRUE_EFNETB3/B5/B7`,优先 B3 或 B5,CPU 可跑;
    - 固定 FTW country/split/subset;
    - 输出 IoU/Dice,最好再加 FTW 官方或 object-oriented metric;
    - 输出 qualitative grid;
    - 代码用当前 RankSEG API:`post = RankSEG(...); preds = post(probs)`,对应 [README.md](/Users/lev1s/Documents/GitHub/rankseg/README.md:55)。

    2. TorchGeo 侧最轻 PR:documentation recipe

    比如一个 docs/tutorial:从 SemanticSegmentationTask.predict_step 取 `probabilities`,然后用外部 postprocessor 得到 mask。这个 PR 最容易被接受,因为:
    - 不引入 rankseg 依赖;
    - 不改 trainer 语义;
    - 不碰 loss/metrics;
    - 和 Adam “不要让 trainer 变复杂”的担忧一致。

    3. 中等风险:generic helper,不 RankSEG-specific

    如果 maintainer 明确想要 helper,可以设计成通用概率解码器,而不是直接把 RankSEG 放进 TorchGeo:

    
       preds = decode_segmentation_probabilities(
           probs,
           task="multiclass",
           decoder=rankseg_callable,
       )
       


    但我会谨慎。TorchGeo 一旦加 helper,就要维护 API、任务类型、batch shape、binary/multiclass/multilabel 语义。这个要等 PRUE 实验结果更强以后再谈。

    4. 不推荐现在做:trainer-level train/val/test 集成

    Adam 说 val metrics 对 hparam tuning 重要,这个观点成立;但 RankSEG 是 trained model output improvement,在 early epoch 加它大概率只是额外开销,还可能让训练过程指标变得难解释。TorchGeo 的 train/val/test 现在在 [segmentation.py](/Users/lev1s/Documents/GitHub/rankseg/promote/torchgeo/torchgeo/trainers/segmentation.py:217) 和 [segmentation.py](/Users/lev1s/Documents/GitHub/rankseg/promote/torchgeo/torchgeo/trainers/segmentation.py:241) 都是 logits -> metrics/loss,这个设计不应该轻易改。

    我建议 issue 里的口径

    可以温和地把讨论收束到这个判断:

    > After reading the TorchGeo trainer code more carefully, I think TorchGeo already exposes the key probability-level path through predict_step, especially for semantic segmentation where probabilities are returned with geospatial metadata. So I would not frame this as a missing probability interface. The narrower question is whether TorchGeo wants a documented or helper-level probability-to-mask decoding step after prediction. I also agree that adding RankSEG into train loops is probably not the right first target. I can first rerun the FTW experiment with the newer PRUE weights and prepare a small recipe, then we can decide whether it belongs in TorchGeo docs, a generic helper, FTW baselines, or only the RankSEG examples.

    我的结论:**先不要写 TorchGeo core PR。先用 PRUE FTW 做一个能站住的 recipe/benchmark,再把它作为“probability decoder after predict_step”的设计讨论材料。** 这条路最学术谦逊,也最不容易被 maintainer 觉得是在推销或加负担。
  4. use a subagent to perform a real exam use case check, the subagent read each topic 4-6 one by one, collect all the posible exam point, update the topic exam point md topic by topic, all will under exam question type example context. after finish one exam topic, main thread will use the md along with cheatsheet to do a topic full check, if any not covered, directly fix it. The cheatsheet md will consider the rmd use case in [$rmarkdown-cheatsheet](/Users/lev1s/.agents/skills/rmarkdown-cheatsheet/SKILL.md) , the structure and formula or r output etc. should under a proper format which can easily used by the skill to produce a rmd which can output pdf. Just consider md file in this loop, rmd use will be in next run.
  5. 我现在在做 RankSEG 与 Hugging Face Transformers 的集成设计,目标不是继续维护一个 forked transformers,而是优先在 rankseg 侧实现对 Hugging Face segmentation model outputs 的兼容函数。

    背景:
    1. 我之前已经在一个本地 transformers 分支里做过一版集成,改的是 `src/transformers/pipelines/image_segmentation.py`,核心思路是在 pipeline 的 semantic segmentation postprocess 阶段加入 RankSEG。
    2. 那版实现里最关键的 helper 是:根据不同模型的 outputs 结构,把它们统一还原成 semantic segmentation 的概率图 `(B, C, H, W)`,然后再交给 `RankSEG.predict(...)`。
    3. 现在不想要求用户安装我 fork 的 transformers。更希望最终用户只需要安装官方 transformers 和 rankseg,就能用 rankseg 的 Hugging Face 兼容能力。

    已确认的技术判断:
    1. 不优先走 transformers.pipeline(...) patch 方案,至少第一步不这么做。
    2. 不建议给 outputs 对象动态挂方法,比如 outputs.rankseg()`,因为 outputs 类型不统一,很多模型还可能 `trust_remote_code=True 返回 tuple 或自定义对象。
    3. 更稳的方案是:在 rankseg 里提供 helper
    4. RankSEG 真正依赖的不是 pipeline,而是“如何把不同 transformers model outputs 统一成 semantic segmentation probability map”。

    请先理解这些 transformers 相关概念:
    1. AutoModelForSemanticSegmentation.from_pretrained(...)
    是直接加载“任务模型”,不是 pipeline。
    2. processor = SegformerImageProcessor.from_pretrained(...)
    是加载与模型配套的图像前处理器。
    3. 用户一般会这样手动推理:
    - inputs = processor(images=image, return_tensors="pt")
    - outputs = model(**inputs)
    - 然后自己做 resize / argmax / 后处理
    4. 我想插入 RankSEG 的位置,就是在 outputs 之后、argmax 之前。

    已探索到的 transformers 输出形态差异:
    1. 标准 semantic segmentation 模型:
    - outputs.logits
    - 对应 SemanticSegmenterOutput
    - 示例:SegFormer
    2. query-based universal segmentation 模型:
    - outputs.class_queries_logits
    - outputs.masks_queries_logits
    - 示例:Mask2Former / OneFormer
    3. DETR segmentation 模型:
    - outputs.logits
    - outputs.pred_masks
    4. 还有一些 trust_remote_code=True 的模型可能不遵循标准 ModelOutput`,例如有人直接示例里写 `model(input_images)[-1]

    已经看过的本地 transformers 参考位置:
    - /Users/lev1s/Documents/GitHub/transformers/src/transformers/pipelines/image_segmentation.py
    - /Users/lev1s/Documents/GitHub/transformers/src/transformers/modeling_outputs.py
    - /Users/lev1s/Documents/GitHub/transformers/src/transformers/models/segformer/image_processing_segformer.py
    - /Users/lev1s/Documents/GitHub/transformers/src/transformers/models/mask2former/image_processing_mask2former.py
    - /Users/lev1s/Documents/GitHub/transformers/src/transformers/models/detr/modeling_detr.py
    - /Users/lev1s/Documents/GitHub/transformers/src/transformers/models/oneformer/modeling_oneformer.py

    rankseg 侧的历史参考:
    1. 我之前做过 rankseg/paddleseg 兼容层,思路是 rankseg 自己提供兼容 facade,而不是修改 PaddleSeg 上游。
    2. 这个经验说明:在 rankseg 侧做 Hugging Face outputs 兼容 helper 是合理的。

    当前开发目标:
    请在 rankseg 仓库里设计并实现第一版 Hugging Face outputs 兼容函数,优先做最小可用版本,不要过度设计,不要做大而全封装,不要先做 pipeline monkey patch。

    建议的第一版 API:
    - semantic_probs_from_outputs(outputs, model=None, image_processor=None, target_sizes=None)
    - predict_semantic_segmentation(outputs, model=None, image_processor=None, target_sizes=None, rankseg_kwargs=None)

    第一版范围只支持:
    1. outputs.logits
    2. outputs.class_queries_logits + outputs.masks_queries_logits
    3. outputs.logits + outputs.pred_masks

    设计要求:
    1. 保持线性逻辑,避免复杂抽象。
    2. 不要先搞通用 CV toolbox。
    3. 不要给 outputs 动态挂方法。
    4. 不要先做 transformers pipeline patch。
    5. 如果某些 output 类型不支持,明确报错即可。
    6. 如果需要 resize 到 target size,请参考 transformers 自己 image processor/postprocess 的做法。
    7. 如果需要从 query-based outputs 还原 semantic class scores,请参考 transformers 现有 post_process_semantic_segmentation 的实现思路。

    如果当前线程有本地两个 repo:
    - transformers: /Users/lev1s/Documents/GitHub/transformers
    - rankseg: /Users/lev1s/Documents/GitHub/rankseg
    请直接在 rankseg 里开发,并可把 transformers 当参考代码读取。
    如果 rankseg repo 还没在本地,先确认路径或 clone 后再继续。

    工作方式要求:
    - 请始终称呼我为 Jasen。
    - 默认用中文回复。
    - 内部思考和工具使用可用英文。
    - 先阅读 rankseg 当前包结构,再决定新增文件位置。
    - 优先做最小实现和一个 smoke test/示例,不要额外重构。

🌐 CDN Trace Information

Loading...