Steffenhir / GraXpert

GraXpert is an astronomical image processing program for extracting and removing gradients from the background of your astrophotos.
https://www.graxpert.com/
GNU General Public License v3.0
147 stars 16 forks source link

GraXpert-3.0.2: PNG / TIFF exports fail denoise while FITS work #152

Open sophisticatedDreamer opened 2 months ago

sophisticatedDreamer commented 2 months ago

[Linux Ubuntu-22.04.x / Gimp-2.10 / GraXpert-3.0.2]

% ./GraXpert-linux/GraXpert --version
2024-05-17 17:08:31,196 MainProcess root INFO     GraXpert version: 3.0.2 release: Umbriel

A former successfully GraXpert-denoised PNG image was used as a layer in Gimp. After finishing all intended tweaks, I combined the visible layers and exported them into a PNG file.

Because new noise was introduced by another Gimp layer, I curiously fed this PNG to GraXpert again.

1st try - see attached log file _"graxpert.log_1PNG.log": The image loaded fast and fine. I did nothing else but clicking "Bild entrauschen" [Start Denoising]. After some seconds the following error box appeared:

"An error occured during denoising. Please see the log at /home/me/.cache/GraXpert/log/graxpert.log"

2nd try - see attached log file "graxpert.log_2_TIF.log": To narrow the error, I then exported the PNG out of Gimp into a TIFF file. This TIFF file showed the exact behavior and error message in GraXpert as the PNG file did.

3rd try - see attached log file "graxpert.log_3_FIT.log": Finally, I again exported the PNG out of Gimp, but this time into a FITS'' file. Surprise! This FITS file appeard upside down (i.e. vertical mirrored) BUT** the denoising works error free and fine as expected.

Summary: Those two files (PNF, TIFF) that yields the mentioned error both contain the exact same hint:

2024-05-17 17:38:27,116 MainProcess root INFO     Starting denoising
2024-05-17 17:38:28,180 MainProcess root INFO     Available inference providers : ['CUDAExecutionProvider', 'CPUExecutionProvider']
2024-05-17 17:38:28,180 MainProcess root INFO     Used inference providers : ['CPUExecutionProvider']
2024-05-17 17:38:28,182 MainProcess root ERROR    /home/runner/work/GraXpert/GraXpert/graxpert/denoising.py:106: RuntimeWarning: invalid value encountered in divide
2024-05-17 17:38:28,188 MainProcess root ERROR    [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: gen_input_image for the following indices
 index: 3 Got: 4 Expected: 3
 Please fix either the inputs/outputs or the model.
Traceback (most recent call last):
  File "/home/runner/work/GraXpert/GraXpert/graxpert/application/app.py", line 350, in on_denoise_request
  File "/home/runner/work/GraXpert/GraXpert/graxpert/denoising.py", line 118, in denoise
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 220, in run
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: gen_input_image for the following indices
 index: 3 Got: 4 Expected: 3
 Please fix either the inputs/outputs or the model.

So obviously index: 3 Got: 4 Expected: 3 is the culprit. graxpert.log_1_PNG.log graxpert.log_2_TIF.log graxpert.log_3_FIT.log

schmelly commented 2 months ago

Hi, please remove the alpha channel from the .png/.tif before exporting from Gimp / importing into GraXpert. CS, David

Steffenhir commented 2 months ago

Hi, it looks like a transparency or alpha channel was added to your png file in Gimp. When you remove the alpha channel in Gimp and then save it again, it should work in GraXpert.

CS Steffen

sophisticatedDreamer commented 2 months ago

Your support came lightning fast!

Sure, R + G + B + alpha are 4 channels where only 3 channels are expected. Thus alpha must be omitted.

First, I made sure all alpha channels were removed from every layer. Then I mixed them for export but didn't realize another alpha channel was activated for the final image.

After having deleted this channel also, right before the export, everything worked as expected instantly, in GraXpert.

Thank you, Guys!

rnon890 commented 2 months ago

2024-05-18 21:13:18,864 MainProcess root INFO Starting denoising 2024-05-18 21:13:20,755 MainProcess root INFO Available inference providers : ['DmlExecutionProvider', 'CPUExecutionProvider'] 2024-05-18 21:13:20,755 MainProcess root INFO Used inference providers : ['DmlExecutionProvider', 'CPUExecutionProvider'] 2024-05-18 21:13:29,618 MainProcess root ERROR
Traceback (most recent call last): File "D:\a\GraXpert\GraXpert\graxpert\application\app.py", line 350, in on_denoise_request File "D:\a\GraXpert\GraXpert\graxpert\denoising.py", line 118, in denoise File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 220, in run onnxruntime.capi.onnxruntime_pybind11_state.Fail 2024-05-18 21:14:24,846 MainProcess root INFO Starting denoising 2024-05-18 21:14:26,764 MainProcess root INFO Available inference providers : ['DmlExecutionProvider', 'CPUExecutionProvider'] 2024-05-18 21:14:26,764 MainProcess root INFO Used inference providers : ['DmlExecutionProvider', 'CPUExecutionProvider'] 2024-05-18 21:14:34,004 MainProcess root ERROR
Traceback (most recent call last): File "D:\a\GraXpert\GraXpert\graxpert\application\app.py", line 350, in on_denoise_request File "D:\a\GraXpert\GraXpert\graxpert\denoising.py", line 118, in denoise File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 220, in run onnxruntime.capi.onnxruntime_pybind11_state.Fail

Bonjour

Pouvez-vous m'expliquer le probleme ?? Mon image vient de Pixinsight, elle a été délinéarisée puis sauvegarder en .tiff et .jpeg Apres j'ouvre l'image dans Graxpert v3.02, je fais le gradient extraction sans soucis mais j'ai le message d'erreur ci-dessus avec denoise. Merci pour votre aide afin de régler enfin ce probleme.

Steffenhir commented 1 month ago

HI @rnon890, could you try to reduce the batch size to 1?