Open Nolasaurus opened 1 year ago
When I follow the code a little further down the page ...
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth -P weights
python inference_realesrgan.py -n RealESRGAN_x4plus_anime_6B -i inputs
I get this error instead:
python inference_realesrgan.py -n RealESRGAN_x4plus_anime_6B -i inputs
Testing 0 00003
Testing 1 00017_gray
Testing 2 0014
Testing 3 0030
Testing 4 ADE_val_00000114
Testing 5 OST_009
Testing 6 children-alpha
Testing 7 tree_alpha_16bit
Input is a 16-bit image
Testing 8 video
Traceback (most recent call last):
File "/home/nolan/Python/Real-ESRGAN/inference_realesrgan.py", line 166, in <module>
main()
File "/home/nolan/Python/Real-ESRGAN/inference_realesrgan.py", line 138, in main
if len(img.shape) == 3 and img.shape[2] == 4:
AttributeError: 'NoneType' object has no attribute 'shape'
I don't know what the original issue was, but I reinstalled from scratch and it is now working.
Never mind, ran into the same error
I did not have the .pth files in the \Real-ESRGAN directory and now I no longer get the first error, only the one ending in
AttributeError: 'NoneType' object has no attribute 'shape'
I got this error with 00017_gray.png (https://github.com/xinntao/Real-ESRGAN/blob/master/inputs/00017_gray.png)
$ python3 inference_realesrgan.py -n RealESRGAN_x4plus -i inputs --face_enhance
Traceback (most recent call last):
File "/home/ubuntu/Real-ESRGAN/inference_realesrgan.py", line 166, in
I'm getting the same error with the example input file 00017_gray.png
.
It only occurs with png
file extension, and face_enhance
arg.
Python 3.11
Windows OS
I've tried with other models, but failed with the same error RealESRGAN_x4plus | RealESRNet_x4plus | RealESRGAN_x2plus | realesr-general-x4v3
Working well with jpg
file extension.
`Testing 0 00017_gray
Traceback (most recent call last):
File "C:\AI\Real-ESRGAN\inference_realesrgan.py", line 167, in
ValueError: operands could not be broadcast together with shapes (1404,2000,1) (1404,2000)`
img = cv2.imread(path, cv2.IMREAD_COLOR)
input_img = cv2.imread(img_path, cv2.IMREAD_UNCHANGED)
input_img = cv2.imread(img_path, cv2.IMREAD_COLOR)
--face_enhance
. For example:
python inference_realesrgan.py -n RealESRGAN_x4plus -i D:\code\Real-ESRGAN\inputs\00017_gray.png -o D:\code\Real-ESRGAN\inputs\ --face_enhance
I'm getting the same error with the example input file
00017_gray.png
. It only occurs withpng
file extension, andface_enhance
arg.Python 3.11 Windows OS I've tried with other models, but failed with the same error
RealESRGAN_x4plus | RealESRNet_x4plus | RealESRGAN_x2plus | realesr-general-x4v3
Working well with
jpg
file extension.
Testing 0 00017_gray Traceback (most recent call last): File "C:\AI\Real-ESRGAN\inference_realesrgan.py", line 167, in <module> main() File "C:\AI\Real-ESRGAN\inference_realesrgan.py", line 146, in main _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\The Beast\anaconda3\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxx\anaconda3\Lib\site-packages\gfpgan\utils.py", line 145, in enhance restored_img = self.face_helper.paste_faces_to_input_image(upsample_img=bg_img) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxx\anaconda3\Lib\site-packages\facexlib\utils\face_restoration_helper.py", line 355, in paste_faces_to_input_image upsample_img = inv_soft_mask * pasted_face + (1 - inv_soft_mask) * upsample_img ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ ValueError: operands could not be broadcast together with shapes (1404,2000,1) (1404,2000)
I'm getting the same error with the example input file
00017_gray.png
. It only occurs withpng
file extension, andface_enhance
arg.Python 3.11 Windows OS I've tried with other models, but failed with the same error
RealESRGAN_x4plus | RealESRNet_x4plus | RealESRGAN_x2plus | realesr-general-x4v3
Working well with
jpg
file extension.
Testing 0 00017_gray Traceback (most recent call last): File "C:\AI\Real-ESRGAN\inference_realesrgan.py", line 167, in <module> main() File "C:\AI\Real-ESRGAN\inference_realesrgan.py", line 146, in main _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\The Beast\anaconda3\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxx\anaconda3\Lib\site-packages\gfpgan\utils.py", line 145, in enhance restored_img = self.face_helper.paste_faces_to_input_image(upsample_img=bg_img) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxx\anaconda3\Lib\site-packages\facexlib\utils\face_restoration_helper.py", line 355, in paste_faces_to_input_image upsample_img = inv_soft_mask * pasted_face + (1 - inv_soft_mask) * upsample_img ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ ValueError: operands could not be broadcast together with shapes (1404,2000,1) (1404,2000)
See here https://github.com/xinntao/Real-ESRGAN/issues/555#issuecomment-1705470424
I did not have the .pth files in the \Real-ESRGAN directory and now I no longer get the first error, only the one ending in
AttributeError: 'NoneType' object has no attribute 'shape'
Hi,do you find the solution about this issue?
When I follow the code a little further down the page ...
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth -P weights
python inference_realesrgan.py -n RealESRGAN_x4plus_anime_6B -i inputs
I get this error instead:
python inference_realesrgan.py -n RealESRGAN_x4plus_anime_6B -i inputs Testing 0 00003 Testing 1 00017_gray Testing 2 0014 Testing 3 0030 Testing 4 ADE_val_00000114 Testing 5 OST_009 Testing 6 children-alpha Testing 7 tree_alpha_16bit Input is a 16-bit image Testing 8 video Traceback (most recent call last): File "/home/nolan/Python/Real-ESRGAN/inference_realesrgan.py", line 166, in <module> main() File "/home/nolan/Python/Real-ESRGAN/inference_realesrgan.py", line 138, in main if len(img.shape) == 3 and img.shape[2] == 4: AttributeError: 'NoneType' object has no attribute 'shape'
Testing 8 video video is a folder name, not an image file
I'm trying to run Real-ESRGAN with Python 3.10.8 on Ubuntu 22.04.1 through WSL2.
I followed the instructions found here:
When I run the code snippets
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P weights
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs --face_enhance
I get the following error:
error message.txt