You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prototype nodes and example graphs focused on ComfyUI-driven rapid prototyping for diffusion + perception workflows. Includes small, dependency-light utilities you can drop into existing graphs.
---
## Core deliverables
- Custom node(s) under autonomy\_prototypes/
- Example inpaint graph: workflows/sam\_semantic\_conditioning\_inpaint.json
1. Open workflows/sam\_semantic\_conditioning\_inpaint.json.
2. In the canvas, set the **LoadImage** to your source (e.g., a street scene).
3. Ensure **CheckpointLoaderSimple** points to an **inpaint** checkpoint.
4. With **SAM Parameters** + **SAM Image Mask**, click a few positive points on the region to change (e.g., the road). Add a negative point to exclude obvious distractors if needed.
- **Semantic-ID path:** Feed SAM’s **IMAGE** (binary 0/1 in first channel) → SemanticMaskToWeightMap and set class\_id = 255 (SAM foreground). Output MASK → VAEEncodeForInpaint.mask.
6. Set **denoise** in KSampler to 0.5–0.7 to force visible edits.
7. Optional: Enable IP-Adapter with a grass reference image to bias texture.
8. Run. Preview nodes should show the masked inpaint and decoded output.
---
## Tips & gotchas
- **Feeding SAM to SemanticMaskToWeightMap**
SAM’s mask is binary (0/1). This node rounds gray\*255, so foreground becomes 255.
➤ Set class\_id = 255 to select SAM’s foreground.
If you don’t need class selection, prefer BinaryMaskToWeightMap (simpler and faster).
- **“Nothing changes” troubleshooting**
- Ensure MASK → VAEEncodeForInpaint.mask is connected.
- Use an **inpaint** checkpoint/pipeline.
- Increase denoise to ~0.6–0.8.
- Try invert = True if edits apply to the wrong side of the mask.
- If edges look harsh, set sigma = 1.5–3.0 with edge\_soften = True.
- **VRAM / stability**
- Lower sigma or disable edge\_soften.
- The blur is separable (two 1D passes) and has a CPU fallback on OOM.
- **SAM points shape errors**
Provide equal counts of positive/negative points (or leave negatives empty). Mixed lengths can trigger tensor-concat size errors in some SAM node builds.
---
## Repository layout
.
├─ LICENSE
├─ README.md
├─ autonomy_prototypes/ # the actual nodes (drop this folder into ComfyUI/custom_nodes)
│ ├─ init.py
│ ├─ binary_mask_to_weightmap.py
│ └─ semantic_mask_to_weightmap.py
├─ examples/ # (optional) small code samples
├─ graphs/ # (optional) extra graphs
├─ samples/ # input/output example images (add your reproducible assets here)
└─ workflows/
├─ sam_semantic_conditioning_inpaint.json
└─ screenshots/
└─ prototype_graph_ui_01.png
yaml
Copy code
> If you share the repo publicly, consider adding a few **sample inputs** (licensed images) and **one output** for reviewers to reproduce the run exactly.
---
## Known issues / roadmap
- Add **class-agnostic** mode to SemanticMaskToWeightMap (treat any non-zero as foreground; no class\_id=255 required).
- Optional **edge-only** weighting (distance-like falloff) for cleaner feathered edits.