Skip to content

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

Description

@mttsky
        ### 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))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions