Bringing-Old-Photos-Back-to-Life icon indicating copy to clipboard operation
Bringing-Old-Photos-Back-to-Life copied to clipboard

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

Open pyrator opened this issue 2 years ago • 4 comments

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)

pyrator avatar May 22 '22 12:05 pyrator

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 ...

urbanscribe avatar Mar 23 '23 20:03 urbanscribe

same error, did anyone have any solution to this ?

Anshu1882000 avatar May 15 '23 07:05 Anshu1882000

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>

pyrator avatar May 16 '23 06:05 pyrator

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

Mgzchengzi avatar Jan 03 '24 09:01 Mgzchengzi