Fix auto focal point crop for opencv >= 4.8 #14121
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
#14118 [Bug]: auto focal point crop only work under opencv-python<4.8
#11727 [Bug]: Preprocess images in the "Train" tab crashes when "Auto Focal Point Crop" is selected
face detection model was updated in opencv 4.8+
face_detection_yunet_2022mar
->face_detection_yunet_2023mar
opencv/opencv_zoo@f12e127
this PR
if opencv >= 4.8 downlaod the 2023 ver else 2022 ver
the 2023 version will use the filename
face_detection_yunet_2023mar.onnx
where the 2022 version use the same filename as before
face_detection_yunet.onnx
to avoid redownloadfor unknow reason
autocrop.py
used a mix of indent 2 and 4, I performed a re-format of the file