luoyetx / deep-landmark

Predict facial landmarks with Deep CNNs powered by Caffe.
BSD 3-Clause "New" or "Revised" License
282 stars 156 forks source link

2 questions about data_preprocess #30

Closed zhanpx closed 7 years ago

zhanpx commented 7 years ago

1.Here you use the subbox to expand the boundingbox(not resize the boundingbox), but without changing the relative coordinates. Could you explain that?

f_bbox = bbox.subBBox(-0.05, 1.05, -0.05, 1.05) f_face = img[f_bbox.top:f_bbox.bottom+1,f_bbox.left:f_bbox.right+1]

2.Here you set the bbox's width and height as bbox[1] - bbox[0] and bbox[3] - bbox[2] respectively,that means it doesn't include the last row's or col's of pixels.But in the other codes of images cropping,it includes this.

class BBox(object): """ Bounding Box of face """ def init(self, bbox): self.left = bbox[0] self.right = bbox[1] self.top = bbox[2] self.bottom = bbox[3] self.x = bbox[0] self.y = bbox[2] self.w = bbox[1] - bbox[0] self.h = bbox[3] - bbox[2]

patch = img[patch_top: patch_bottom+1, patch_left: patch_right+1]

f_face = img[f_bbox.top:f_bbox.bottom+1,f_bbox.left:f_bbox.right+1]

Could you help me explain these two problems ,thanks.

luoyetx commented 7 years ago

@zhanpx

  1. this question I already answer in #28

  2. My mistake, the code is messy and I really forget much details about the processing.

I think the subBBox is not necessary. For bbox robust, add data argument on bbox random perturbation should be much efficient (which is not done in this code).

zhanpx commented 7 years ago

Thanks for your reply! I have learned a lot from your codes. @luoyetx