sfd.pytorch icon indicating copy to clipboard operation
sfd.pytorch copied to clipboard

dataset adapter

Open ahkarami opened this issue 7 years ago • 3 comments

Dear @louis-she & @pengbo0054, In https://github.com/louis-she/sfd.pytorch/blob/3f62b17660c01013da80cf9019ab6ec9f5a172a9/dataset.py#L97-L100, you multiply height scale to x[0] & x[2] and width scale to x[1] & x[3]. However, in the readme of Wider-Face data set mentioned that

The format of txt ground truth is as follows: 
File name
Number of bounding box
x1, y1, w, h, blur, expression, illumination, invalid, occlusion, pos

I mean that, I guess a mistake occur in this part of code. Maybe you should change the dataset.py as follows:

        # scale coordinate
        height, width = image.shape[:2]
        width_scale, height_scale = 640.0 / width, 640.0 / height
        coordinates = np.array(list(map(lambda x: [
            x[0] * width_scale,  # Change this part
            x[1] * height_scale,  # Change this part
            x[2] * width_scale,  # Change this part
            x[3] * height_scale  # Change this part
], coordinates)))

Am I correct?

Just as another note. I suggest that you add a general ListDataset class instead of specific data sets (e.g., Wider-Face, Pascal VOC, etc.). For example the ListDataset class can use data set annotations as follows:

Load image/labels/boxes from a list file (e.g., *.txt file).
The list file is like:
a.jpg xmin ymin xmax ymax label xmin ymin xmax ymax label ...

Thank you

ahkarami avatar Jul 14 '18 06:07 ahkarami

Hi @ahkarami , The coordinates have been converted to top left bottom right at here. And a more flexible and general Dataset class is considered. We already supported VOC dataset and now we're training on it. If it works, we will refactor dataset.py to adapt for other dataset too.

louis-she avatar Jul 14 '18 07:07 louis-she

@louis-she, Thank you for your response. Please note that about training on VOC dataset in this state, I think because the aspect_ratio is 1:1 and data augmentation methods don't implement yet, so the obtained result maybe will not be good. I'll try to help you in near future (I try to find free time for it) via some pull requests, to further strengthen your codes. Good luck

ahkarami avatar Jul 14 '18 07:07 ahkarami

Thank you @ahkarami really looking forward to your PR : )

louis-she avatar Jul 14 '18 08:07 louis-she