mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
* feat(ui): group nodes by category in add-node dialog Add collapsible category grouping to the node picker command palette. Categories are parsed from the backend schema and displayed as expandable sections with caret icons. All categories auto-expand when searching. * feat(ui): add toggle for category grouping in add-node dialog and prioritize exact matches Add a persistent "Group Nodes by Category" setting to workflow editor settings, allowing users to switch between grouped and flat node list views. Also sort exact title matches to the top when searching. * fix: update test schema categories to match expected templates * feat: add expand/collapse all buttons to node picker and fix node categories Add "Expand All" and "Collapse All" link-buttons above the grouped category list in the add-node dialog so users can quickly open or close all categories at once. Buttons are hidden during search since categories auto-expand while searching. Fix two miscategorized nodes: Z-Image ControlNet was in "Control" instead of "Controlnet", and Upscale (RealESRGAN) was in "Esrgan" instead of "Upscale". * refactor(nodes): clean up node category taxonomy Reorganize all built-in invocation categories into a consistent set of 18 groups (model, prompt, conditioning, controlnet_preprocessors, latents, image, mask, inpaint, tiles, upscale, segmentation, math, strings, primitives, batch, metadata, multimodal, canvas). - Move denoise/i2l/l2i nodes consistently into "latents" - Move all mask creation/manipulation nodes into "mask" - Split ControlNet preprocessors out of "controlnet" into their own group - Fold "unet", "vllm", "string", "ip_adapter", "t2i_adapter" into larger groups - Move metadata_linked denoise wrappers from "latents" to "metadata" - Add missing category to ideal_size - Introduce dedicated "canvas" group for canvas/output/panel nodes Also adds the now-required `category` field to invocation template fixtures in validateConnection.test.ts. * Chore Ruff Format --------- Co-authored-by: dunkeroni <dunkeroni@gmail.com>
40 lines
1.7 KiB
Python
40 lines
1.7 KiB
Python
from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation
|
|
from invokeai.app.invocations.fields import ImageField, InputField, WithBoard, WithMetadata
|
|
from invokeai.app.invocations.primitives import ImageOutput
|
|
from invokeai.app.services.shared.invocation_context import InvocationContext
|
|
from invokeai.backend.image_util.mlsd import MLSDDetector
|
|
from invokeai.backend.image_util.mlsd.models.mbv2_mlsd_large import MobileV2_MLSD_Large
|
|
|
|
|
|
@invocation(
|
|
"mlsd_detection",
|
|
title="MLSD Detection",
|
|
tags=["controlnet", "mlsd", "edge"],
|
|
category="controlnet_preprocessors",
|
|
version="1.0.0",
|
|
)
|
|
class MLSDDetectionInvocation(BaseInvocation, WithMetadata, WithBoard):
|
|
"""Generates an line segment map using MLSD."""
|
|
|
|
image: ImageField = InputField(description="The image to process")
|
|
score_threshold: float = InputField(
|
|
default=0.1, ge=0, description="The threshold used to score points when determining line segments"
|
|
)
|
|
distance_threshold: float = InputField(
|
|
default=20.0,
|
|
ge=0,
|
|
description="Threshold for including a line segment - lines shorter than this distance will be discarded",
|
|
)
|
|
|
|
def invoke(self, context: InvocationContext) -> ImageOutput:
|
|
image = context.images.get_pil(self.image.image_name, "RGB")
|
|
loaded_model = context.models.load_remote_model(MLSDDetector.get_model_url(), MLSDDetector.load_model)
|
|
|
|
with loaded_model as model:
|
|
assert isinstance(model, MobileV2_MLSD_Large)
|
|
detector = MLSDDetector(model)
|
|
edge_map = detector.run(image, self.score_threshold, self.distance_threshold)
|
|
|
|
image_dto = context.images.save(image=edge_map)
|
|
return ImageOutput.build(image_dto)
|