wangzhuo2019 / SSAN

Domain Generalization via Shuffled Style Assembly for Face Anti-Spoofing, CVPR2022.
MIT License
93 stars 22 forks source link

about the data preprocess of oulu #13

Open lexuszhi1990 opened 1 year ago

lexuszhi1990 commented 1 year ago

hi, according to the code and papers, I have a question for OULUNPU dataset in preprocess, it seems that crop_face_from_scene function only works on full image without cropping face in image?

https://github.com/wangzhuo2019/SSAN/blob/main/datasets/Load_OULUNPU_train.py#L14

def crop_face_from_scene(image, scale):
    y1,x1,w,h = 0, 0, image.shape[1], image.shape[0]
    y2=y1+w
    x2=x1+h
    y_mid=(y1+y2)/2.0
    x_mid=(x1+x2)/2.0
    w_scale=scale/1.5*w
    h_scale=scale/1.5*h
    h_img, w_img = image.shape[0], image.shape[1]
    y1=y_mid-w_scale/2.0
    x1=x_mid-h_scale/2.0
    y2=y_mid+w_scale/2.0
    x2=x_mid+h_scale/2.0
    y1=max(math.floor(y1),0)
    x1=max(math.floor(x1),0)
    y2=min(math.floor(y2),w_img)
    x2=min(math.floor(x2),h_img)
    region=image[x1:x2,y1:y2]
    return region