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

[Bug]: auto focal point crop only work under opencv-python<4.8 #14118

Closed
1 task done
vantang opened this issue Nov 27, 2023 · 1 comment · Fixed by #14121
Closed
1 task done

[Bug]: auto focal point crop only work under opencv-python<4.8 #14118

vantang opened this issue Nov 27, 2023 · 1 comment · Fixed by #14121
Labels
bug Report of a confirmed bug

Comments

@vantang
Copy link

vantang commented Nov 27, 2023

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

retrun errors

Steps to reproduce the problem

image

What should have happened?

report error

*** Error completing request
*** Arguments: ('task(r4izcoape5o55pt)', 'D:\\IMGPrep\\muci-mix', 'D:\\IMGPrep\\muci-crop', 1024, 1024, 'ignore', False, False, False, False, True, 0.5, 0.2, True, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1) {}
    Traceback (most recent call last):
      File "D:\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "D:\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "D:\stable-diffusion-webui\modules\textual_inversion\ui.py", line 19, in preprocess
        modules.textual_inversion.preprocess.preprocess(*args)
      File "D:\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 18, in preprocess
        preprocess_work(process_src, process_dst, process_width, process_height, preprocess_txt_action, process_keep_original_size, process_flip, process_split, process_caption, process_caption_deepbooru, split_threshold, overlap_ratio, process_focal_crop, process_focal_crop_face_weight, process_focal_crop_entropy_weight, process_focal_crop_edges_weight, process_focal_crop_debug, process_multicrop, process_multicrop_mindim, process_multicrop_maxdim, process_multicrop_minarea, process_multicrop_maxarea, process_multicrop_objective, process_multicrop_threshold)
      File "D:\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 212, in preprocess_work
        for focal in autocrop.crop_image(img, autocrop_settings):
      File "D:\stable-diffusion-webui\modules\textual_inversion\autocrop.py", line 32, in crop_image
        focus = focal_point(im_debug, settings)
      File "D:\stable-diffusion-webui\modules\textual_inversion\autocrop.py", line 75, in focal_point
        face_points = image_face_points(im, settings) if settings.face_points_weight > 0 else []
      File "D:\stable-diffusion-webui\modules\textual_inversion\autocrop.py", line 150, in image_face_points
        faces = detector.detect(np.array(im))
    cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\net_impl.cpp:279: error: (-204:Requested object was not found) Layer with requested id=-1 not found in function 'cv::dnn::dnn4_v20230620::Net::Impl::getLayerData'

Sysinfo

the key point is opencv-python must under 4.8, for example opencv-python==4.7.0.72 works fine

What browsers do you use to access the UI ?

Google Chrome

Console logs

report error

*** Error completing request
*** Arguments: ('task(r4izcoape5o55pt)', 'D:\\IMGPrep\\muci-mix', 'D:\\IMGPrep\\muci-crop', 1024, 1024, 'ignore', False, False, False, False, True, 0.5, 0.2, True, 0.9, 0.15, 0.5, False, False, 384, 768, 4096, 409600, 'Maximize area', 0.1) {}
    Traceback (most recent call last):
      File "D:\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "D:\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "D:\stable-diffusion-webui\modules\textual_inversion\ui.py", line 19, in preprocess
        modules.textual_inversion.preprocess.preprocess(*args)
      File "D:\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 18, in preprocess
        preprocess_work(process_src, process_dst, process_width, process_height, preprocess_txt_action, process_keep_original_size, process_flip, process_split, process_caption, process_caption_deepbooru, split_threshold, overlap_ratio, process_focal_crop, process_focal_crop_face_weight, process_focal_crop_entropy_weight, process_focal_crop_edges_weight, process_focal_crop_debug, process_multicrop, process_multicrop_mindim, process_multicrop_maxdim, process_multicrop_minarea, process_multicrop_maxarea, process_multicrop_objective, process_multicrop_threshold)
      File "D:\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 212, in preprocess_work
        for focal in autocrop.crop_image(img, autocrop_settings):
      File "D:\stable-diffusion-webui\modules\textual_inversion\autocrop.py", line 32, in crop_image
        focus = focal_point(im_debug, settings)
      File "D:\stable-diffusion-webui\modules\textual_inversion\autocrop.py", line 75, in focal_point
        face_points = image_face_points(im, settings) if settings.face_points_weight > 0 else []
      File "D:\stable-diffusion-webui\modules\textual_inversion\autocrop.py", line 150, in image_face_points
        faces = detector.detect(np.array(im))
    cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\net_impl.cpp:279: error: (-204:Requested object was not found) Layer with requested id=-1 not found in function 'cv::dnn::dnn4_v20230620::Net::Impl::getLayerData'


### Additional information

but some of the extensions requirements.txt set opencv-python>=4.8, for example control net....
@vantang vantang added the bug-report Report of a bug, yet to be confirmed label Nov 27, 2023
@w-e-w w-e-w added the bug Report of a confirmed bug label Nov 27, 2023
@w-e-w
Copy link
Collaborator

w-e-w commented Nov 27, 2023

Fix PR #14121

@w-e-w w-e-w linked a pull request Nov 27, 2023 that will close this issue
4 tasks
@catboxanon catboxanon removed the bug-report Report of a bug, yet to be confirmed label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report of a confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants