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

hello why twice use np.random.rand() > 0.5 in level1 generate_hdf5 .thanks #21

Open
mttsky opened this issue Sep 5, 2016 · 4 comments

Comments

@mttsky
Copy link

mttsky commented Sep 5, 2016

        ### rotation
        if np.random.rand() > 0.5:
            face_rotated_by_alpha, landmark_rotated = rotate(img, f_bbox, \
                bbox.reprojectLandmark(landmarkGt), 5)
            landmark_rotated = bbox.projectLandmark(landmark_rotated)
            face_rotated_by_alpha = cv2.resize(face_rotated_by_alpha, (39, 39))
            F_imgs.append(face_rotated_by_alpha.reshape((1, 39, 39)))
            F_landmarks.append(landmark_rotated.reshape(10))
            ### flip with rotation
            face_flipped, landmark_flipped = flip(face_rotated_by_alpha, landmark_rotated)
            face_flipped = cv2.resize(face_flipped, (39, 39))
            F_imgs.append(face_flipped.reshape((1, 39, 39)))
            F_landmarks.append(landmark_flipped.reshape(10))
        ### rotation
        if np.random.rand() > 0.5:
            face_rotated_by_alpha, landmark_rotated = rotate(img, f_bbox, \
                bbox.reprojectLandmark(landmarkGt), -5)
            landmark_rotated = bbox.projectLandmark(landmark_rotated)
            face_rotated_by_alpha = cv2.resize(face_rotated_by_alpha, (39, 39))
            F_imgs.append(face_rotated_by_alpha.reshape((1, 39, 39)))
            F_landmarks.append(landmark_rotated.reshape(10))
            ### flip with rotation
            face_flipped, landmark_flipped = flip(face_rotated_by_alpha, landmark_rotated)
            face_flipped = cv2.resize(face_flipped, (39, 39))
            F_imgs.append(face_flipped.reshape((1, 39, 39)))
            F_landmarks.append(landmark_flipped.reshape(10))
@luoyetx
Copy link
Owner

luoyetx commented Sep 5, 2016

clockwise rotation and anticlockwise rotation, 0.5 is the possibility to do the rotation.

@mttsky
Copy link
Author

mttsky commented Sep 5, 2016

ok ,thanks, why level2/level3 don't use rotation and flip?

@luoyetx
Copy link
Owner

luoyetx commented Sep 5, 2016

level-2 and level-3 use random shift around the ground truth. rotation and flip can also be applied.

@mttsky
Copy link
Author

mttsky commented Sep 5, 2016

thanks,because random shift ,train data result is different. the test effect has often wrong. of course sometime is goog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants