cupscale icon indicating copy to clipboard operation
cupscale copied to clipboard

Index out of bounds error

Open ANVF-Postal opened this issue 3 years ago • 14 comments

Hello! I'm very interested in this project and it looks amazing. Sadly when I load a model in build 22 and attempt to upscale any image, it seems to always give me this error

`An error occured during upscaling:

Index was outside the bounds of the array.

Stack Trace: at Cupscale.UI.MainUIHelper.<UpscaleImage>d__14.MoveNext()`

I'm fairly new at this, so apologies if I've missed something obvious. I just downloaded a model and ran Build22 I've tried CPU only, and GPU, none seem to work. I've also tried this on build 21 and I get the same error.

Thanks in advance!

ANVF-Postal avatar Oct 15 '20 04:10 ANVF-Postal

Please reproduce this and then send me the log (can be viewed in the settings).

Did you install the ESRGAN dependencies?

n00mkrad avatar Oct 15 '20 06:10 n00mkrad

Hey, thanks for the reply. As it turns out, I don't have PyTorch (or OpenCV) installed, and no matter what I can't get it to work. I installed CUDA on my system (Toolkit 10.2 and restarted my pc) and when I run the command from the PyTorch Website I get this error.

pip3 install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html ERROR: Could not find a version that satisfies the requirement torch===1.6.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2) ERROR: No matching distribution found for torch===1.6.0

I have absolutely no idea what's causing this, but when I tried to get one of the whl files directly with pip3 install https://download.pytorch.org/whl/cu102/torch-1.6.0-cp37-cp37m-win_amd64.whl it tells me the whl is not supported on this platform, though it looks like it should be. To top it all off trying to install opencv failes when trying to build the wheel.

My apologies for not being related to the program.

ANVF-Postal avatar Oct 15 '20 23:10 ANVF-Postal

UPDATE: I had multiple python versions installed, and I decided to use 3.7 and uninstall 3.9 and 2.7. I was able to eventually download pytorch, it didn't give me any errors. Now when I open the program and use esrgan-launcher, I can actually drop in an image and upscale. It opens a python window and the progress bar loads. However at the very end, this happens:

Clearing C:\Users\user\AppData\Roaming\Cupscale\preview Clearing C:\Users\user\AppData\Roaming\Cupscale\preview-out Clearing C:\Users\user\AppData\Roaming\Cupscale\clipboard Clearing C:\Users\user\AppData\Roaming\Cupscale\img-in Clearing C:\Users\user\AppData\Roaming\Cupscale\img-out Clearing C:\Users\user\AppData\Roaming\Cupscale\img-out-ncnn Clearing C:\Users\user\AppData\Roaming\Cupscale\loaded-img Clearing C:\Users\user\AppData\Roaming\Cupscale\composition Loading model names from Q:\Program Files\Deep Learning\ESRGAN Cupscale\Superscale 8x ShippedEsrgan Init() exe version string: 7 Installation valid. Selected model 8x_NMKD-Superscale_150000_G - Full path: Q:\Program Files\Deep Learning\ESRGAN Cupscale\Superscale 8x\8x_NMKD-Superscale_150000_G.pth Dropped 1 file(s), files[0] = C:\Users\user\Desktop\Basic_upscale.jpg Clearing C:\Users\user\AppData\Roaming\Cupscale\loaded-img Status changed: Loading image... IOUtils.GetMagickImage: Reading Image from C:\Users\user\Desktop\Basic_upscale.jpg [OK] IOUtils.GetMagickImage: Reading Image from C:\Users\user\Desktop\Basic_upscale.jpg [OK] Converting C:\Users\user\Desktop\Basic_upscale.jpg - Target Format: PngRaw - DeleteSource: False - FillAlpha: True - ExtMode: UseNew - outpath: C:\Users\user\AppData\Roaming\Cupscale\loaded-img\temp.png Writing image to C:\Users\user\AppData\Roaming\Cupscale\loaded-img\temp.png Status changed: Ready. IOUtils.GetImage: Reading Image from C:\Users\user\AppData\Roaming\Cupscale\loaded-img\temp.png [OK] Clearing C:\Users\user\AppData\Roaming\Cupscale\img-in Clearing C:\Users\user\AppData\Roaming\Cupscale\img-out Status changed: Preprocessing... IOUtils.GetMagickImage: Reading Image from C:\Users\user\AppData\Roaming\Cupscale\img-in\Basic_upscale.jpg [OK] Preprocessing C:\Users\user\AppData\Roaming\Cupscale\img-in\Basic_upscale.jpg - Fill Alpha: True ResizeImagePre: Skipped resize because it's set to 100%. Deleting source file: C:\Users\user\AppData\Roaming\Cupscale\img-in\Basic_upscale.jpg Status changed: Starting ESRGAN... Model Arg: --model "Q:\Program Files\Deep Learning\ESRGAN Cupscale\Superscale 8x\8x_NMKD-Superscale_150000_G.pth" CMD: /C cd /D "C:\Users\user\AppData\Roaming\Cupscale\ShippedEsrgan" & python esrlmain.py "C:\Users\user\AppData\Roaming\Cupscale\img-in" "C:\Users\user\AppData\Roaming\Cupscale\img-out" --device cuda --tilesize 512 --noalpha --model "Q:\Program Files\Deep Learning\ESRGAN Cupscale\Superscale 8x\8x_NMKD-Superscale_150000_G.pth" Failed to parse progress from this line: Loading model '8x_NMKD-Superscale_150000_G' Status changed: Processing Tiles - 1% Status changed: Processing Tiles - 2% Status changed: Processing Tiles - 3% Status changed: Processing Tiles - 4% Status changed: Processing Tiles - 5% Status changed: Processing Tiles - 6% Status changed: Processing Tiles - 7% Status changed: Processing Tiles - 8% Status changed: Processing Tiles - 9% Status changed: Processing Tiles - 10% Status changed: Processing Tiles - 11% Status changed: Processing Tiles - 12% Status changed: Processing Tiles - 13% Status changed: Processing Tiles - 14% Status changed: Processing Tiles - 15% Status changed: Processing Tiles - 16% Status changed: Processing Tiles - 17% Status changed: Processing Tiles - 18% Status changed: Processing Tiles - 19% Status changed: Processing Tiles - 20% Status changed: Processing Tiles - 21% Status changed: Processing Tiles - 22% Status changed: Processing Tiles - 23% Status changed: Processing Tiles - 24% Status changed: Processing Tiles - 25% Status changed: Processing Tiles - 26% Status changed: Processing Tiles - 27% Status changed: Processing Tiles - 28% Status changed: Processing Tiles - 29% Status changed: Processing Tiles - 30% Status changed: Processing Tiles - 31% Status changed: Processing Tiles - 32% Status changed: Processing Tiles - 33% Status changed: Processing Tiles - 34% Status changed: Processing Tiles - 35% Status changed: Processing Tiles - 36% Status changed: Processing Tiles - 37% Status changed: Processing Tiles - 38% Status changed: Processing Tiles - 39% Status changed: Processing Tiles - 40% Status changed: Processing Tiles - 41% Status changed: Processing Tiles - 42% Status changed: Processing Tiles - 43% Status changed: Processing Tiles - 44% Status changed: Processing Tiles - 45% Status changed: Processing Tiles - 46% Status changed: Processing Tiles - 47% Status changed: Processing Tiles - 48% Status changed: Processing Tiles - 49% Status changed: Processing Tiles - 50% Status changed: Processing Tiles - 51% Status changed: Processing Tiles - 52% Status changed: Processing Tiles - 53% Status changed: Processing Tiles - 54% Status changed: Processing Tiles - 55% Status changed: Processing Tiles - 56% Status changed: Processing Tiles - 57% Status changed: Processing Tiles - 58% Status changed: Processing Tiles - 59% Status changed: Processing Tiles - 60% Status changed: Processing Tiles - 61% Status changed: Processing Tiles - 62% Status changed: Processing Tiles - 63% Status changed: Processing Tiles - 64% Status changed: Processing Tiles - 65% Status changed: Processing Tiles - 66% Status changed: Processing Tiles - 67% Status changed: Processing Tiles - 68% Status changed: Processing Tiles - 69% Status changed: Processing Tiles - 70% Status changed: Processing Tiles - 71% Status changed: Processing Tiles - 72% Status changed: Processing Tiles - 73% Status changed: Processing Tiles - 74% Status changed: Processing Tiles - 75% Status changed: Processing Tiles - 76% Status changed: Processing Tiles - 77% Status changed: Processing Tiles - 78% Status changed: Processing Tiles - 79% Status changed: Processing Tiles - 80% Status changed: Processing Tiles - 81% Status changed: Processing Tiles - 82% Status changed: Processing Tiles - 83% Status changed: Processing Tiles - 84% Status changed: Processing Tiles - 85% Status changed: Processing Tiles - 86% Status changed: Processing Tiles - 87% Status changed: Processing Tiles - 88% Status changed: Processing Tiles - 89% Status changed: Processing Tiles - 90% Status changed: Processing Tiles - 91% Status changed: Processing Tiles - 92% Status changed: Processing Tiles - 93% Status changed: Processing Tiles - 94% Status changed: Processing Tiles - 95% Status changed: Processing Tiles - 96% Status changed: Processing Tiles - 97% Status changed: Processing Tiles - 98% Status changed: Processing Tiles - 99% Status changed: Processing Tiles - 100% An error occured during upscaling: Index was outside the bounds of the array.

Stack Trace: at Cupscale.UI.MainUIHelper.<UpscaleImage>d__14.MoveNext() Status changed: Cancelled. Status changed: Done - Upscaling took 131.8s

This method does produce an output but it looks bad, perhaps its my settings. For completion sake, here's the output from Joey's ESRGAN Fork

Clearing C:\Users\user\AppData\Roaming\Cupscale\preview Clearing C:\Users\user\AppData\Roaming\Cupscale\preview-out Clearing C:\Users\user\AppData\Roaming\Cupscale\clipboard Clearing C:\Users\user\AppData\Roaming\Cupscale\img-in Clearing C:\Users\user\AppData\Roaming\Cupscale\img-out Clearing C:\Users\user\AppData\Roaming\Cupscale\img-out-ncnn Clearing C:\Users\user\AppData\Roaming\Cupscale\loaded-img Clearing C:\Users\user\AppData\Roaming\Cupscale\composition Loading model names from Q:\Program Files\Deep Learning\ESRGAN Cupscale\Superscale 8x ShippedEsrgan Init() exe version string: 7 Installation valid. Dropped 1 file(s), files[0] = C:\Users\user\Desktop\Basic_upscale.jpg Clearing C:\Users\user\AppData\Roaming\Cupscale\loaded-img Status changed: Loading image... IOUtils.GetMagickImage: Reading Image from C:\Users\user\Desktop\Basic_upscale.jpg [OK] IOUtils.GetMagickImage: Reading Image from C:\Users\user\Desktop\Basic_upscale.jpg [OK] Converting C:\Users\user\Desktop\Basic_upscale.jpg - Target Format: PngRaw - DeleteSource: False - FillAlpha: True - ExtMode: UseNew - outpath: C:\Users\user\AppData\Roaming\Cupscale\loaded-img\temp.png Writing image to C:\Users\user\AppData\Roaming\Cupscale\loaded-img\temp.png Status changed: Ready. IOUtils.GetImage: Reading Image from C:\Users\user\AppData\Roaming\Cupscale\loaded-img\temp.png [OK] Selected model 8x_NMKD-Superscale_150000_G - Full path: Q:\Program Files\Deep Learning\ESRGAN Cupscale\Superscale 8x\8x_NMKD-Superscale_150000_G.pth Clearing C:\Users\user\AppData\Roaming\Cupscale\img-in Clearing C:\Users\user\AppData\Roaming\Cupscale\img-out Status changed: Preprocessing... IOUtils.GetMagickImage: Reading Image from C:\Users\user\AppData\Roaming\Cupscale\img-in\Basic_upscale.jpg [OK] Preprocessing C:\Users\user\AppData\Roaming\Cupscale\img-in\Basic_upscale.jpg - Fill Alpha: True ResizeImagePre: Skipped resize because it's set to 100%. Deleting source file: C:\Users\user\AppData\Roaming\Cupscale\img-in\Basic_upscale.jpg Status changed: Starting ESRGAN... Model Arg: "Q:\Program Files\Deep Learning\ESRGAN Cupscale\Superscale 8x\8x_NMKD-Superscale_150000_G.pth" CMD: /C cd /D "C:\Users\user\AppData\Roaming\Cupscale\ShippedEsrgan" & python upscale.py --input "C:\Users\user\AppData\Roaming\Cupscale\img-in" --output "C:\Users\user\AppData\Roaming\Cupscale\img-out" --tile_size 512 "Q:\Program Files\Deep Learning\ESRGAN Cupscale\Superscale 8x\8x_NMKD-Superscale_150000_G.pth" Status changed: Processing Tiles - 25% An error occured during upscaling: Index was outside the bounds of the array.

Stack Trace: at Cupscale.UI.MainUIHelper.<UpscaleImage>d__14.MoveNext() Status changed: Cancelled. Status changed: Done - Upscaling took 7.8s

ANVF-Postal avatar Oct 16 '20 03:10 ANVF-Postal

Can you try the latest build and enable "Show CMD Windows" in the Debug settings?

This should show you any error that occurs in the ESRGAN python process.

n00mkrad avatar Oct 24 '20 22:10 n00mkrad

An error occured during upscaling: L'index se trouve en dehors des limites du tableau.

Stack Trace: à Cupscale.UI.PreviewUI.<UpscaleImage>d__14.MoveNext()

I am getting the same issue here with all installed correctly Note: I may have multiple version of python installed

axel578 avatar Nov 10 '20 23:11 axel578

I'm also receiving this error: An error occured during upscaling: Index was outside the bounds of the array.

Stack Trace: at Cupscale.UI.PreviewUI.<UpscaleImage>d__14.MoveNext()

This is with all dependencies satisfied.

nefty1029 avatar Dec 20 '20 06:12 nefty1029

Here is my log: Arg: C:\Users\nefty1029\Downloads\Cupscale.exe [Installer] Initializing - Exe Files Version is 14. [Installer] Installation is valid. [IOUtils] Copying directory "C:\Users\nefty1029\AppData\Roaming\Cupscale\ShippedEsrgan\utils" to "C:\Users\nefty1029\AppData\Roaming\Cupscale\ShippedEsrgan\py\utils" (Move: False - RemoveFromName: ) [DepCheck] Refreshing... [DepCheck] Found GPU: AMD Radeon(TM) Graphics [DepCheck] Skipping refresh - Only 50ms have passed since last refresh! [DepCheck] GPU Name: GTX 1660 Ti with Max-Q Design [DepCheck] CMD: /C python -V [DepCheck] System Python Check Output: Python 3.8.6 [DepCheck] Sys Python Ver: Python 3.8.6 [DepCheck] CMD: /C "C:\Users\nefty1029\AppData\Roaming\Cupscale\ShippedEsrgan\py\python.exe" -V [DepCheck] Embed Python Check Output: Python 3.8.5 [DepCheck] Embed Python Ver: Python 3.8.5 [DepCheck] CMD: "/C" "C:\Users\nefty1029\AppData\Roaming\Cupscale\ShippedEsrgan\py\python.exe" -c "import torch; print(torch.version)" [DepCheck] Pytorch Check Output: 1.6.0 [DepCheck] CMD: "/C" "C:\Users\nefty1029\AppData\Roaming\Cupscale\ShippedEsrgan\py\python.exe" -c "import cv2; print(cv2.version)" [DepCheck] CV2 Check Output: 4.3.0 [MainUI] Dropped 1 file(s), files[0] = C:\Users\nefty1029\OneDrive\Pictures\olz25dvvd5661.jpg [ImgProc] Converting C:\Users\nefty1029\OneDrive\Pictures\olz25dvvd5661.jpg to PngRaw, DelSrc: False, Fill: True, Ext: UseNew [ImgProc] Color depth of olz25dvvd5661.jpg is 24. [ImgProc] Written image to C:\Users\nefty1029\AppData\Roaming\Cupscale\loaded-img\temp.png [ImgProc] Preprocessing C:\Users\nefty1029\AppData\Roaming\Cupscale\img-in\olz25dvvd5661.jpg - Fill Alpha: True [ImgProc] Color depth of olz25dvvd5661.jpg is 24. [CMD] /K cd /D "C:\Users\nefty1029\AppData\Roaming\Cupscale\ShippedEsrgan" & "C:\Users\nefty1029\AppData\Roaming\Cupscale\ShippedEsrgan\py\python.exe" upscale.py --input "C:\Users\nefty1029\AppData\Roaming\Cupscale\img-in" --output "C:\Users\nefty1029\AppData\Roaming\Cupscale\img-out" --seamless --alpha_mode 0 "C:\Cupscale\Models\1x_DeJpeg_Fatality_PlusULTRA_200000_G.pth" An error occured during upscaling: Index was outside the bounds of the array.

Stack Trace: at Cupscale.UI.PreviewUI.<UpscaleImage>d__14.MoveNext()

EDIT: The error still exist after a clean reinstall of the program.

nefty1029 avatar Dec 20 '20 06:12 nefty1029

Tried batch upscaling pictures, still same problem. Upscaling Videos however worked successfully. Maybe there is a problem in saving upscaled pictures but not videos?

nefty1029 avatar Dec 23 '20 14:12 nefty1029

Turned out that I have an older version of the program. Just updated to the latest version of the program. I deleted the Cupscale folder found in \AppData\Roaming. Reinstalled the Cupscale dependencies and now everything is working properly again.

nefty1029 avatar Dec 27 '20 06:12 nefty1029

I am getting the same error:

First, it shows this dialog:

image

And then this error gets copied to the clipboard:

Error during FilenamePostprocess(): 

File name cannot be null.
Parameter name: sourceFileName

Stack Trace:
   at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
   at Cupscale.Main.Upscale.FilenamePostprocess(String file)

Full debug session log: https://paste.ee/p/XjLoI

ilovefreesw avatar Sep 18 '21 04:09 ilovefreesw

I am getting the same error:

First, it shows this dialog:

image

And then this error gets copied to the clipboard:

Error during FilenamePostprocess(): 

File name cannot be null.
Parameter name: sourceFileName

Stack Trace:
   at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
   at Cupscale.Main.Upscale.FilenamePostprocess(String file)

Full debug session log: https://paste.ee/p/XjLoI

Your GPU is far too old for upscaling.

n00mkrad avatar Sep 18 '21 12:09 n00mkrad

Oh okay. I used the CPU instead and it worked.

ilovefreesw avatar Sep 20 '21 03:09 ilovefreesw

I have this exact same issue, where it's fixed by using the cpu mode...


EDIT: It's because I don't have an Nvidia GPU. I should have known!

dillfrescott avatar Oct 16 '21 03:10 dillfrescott

I know this is an old PR, but I am having this exact issue with an RTX 3050... It's not an old card thing then. Edit: Forgot to install PyTorch with CUDA support, dumb mistake

ralmachado avatar Mar 20 '22 12:03 ralmachado