mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Add Coherence Mode - Mask
This commit is contained in:
parent
b5f42bedce
commit
6cfabc585a
@ -149,7 +149,7 @@ export const addVAEToGraph = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Handle Coherence Mode
|
// Handle Coherence Mode
|
||||||
if (canvasCoherenceMode === 'edge') {
|
if (canvasCoherenceMode !== 'unmasked') {
|
||||||
graph.edges.push({
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
||||||
|
@ -590,16 +590,8 @@ export const buildCanvasInpaintGraph = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle Coherence Mode
|
// Handle Coherence Mode
|
||||||
if (canvasCoherenceMode === 'edge') {
|
if (canvasCoherenceMode !== 'unmasked') {
|
||||||
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
// Create Mask If Coherence Mode Is Not Full
|
||||||
type: 'mask_edge',
|
|
||||||
id: CANVAS_COHERENCE_MASK_EDGE,
|
|
||||||
is_intermediate: true,
|
|
||||||
edge_blur: maskBlur,
|
|
||||||
edge_size: maskBlur * 2,
|
|
||||||
low_threshold: 100,
|
|
||||||
high_threshold: 200,
|
|
||||||
};
|
|
||||||
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
||||||
type: 'create_denoise_mask',
|
type: 'create_denoise_mask',
|
||||||
id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
@ -607,9 +599,65 @@ export const buildCanvasInpaintGraph = (
|
|||||||
fp32: vaePrecision === 'fp32' ? true : false,
|
fp32: vaePrecision === 'fp32' ? true : false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle Image Input For Mask Creation
|
||||||
if (isUsingScaledDimensions) {
|
if (isUsingScaledDimensions) {
|
||||||
graph.edges.push(
|
graph.edges.push({
|
||||||
{
|
source: {
|
||||||
|
node_id: INPAINT_IMAGE_RESIZE_UP,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
||||||
|
...(graph.nodes[
|
||||||
|
CANVAS_COHERENCE_INPAINT_CREATE_MASK
|
||||||
|
] as CreateDenoiseMaskInvocation),
|
||||||
|
image: canvasInitImage,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Mask If Coherence Mode Is Mask
|
||||||
|
if (canvasCoherenceMode === 'mask') {
|
||||||
|
if (isUsingScaledDimensions) {
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: MASK_RESIZE_UP,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'mask',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
||||||
|
...(graph.nodes[
|
||||||
|
CANVAS_COHERENCE_INPAINT_CREATE_MASK
|
||||||
|
] as CreateDenoiseMaskInvocation),
|
||||||
|
mask: canvasMaskImage,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Mask Edge If Coherence Mode Is Edge
|
||||||
|
if (canvasCoherenceMode === 'edge') {
|
||||||
|
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
||||||
|
type: 'mask_edge',
|
||||||
|
id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
|
is_intermediate: true,
|
||||||
|
edge_blur: maskBlur,
|
||||||
|
edge_size: maskBlur * 2,
|
||||||
|
low_threshold: 100,
|
||||||
|
high_threshold: 200,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle Scaled Dimensions For Mask Edge
|
||||||
|
if (isUsingScaledDimensions) {
|
||||||
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: MASK_RESIZE_UP,
|
node_id: MASK_RESIZE_UP,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
@ -618,33 +666,15 @@ export const buildCanvasInpaintGraph = (
|
|||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
{
|
} else {
|
||||||
source: {
|
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
||||||
node_id: INPAINT_IMAGE_RESIZE_UP,
|
...(graph.nodes[CANVAS_COHERENCE_MASK_EDGE] as MaskEdgeInvocation),
|
||||||
field: 'image',
|
image: canvasMaskImage,
|
||||||
},
|
};
|
||||||
destination: {
|
}
|
||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
|
||||||
field: 'image',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
|
||||||
...(graph.nodes[
|
|
||||||
CANVAS_COHERENCE_INPAINT_CREATE_MASK
|
|
||||||
] as CreateDenoiseMaskInvocation),
|
|
||||||
image: canvasInitImage,
|
|
||||||
};
|
|
||||||
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
|
||||||
...(graph.nodes[CANVAS_COHERENCE_MASK_EDGE] as MaskEdgeInvocation),
|
|
||||||
image: canvasMaskImage,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
graph.edges.push(
|
graph.edges.push({
|
||||||
{
|
|
||||||
source: {
|
source: {
|
||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
@ -653,18 +683,20 @@ export const buildCanvasInpaintGraph = (
|
|||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
field: 'mask',
|
field: 'mask',
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plug Denoise Mask To Coherence Denoise Latents
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'denoise_mask',
|
||||||
},
|
},
|
||||||
{
|
destination: {
|
||||||
source: {
|
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
|
||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
field: 'denoise_mask',
|
||||||
field: 'denoise_mask',
|
},
|
||||||
},
|
});
|
||||||
destination: {
|
|
||||||
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
|
|
||||||
field: 'denoise_mask',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Seed
|
// Handle Seed
|
||||||
|
@ -563,7 +563,6 @@ export const buildCanvasOutpaintGraph = (
|
|||||||
field: 'image',
|
field: 'image',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Take combined mask and resize and then blur
|
// Take combined mask and resize and then blur
|
||||||
{
|
{
|
||||||
source: {
|
source: {
|
||||||
@ -694,16 +693,7 @@ export const buildCanvasOutpaintGraph = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle Coherence Mode
|
// Handle Coherence Mode
|
||||||
if (canvasCoherenceMode === 'edge') {
|
if (canvasCoherenceMode !== 'unmasked') {
|
||||||
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
|
||||||
type: 'mask_edge',
|
|
||||||
id: CANVAS_COHERENCE_MASK_EDGE,
|
|
||||||
is_intermediate: true,
|
|
||||||
edge_blur: maskBlur,
|
|
||||||
edge_size: maskBlur * 2,
|
|
||||||
low_threshold: 100,
|
|
||||||
high_threshold: 200,
|
|
||||||
};
|
|
||||||
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
||||||
type: 'create_denoise_mask',
|
type: 'create_denoise_mask',
|
||||||
id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
@ -711,42 +701,82 @@ export const buildCanvasOutpaintGraph = (
|
|||||||
fp32: vaePrecision === 'fp32' ? true : false,
|
fp32: vaePrecision === 'fp32' ? true : false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isUsingScaledDimensions) {
|
// Handle Image Input For Mask Creation
|
||||||
graph.edges.push({
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: MASK_RESIZE_UP,
|
node_id: INPAINT_INFILL,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
},
|
},
|
||||||
destination: {
|
destination: {
|
||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
graph.edges.push({
|
// Create Mask If Coherence Mode Is Mask
|
||||||
source: {
|
if (canvasCoherenceMode === 'mask') {
|
||||||
node_id: MASK_COMBINE,
|
if (isUsingScaledDimensions) {
|
||||||
field: 'image',
|
graph.edges.push({
|
||||||
},
|
source: {
|
||||||
destination: {
|
node_id: MASK_RESIZE_UP,
|
||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
field: 'image',
|
||||||
field: 'image',
|
},
|
||||||
},
|
destination: {
|
||||||
});
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'mask',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: MASK_COMBINE,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'mask',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
graph.edges.push(
|
if (canvasCoherenceMode === 'edge') {
|
||||||
{
|
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
||||||
source: {
|
type: 'mask_edge',
|
||||||
node_id: INPAINT_INFILL,
|
id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
field: 'image',
|
is_intermediate: true,
|
||||||
},
|
edge_blur: maskBlur,
|
||||||
destination: {
|
edge_size: maskBlur * 2,
|
||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
low_threshold: 100,
|
||||||
field: 'image',
|
high_threshold: 200,
|
||||||
},
|
};
|
||||||
},
|
|
||||||
{
|
// Handle Scaled Dimensions For Mask Edge
|
||||||
|
if (isUsingScaledDimensions) {
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: MASK_RESIZE_UP,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: MASK_COMBINE,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
@ -755,18 +785,20 @@ export const buildCanvasOutpaintGraph = (
|
|||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
field: 'mask',
|
field: 'mask',
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plug Denoise Mask To Coherence Denoise Latents
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'denoise_mask',
|
||||||
},
|
},
|
||||||
{
|
destination: {
|
||||||
source: {
|
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
|
||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
field: 'denoise_mask',
|
||||||
field: 'denoise_mask',
|
},
|
||||||
},
|
});
|
||||||
destination: {
|
|
||||||
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
|
|
||||||
field: 'denoise_mask',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Seed
|
// Handle Seed
|
||||||
|
@ -605,16 +605,8 @@ export const buildCanvasSDXLInpaintGraph = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle Coherence Mode
|
// Handle Coherence Mode
|
||||||
if (canvasCoherenceMode === 'edge') {
|
if (canvasCoherenceMode !== 'unmasked') {
|
||||||
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
// Create Mask If Coherence Mode Is Not Full
|
||||||
type: 'mask_edge',
|
|
||||||
id: CANVAS_COHERENCE_MASK_EDGE,
|
|
||||||
is_intermediate: true,
|
|
||||||
edge_blur: maskBlur,
|
|
||||||
edge_size: maskBlur * 2,
|
|
||||||
low_threshold: 100,
|
|
||||||
high_threshold: 200,
|
|
||||||
};
|
|
||||||
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
||||||
type: 'create_denoise_mask',
|
type: 'create_denoise_mask',
|
||||||
id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
@ -622,9 +614,65 @@ export const buildCanvasSDXLInpaintGraph = (
|
|||||||
fp32: vaePrecision === 'fp32' ? true : false,
|
fp32: vaePrecision === 'fp32' ? true : false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle Image Input For Mask Creation
|
||||||
if (isUsingScaledDimensions) {
|
if (isUsingScaledDimensions) {
|
||||||
graph.edges.push(
|
graph.edges.push({
|
||||||
{
|
source: {
|
||||||
|
node_id: INPAINT_IMAGE_RESIZE_UP,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
||||||
|
...(graph.nodes[
|
||||||
|
CANVAS_COHERENCE_INPAINT_CREATE_MASK
|
||||||
|
] as CreateDenoiseMaskInvocation),
|
||||||
|
image: canvasInitImage,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Mask If Coherence Mode Is Mask
|
||||||
|
if (canvasCoherenceMode === 'mask') {
|
||||||
|
if (isUsingScaledDimensions) {
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: MASK_RESIZE_UP,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'mask',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
||||||
|
...(graph.nodes[
|
||||||
|
CANVAS_COHERENCE_INPAINT_CREATE_MASK
|
||||||
|
] as CreateDenoiseMaskInvocation),
|
||||||
|
mask: canvasMaskImage,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Mask Edge If Coherence Mode Is Edge
|
||||||
|
if (canvasCoherenceMode === 'edge') {
|
||||||
|
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
||||||
|
type: 'mask_edge',
|
||||||
|
id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
|
is_intermediate: true,
|
||||||
|
edge_blur: maskBlur,
|
||||||
|
edge_size: maskBlur * 2,
|
||||||
|
low_threshold: 100,
|
||||||
|
high_threshold: 200,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle Scaled Dimensions For Mask Edge
|
||||||
|
if (isUsingScaledDimensions) {
|
||||||
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: MASK_RESIZE_UP,
|
node_id: MASK_RESIZE_UP,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
@ -633,33 +681,15 @@ export const buildCanvasSDXLInpaintGraph = (
|
|||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
{
|
} else {
|
||||||
source: {
|
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
||||||
node_id: INPAINT_IMAGE_RESIZE_UP,
|
...(graph.nodes[CANVAS_COHERENCE_MASK_EDGE] as MaskEdgeInvocation),
|
||||||
field: 'image',
|
image: canvasMaskImage,
|
||||||
},
|
};
|
||||||
destination: {
|
}
|
||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
|
||||||
field: 'image',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
|
||||||
...(graph.nodes[
|
|
||||||
CANVAS_COHERENCE_INPAINT_CREATE_MASK
|
|
||||||
] as CreateDenoiseMaskInvocation),
|
|
||||||
image: canvasInitImage,
|
|
||||||
};
|
|
||||||
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
|
||||||
...(graph.nodes[CANVAS_COHERENCE_MASK_EDGE] as MaskEdgeInvocation),
|
|
||||||
image: canvasMaskImage,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
graph.edges.push(
|
graph.edges.push({
|
||||||
{
|
|
||||||
source: {
|
source: {
|
||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
@ -668,18 +698,20 @@ export const buildCanvasSDXLInpaintGraph = (
|
|||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
field: 'mask',
|
field: 'mask',
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plug Denoise Mask To Coherence Denoise Latents
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'denoise_mask',
|
||||||
},
|
},
|
||||||
{
|
destination: {
|
||||||
source: {
|
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
|
||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
field: 'denoise_mask',
|
||||||
field: 'denoise_mask',
|
},
|
||||||
},
|
});
|
||||||
destination: {
|
|
||||||
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
|
|
||||||
field: 'denoise_mask',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Seed
|
// Handle Seed
|
||||||
|
@ -709,16 +709,7 @@ export const buildCanvasSDXLOutpaintGraph = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle Coherence Mode
|
// Handle Coherence Mode
|
||||||
if (canvasCoherenceMode === 'edge') {
|
if (canvasCoherenceMode !== 'unmasked') {
|
||||||
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
|
||||||
type: 'mask_edge',
|
|
||||||
id: CANVAS_COHERENCE_MASK_EDGE,
|
|
||||||
is_intermediate: true,
|
|
||||||
edge_blur: maskBlur,
|
|
||||||
edge_size: maskBlur * 2,
|
|
||||||
low_threshold: 100,
|
|
||||||
high_threshold: 200,
|
|
||||||
};
|
|
||||||
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
graph.nodes[CANVAS_COHERENCE_INPAINT_CREATE_MASK] = {
|
||||||
type: 'create_denoise_mask',
|
type: 'create_denoise_mask',
|
||||||
id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
@ -726,42 +717,82 @@ export const buildCanvasSDXLOutpaintGraph = (
|
|||||||
fp32: vaePrecision === 'fp32' ? true : false,
|
fp32: vaePrecision === 'fp32' ? true : false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isUsingScaledDimensions) {
|
// Handle Image Input For Mask Creation
|
||||||
graph.edges.push({
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: MASK_RESIZE_UP,
|
node_id: INPAINT_INFILL,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
},
|
},
|
||||||
destination: {
|
destination: {
|
||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
graph.edges.push({
|
// Create Mask If Coherence Mode Is Mask
|
||||||
source: {
|
if (canvasCoherenceMode === 'mask') {
|
||||||
node_id: MASK_COMBINE,
|
if (isUsingScaledDimensions) {
|
||||||
field: 'image',
|
graph.edges.push({
|
||||||
},
|
source: {
|
||||||
destination: {
|
node_id: MASK_RESIZE_UP,
|
||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
field: 'image',
|
||||||
field: 'image',
|
},
|
||||||
},
|
destination: {
|
||||||
});
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'mask',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: MASK_COMBINE,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'mask',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
graph.edges.push(
|
if (canvasCoherenceMode === 'edge') {
|
||||||
{
|
graph.nodes[CANVAS_COHERENCE_MASK_EDGE] = {
|
||||||
source: {
|
type: 'mask_edge',
|
||||||
node_id: INPAINT_INFILL,
|
id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
field: 'image',
|
is_intermediate: true,
|
||||||
},
|
edge_blur: maskBlur,
|
||||||
destination: {
|
edge_size: maskBlur * 2,
|
||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
low_threshold: 100,
|
||||||
field: 'image',
|
high_threshold: 200,
|
||||||
},
|
};
|
||||||
},
|
|
||||||
{
|
// Handle Scaled Dimensions For Mask Edge
|
||||||
|
if (isUsingScaledDimensions) {
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: MASK_RESIZE_UP,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: MASK_COMBINE,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
|
field: 'image',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
node_id: CANVAS_COHERENCE_MASK_EDGE,
|
||||||
field: 'image',
|
field: 'image',
|
||||||
@ -770,18 +801,20 @@ export const buildCanvasSDXLOutpaintGraph = (
|
|||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
field: 'mask',
|
field: 'mask',
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plug Denoise Mask To Coherence Denoise Latents
|
||||||
|
graph.edges.push({
|
||||||
|
source: {
|
||||||
|
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
||||||
|
field: 'denoise_mask',
|
||||||
},
|
},
|
||||||
{
|
destination: {
|
||||||
source: {
|
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
|
||||||
node_id: CANVAS_COHERENCE_INPAINT_CREATE_MASK,
|
field: 'denoise_mask',
|
||||||
field: 'denoise_mask',
|
},
|
||||||
},
|
});
|
||||||
destination: {
|
|
||||||
node_id: CANVAS_COHERENCE_DENOISE_LATENTS,
|
|
||||||
field: 'denoise_mask',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Seed
|
// Handle Seed
|
||||||
|
@ -9,8 +9,9 @@ import { memo } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const coherenceModeSelectData: IAISelectDataType[] = [
|
const coherenceModeSelectData: IAISelectDataType[] = [
|
||||||
{ label: 'Full', value: 'full' },
|
{ label: 'Unmasked', value: 'unmasked' },
|
||||||
{ label: 'Edge', value: 'edge' },
|
{ label: 'Mask', value: 'mask' },
|
||||||
|
{ label: 'Mask Edge', value: 'edge' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const ParamCanvasCoherenceMode = () => {
|
const ParamCanvasCoherenceMode = () => {
|
||||||
|
@ -421,7 +421,7 @@ export const isValidMaskBlurMethod = (
|
|||||||
/**
|
/**
|
||||||
* Zod schema for a Canvas Coherence Mode method parameter
|
* Zod schema for a Canvas Coherence Mode method parameter
|
||||||
*/
|
*/
|
||||||
export const zCanvasCoherenceMode = z.enum(['full', 'edge']);
|
export const zCanvasCoherenceMode = z.enum(['unmasked', 'mask', 'edge']);
|
||||||
/**
|
/**
|
||||||
* Type alias for Canvas Coherence Mode parameter, inferred from its zod schema
|
* Type alias for Canvas Coherence Mode parameter, inferred from its zod schema
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user