Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Conversion fails on Grayscale (PseudoClass Gray) JPEGs #192

Closed
3 tasks done
MarcG2 opened this issue Sep 26, 2023 · 4 comments · Fixed by #299
Closed
3 tasks done

[Bug] Conversion fails on Grayscale (PseudoClass Gray) JPEGs #192

MarcG2 opened this issue Sep 26, 2023 · 4 comments · Fixed by #299
Labels
bug Something isn't working

Comments

@MarcG2
Copy link

MarcG2 commented Sep 26, 2023

Please carefully review each item in the checklist below | 请认真检查以下清单中的每一项 | 以下のチェックリストの各項目を注意深く確認してください

  • Searched and didn't find a similar issue | 已经搜索过,没有发现类似issue | 類似の問題が見つかりませんでした
  • Searched documentation and didn't find relevant content | 已经搜索过文档,没有发现相关内容 | ドキュメントを検索して関連する内容が見つかりませんでした
  • Tried with the latest version and the issue still exists | 已经尝试使用过最新版,问题依旧存在 | 最新バージョンを試しましたが問題は解消されませんでした

Software Version | 软件版本 | ソフトウェアバージョン

1.1.5

Operating System | 操作系统 | オペレーティングシステム

Windows x64

System Version | 系统版本 | システムバージョン

Windows 10

Describe the bug | 描述错误 | BUGの説明

Final2x conversions seems to always fail if inputting a grayscale JPEGs. ImageMagick identifies them as being "PseudoClass Gray".

To reproduce | 复现步骤 | 再現方法

I've uploaded an example of a grayscale image that won't convert.

Claymore v1-001

Error log | 报错日志 | ログ

Log
[{"label":"CPU: Core™ i7-8750H","value":-1},{"label":"GPU 0: NVIDIA GeForce GTX 1070","value":0},{"label":"GPU: Auto","value":114514}]
{"gpuid":0,"inputpath":["D:\_Junk\_Cache\test\Claymore v1-001.jpg"],"model":"Waifu2x-cunet","modelscale":2,"modelnoise":0,"outputpath":"D:\_Junk\_Cache\test","targetscale":2,"tta":false}
2023-09-25 20:33:22.697 | INFO | main:main:58 - projectPATH: C:\Users\mpgri\Downloads\Final2x-windows-x64-unpacked\resources\app\resources\Final2x-core
2023-09-25 20:33:22.698 | INFO | main:main:71 - config loaded
2023-09-25 20:33:22.698 | INFO | src.SRFactory.SRBaseClass:_set_sr_n:53 - sr_n set to 1
2023-09-25 20:33:22.698 | INFO | src.SRFactory.SRBaseClass:init:35 - SRBaseClass init
[0 NVIDIA GeForce GTX 1070] queueC=2[8] queueG=0[16] queueT=1[2]
[0 NVIDIA GeForce GTX 1070] bugsbn1=0 bugbilz=0 bugcopc=0 bugihfa=0
[0 NVIDIA GeForce GTX 1070] fp16-p/s/a=1/1/0 int8-p/s/a=1/1/1
[0 NVIDIA GeForce GTX 1070] subgroup=32 basic=1 vote=1 ballot=1 shuffle=1
2023-09-25 20:33:23.450 | INFO | src.SRFactory.WAIFU2X:_init_SR_class:74 - Waifu2x model initialized
2023-09-25 20:33:23.451 | INFO | src.SRqueue:SR_queue:25 - Processing------[ 0.0% ]
2023-09-25 20:33:23.473 | ERROR | src.SRqueue:SR_queue:67 - tuple index out of range
2023-09-25 20:33:23.473 | WARNING | src.SRqueue:SR_queue:68 - CV2 load image failed: D:_Junk_Cache\test\Claymore v1-001.jpg, skip.
2023-09-25 20:33:23.473 | WARNING | src.SRqueue:SR_queue:69 - Skip_Image: D:_Junk_Cache\test\Claymore v1-001.jpg
2023-09-25 20:33:23.474 | INFO | src.utils.progressLog:printProgress:34 - Processing------[ 100.0% ]
2023-09-25 20:33:23.479 | SUCCESS | main:main:81 - SR_COMPLETED
CLOSE CODE:3221226505

Additional context | 附加内容 | 追加コンテキスト

No response

@MarcG2 MarcG2 added the bug Something isn't working label Sep 26, 2023
@Tohrusky
Copy link
Owner

Tohrusky commented Sep 26, 2023

At present, we can only convert it to rgb/rgba and then process it.

in https://github.com/Tohrusky/Final2x-core/blob/main/src/SRqueue.py#L59 I use this to compatible with special characters
img = cv2.imdecode(np.fromfile(img_path, dtype=np.uint8), cv2.IMREAD_UNCHANGED)

but cv.imread can load a grayscale image directly into 3 channels, when img is None, try to use it may work…
And the output of the neural network is in rgb. Wanna convert it back to grayscale?

@MarcG2
Copy link
Author

MarcG2 commented Sep 26, 2023

I'm not sure I understand your comment. For reference, I use Final2x-core with the compiled Windows EXE.

I understand that the upscalers are intended for sRGB. So it's fine with me if the 1-channel grayscale images have to first be converted to RGB.

Having a built-in option for converting the final output back to 1-channel grayscale would be nice. Though I don't require it because I convert the upscaled images to JPEG afterwards.

@lclrc
Copy link

lclrc commented Dec 18, 2023

having the same problem. is there any solutions?

@Tohrusky
Copy link
Owner

having the same problem. is there any solutions?

I'll fix it in a few days

Tohrusky added a commit that referenced this issue Jan 2, 2024
- Bug Fix #192
- Full CPU support
- Remove SRMD
- CI update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants