Skip to content

[Bug]: Preprocess images in the "Train" tab crashes when "Auto Focal Point Crop" is selected #11727

Closed
@green-mint

Description

Is there an existing issue for this?

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

What happened?

The preprocessor crashes when detecting faces using the OpenCV library.

Steps to reproduce the problem

  1. Selecting only the "Auto Focal Point Crop" option in the train tab.
  2. Click Preprocess

What should have happened?

The images should have been preprocessed without errors

Version or Commit where the problem happens

1.4.0

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

Nvidia GPUs (GTX 16 below)

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No modification to the bat file or the cli arguments

List of extensions

I have installed sd_dreambooth_extension (manual installation, cloned the repo, installed the packages after activating the venv) but the issue persisted even after disabling the extension.

Console logs

Preprocessing [Image 0/1]:   0%|                                                                 | 0/1 [00:00<?, ?it/s]
*** Error completing request
*** Arguments: ('task(1d2hiirzdek2l1f)', 'C:\\Users\\EternalBhutto\\saad\\imgs', 'C:\\Users\\EternalBhutto\\saad\\imgs-new', 512, 512, 'ignore', False, False, False, False, False, 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 "C:\Users\EternalBhutto\saad\stable-diffusion-webui\modules\call_queue.py", line 55, in f
        res = list(func(*args, **kwargs))
      File "C:\Users\EternalBhutto\saad\stable-diffusion-webui\modules\call_queue.py", line 35, in f
        res = func(*args, **kwargs)
      File "C:\Users\EternalBhutto\saad\stable-diffusion-webui\modules\textual_inversion\ui.py", line 19, in preprocess
        modules.textual_inversion.preprocess.preprocess(*args)
      File "C:\Users\EternalBhutto\saad\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 "C:\Users\EternalBhutto\saad\stable-diffusion-webui\modules\textual_inversion\preprocess.py", line 212, in preprocess_work
        for focal in autocrop.crop_image(img, autocrop_settings):
      File "C:\Users\EternalBhutto\saad\stable-diffusion-webui\modules\textual_inversion\autocrop.py", line 32, in crop_image
        focus = focal_point(im_debug, settings)
      File "C:\Users\EternalBhutto\saad\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 "C:\Users\EternalBhutto\saad\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

No response

Metadata

Assignees

No one assigned

    Labels

    bug-reportReport of a bug, yet to be confirmed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions