mantasu / face-crop-plus

Face aligner and cropper with quality enhancement and attribute parsing
https://mantasu.github.io/face-crop-plus/
MIT License
53 stars 6 forks source link

50% through batch I get this error. #1

Closed pinballelectronica closed 1 year ago

pinballelectronica commented 1 year ago

image = cv2.cvtColor(cv2.imread(path), cv2.COLOR_BGR2RGB) cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

cli argument: (windows)

face-crop-plus -i I:\AI\imgtmp_1024x768\sharpened\AI\1024_1024x768 --output-size 512 512 -d cuda:0 -b 5 --face-factor 0.75 -o I:\AI\imgtmp_1024x768\sharpened\AI\1024_1024x768\faces

4090 cuda 12.1

Wondering if it broke on a 0 byte file it tried to parse or a broken image?

mantasu commented 1 year ago

Yeah, I experienced that too, if the image is corrupted/unreadable, it will give this error. Will fix it in the next release to raise a warning instead.

pinballelectronica commented 1 year ago

I'll pull that- thanks! I ran this through 5K images and about 10% of them have this very trippy Kaleidoscope look- heads coming out of heads and multiple eyes and sometimes just a literal kaleidoscope where I cannot even make out the image- is this something I can remedy or tune out?

Thank you, love this tool!

mantasu commented 1 year ago

Haha, it's because the default padding is set to "reflect". Try changing to "replicate": --padding replicate.

Edit: You may also want to increase detection threshold for more confident face detection, e.g: --det_threshold 0.99

pinballelectronica commented 1 year ago

in other words, rtfm. lol. thanks!

pinballelectronica commented 1 year ago

also great pipeline through captionr for computer vision'y things

mantasu commented 1 year ago

Thanks, yeah the aim is to help with the preprocessing mess that can happen

pinballelectronica commented 1 year ago

I spend equivalent time administrating training sets as I do training them. It's a bummer. The workflows to get going are super critical to lock down so they're automated. even automated from clip/blip/coca/git passes along with face-crop can take two hours+ on a 4090 with ~5K images. not even including upscaling or sharpening!

mantasu commented 1 year ago

True I can imagine, and quality enhancement would triple that! Hopefully we can expect more efficient models in the future 😂