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

error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize' 如何解决 #48

Open
mambasmile opened this issue Oct 19, 2022 · 3 comments

Comments

@mambasmile
Copy link

Traceback (most recent call last):
File "create_virtual_human.py", line 13, in
cvh = FOM(GAN_Config['FOM_INPUT_IMAGE'],GAN_Config['FOM_DRIVING_VIDEO'],GAN_Config['FOM_OUTPUT_VIDEO'])
File "E:\python_project\PaddleBoBo\PaddleTools\GAN.py", line 23, in FOM
first_order_predictor.run(source_image, driving_video)
File "C:\Users\13277.conda\envs\virtual_human\lib\site-packages\ppgan\apps\first_order_predictor.py", line 190, in run
face_image = cv2.resize(face_image, (self.image_size, self.image_size)) / 255.0
cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\resize.cpp:4052: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

@mikemelon
Copy link

同问

@wucheng-dev
Copy link

同问,题主最后怎么解决的

@iamfoolberg
Copy link

vi /usr/local/python3.7.0/lib/python3.7/site-packages/ppgan/apps/first_order_predictor.py

        #driving_video = [
        #    cv2.resize(frame, (self.image_size, self.image_size)) / 255.0 for frame in driving_video
        #]
        driving_video2 = []
        for frame in driving_video:
            try:
                k = cv2.resize(frame, (self.image_size, self.image_size)) / 255.0
                driving_video2.append(k)
            except:
                print("@")
                continue
        driving_video = driving_video2
...
        for rec in bboxes:
            face_image = source_image.copy()[rec[1]:rec[3], rec[0]:rec[2]]
            try:
                face_image = cv2.resize(face_image, (self.image_size, self.image_size)) / 255.0
            except:
                continue
            predictions = get_prediction(face_image)

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