InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: Noise threshold is not restored from saved images in the GUI

Open JPPhoto opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS

Linux

GPU

cuda

VRAM

12GB

What happened?

When using the GUI, using all parameters from an existing InvokeAI image whose noise threshold is zero does not restore that noise threshold back to 0. This can be duplicated by opening the GUI, changing Noise Threshold to some amount, selecting an image, and pressing the Use All (A) button (or right-clicking on an image in the gallery and selecting Use All Parameters).

Screenshots

No response

Additional context

I think the following should fix it:

$ git diff
diff --git a/frontend/src/features/options/store/optionsSlice.ts b/frontend/src/features/options/store/optionsSlice.ts
index 65b68586..012da05d 100644
--- a/frontend/src/features/options/store/optionsSlice.ts
+++ b/frontend/src/features/options/store/optionsSlice.ts
@@ -304,8 +304,11 @@ export const optionsSlice = createSlice({
       if (sampler) state.sampler = sampler;
       if (steps) state.steps = steps;
       if (cfg_scale) state.cfgScale = cfg_scale;
-      if (threshold) state.threshold = threshold;
-      if (typeof threshold === 'undefined') state.threshold = 0;
+      if (typeof threshold === 'undefined') {
+        state.threshold = 0;
+      } else {
+        state.threshold = threshold;
+      }
       if (perlin) state.perlin = perlin;
       if (typeof perlin === 'undefined') state.perlin = 0;
       if (typeof seamless === 'boolean') state.seamless = seamless;

Contact Details

No response

JPPhoto avatar Dec 17 '22 15:12 JPPhoto

Doesn't if (var) result in false if var is set and is 0? We should probably use the typeof logic for every parameter.

JPPhoto avatar Dec 17 '22 15:12 JPPhoto

Just a note this still happens with Noise Threshold and Perlin Noise in the current rc6 from github. If either of these are non-zero in the GUI and all attributes are subsequently loaded from another image where these values are zero, the values in the GUI will not be set to zero as they should.

A couple of test images, both recently generated with 2.3.0-rc6. One with noise and another that's the same except perlin and threshold are zero.

  • loading the first "with-noise" image will be fine and threshold and perlin will be non-zero in the GUI.
  • loading the second "without-noise" image should set those values to zero but it does not; they remain.

with-noise: with-noise

without-noise: without-noise

forsaoss avatar Feb 08 '23 20:02 forsaoss

Those changes were merged in. I wonder if the metadata is making it into the files. I'll ping some of the frontend devs.

JPPhoto avatar Feb 08 '23 23:02 JPPhoto

Those changes were merged in. I wonder if the metadata is making it into the files. I'll ping some of the frontend devs.

Yep I saw that, thank you, though it doesn't seem to have an effect as described previously. I'm using chrome 110 on macOS (M1 Max Studio) installed from git cleanly fwiw.

forsaoss avatar Feb 09 '23 19:02 forsaoss

Hi @n4phth4

We've fixed the bug, the fix will be in v2.3.0.

psychedelicious avatar Feb 09 '23 19:02 psychedelicious