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

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

Open
tang2087 opened this issue Dec 31, 2021 · 4 comments

Comments

@tang2087
Copy link

tang2087 commented Dec 31, 2021

When I run this library on Windows 10, it throws out the following error:

Running Stage 4: Blending
Traceback (most recent call last):
File "align_warp_back_multiple_dlib.py", line 428, in
blended = blur_blending_cv2(warped_back, blended, backward_mask)
File "align_warp_back_multiple_dlib.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'
Finish Stage 4 ...

Environment details:

  • System: Windows 10
  • Python: 3.8 (via Anaconda)
  • PyTorch installed with this command: conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
  • Numpy version:
conda list numpy
# packages in environment at D:\conda\envs\py38:
#
# Name                    Version                   Build  Channel
numpy                     1.21.2           py38hfca59bb_0
numpy-base                1.21.2           py38h0829f74_0
  • OpenCV version:
conda list opencv
# packages in environment at D:\conda\envs\py38:
#
# Name                    Version                   Build  Channel
libopencv                 4.0.1                hbb9e17c_0
opencv                    4.0.1            py38h2a7c758_0
opencv-python             4.5.5.62                 pypi_0    pypi
py-opencv                 4.0.1            py38he44ac1e_0
@ruanqizhen
Copy link

ruanqizhen commented Jan 2, 2022

I got the same error, on Linux.

@ruanqizhen
Copy link

requested a fix: #217

jensanjo added a commit to jensanjo/Bringing-Old-Photos-Back-to-Life that referenced this issue Jan 18, 2022
@sdahyk
Copy link

sdahyk commented Sep 29, 2022

Edit file "align_warp_back_multiple_dlib.py", line 219, change from
mask *= 255.0 to mask = (mask*255.0)

this will solve the problem.

@stus3y
Copy link

stus3y commented Mar 19, 2023

Edit file "align_warp_back_multiple_dlib.py", line 219, change from mask = 255.0 to mask = (mask255.0)

this will solve the problem.

It works. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants