microsoft / Bringing-Old-Photos-Back-to-Life

Bringing Old Photo Back to Life (CVPR 2020 oral)
https://arxiv.org/abs/2004.09484
MIT License
15.09k stars 1.99k forks source link

Cannot cast ufunc 'multiply' output from dtype('float64') to dtype('uint8') with casting rule 'same_kind' #231

Open pyrator opened 2 years ago

pyrator commented 2 years ago

Running run.py with parameters --with_scratch --HR --GPU 0 on Windows 11, Python 3.9, numpy 1.22.4 gives Traceback (most recent call last): File "D:\Users\theke\python projects\BringingOldPicturesBackToLife\Bringing-Old-Photos-Back-to-Life\Face_Detection\align_warp_back_multiple_dlib_HR.py", line 428, in blended = blur_blending_cv2(warped_back, blended, backward_mask) File "D:\Users\theke\python projects\BringingOldPicturesBackToLife\Bringing-Old-Photos-Back-to-Life\Face_Detection\align_warp_back_multiple_dlib_HR.py", line 219, in blur_blending_cv2 mask *= 255.0 numpy.core._exceptions.UFuncTypeError: Cannot cast ufunc 'multiply' output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'

Fix is to change line 219 in def blur_blending_cv2(im1, im2, mask): from mask = 255.0 to mask = (mask 255.0)

urbanscribe commented 1 year ago

yup have the same problem at step 4

Running Stage 4: Blending Traceback (most recent call last): File "/home/alex/github/Bringing-Old-Photos-Back-to-Life/Face_Detection/align_warp_back_multiple_dlib.py", line 428, in blended = blur_blending_cv2(warped_back, blended, backward_mask) File "/home/alex/github/Bringing-Old-Photos-Back-to-Life/Face_Detection/align_warp_back_multiple_dlib.py", line 219, in blur_blending_cv2 mask *= 255.0 numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'multiply' output from dtype('float64') to dtype('uint8') with casting rule 'same_kind' Finish Stage 4 ...

Anshu1882000 commented 1 year ago

same error, did anyone have any solution to this ?

pyrator commented 1 year ago

Yeah check the last line of my original message. It says which line to change and what to change it to.

On Mon, 15 May 2023, 08:32 Anshu1882000, @.***> wrote:

same error, did anyone have any solution to this ?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life/issues/231#issuecomment-1547333178, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUZPLGG6Z3MRZPLLCI7E7TXGHLYPANCNFSM5WTLLGPQ . You are receiving this because you authored the thread.Message ID: @.*** com>

Mgzchengzi commented 10 months ago

https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life/issues/214