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

current yolo logic is not working for 8.0.122 #787

Closed
serengil opened this issue Jun 26, 2023 · 3 comments
Closed

current yolo logic is not working for 8.0.122 #787

serengil opened this issue Jun 26, 2023 · 3 comments
Labels
dependencies Pull requests that update a dependency file

Comments

@serengil
Copy link
Owner

Laird Foret raised this issue. He is using yolov8 with exact version '8.0.122'

Current code block:

        if align:
            # Extract landmarks
            left_eye, right_eye, _, _, _ = result.keypoints.tolist()
            # Check the landmarks confidence before alignment
            if (left_eye[2] > LANDMARKS_CONFIDENCE_THRESHOLD and
                    right_eye[2] > LANDMARKS_CONFIDENCE_THRESHOLD):
                detected_face = FaceDetector.alignment_procedure(
                    detected_face, left_eye[:2], right_eye[:2]
                )

He mentioned this should be used not to get any exception.

        if align:
            # Extract landmarks
            keypoints_xy = result.keypoints.xy  # Extract the keypoints coordinates
            keypoints_conf = result.keypoints.conf  # Extract the confidence values for keypoints
            left_eye = (keypoints_xy[0][0], keypoints_conf[0][0])  # Tuple of x,y and confidence for left eye
            right_eye = (keypoints_xy[0][1], keypoints_conf[0][1])  # Tuple of x,y and confidence for right eye

            # Check the landmarks confidence before alignment
            if (left_eye[1] > LANDMARKS_CONFIDENCE_THRESHOLD and
                    right_eye[1] > LANDMARKS_CONFIDENCE_THRESHOLD):
                detected_face = FaceDetector.alignment_procedure(
                    detected_face, left_eye[0].cpu(), right_eye[0].cpu()
                )

@Vincent-Stragier you may have a comment. Besides, why we used specific github version instead of pip install ultralytics

@serengil serengil added the dependencies Pull requests that update a dependency file label Jun 26, 2023
@Vincent-Stragier
Copy link
Contributor

Hello,

I suppose there are some differences between the data structures used in the different version. I personally think it would be better to migrate to the original Ultralytics source. However, I'd simplified the changes a bit:

        if align:
            # Tuple of x, y and confidence for left eye
            left_eye = result.keypoints.xy[0][0], result.keypoints.conf[0][0]
            # Tuple of x, y and confidence for right eye
            right_eye = result.keypoints.xy[0][1], result.keypoints.conf[0][1]

            # Check the landmarks confidence before alignment
            if (left_eye[1] > LANDMARKS_CONFIDENCE_THRESHOLD and
                    right_eye[1] > LANDMARKS_CONFIDENCE_THRESHOLD):
                detected_face = FaceDetector.alignment_procedure(
                    detected_face, left_eye[0].cpu(), right_eye[0].cpu()
                )

It is slightly faster.

@serengil
Copy link
Owner Author

would you please create a PR for this?

@serengil serengil changed the title yolo current yolo logic is not working for 8.0.122 Jun 28, 2023
@Vincent-Stragier
Copy link
Contributor

#790 should do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants