Skip to content

person 300 Data Flow

visionNoob edited this page Sep 12, 2018 · 1 revision

1. ./person-300

./person-300에는 JPEGImagesAnnotations 폴더가 있습니다.

  • JPEGImages : 실제 JPEGImage가 들어있는 폴더 ex) 2007_000480.jpg
  • Annotations : 파싱할 수 있는 형태의 XML 파일 ex) 2007_000480.xml

Image type : jpeg format

image example
./JPEGImages/2007_000480.jpg

BBoxes type : xmin, ymin, xmax, ymax

BBoxes example
<xmin>293.0</xmin> 
<ymin>162.0</ymin> 
<xmax>419.0</xmax> 
<ymax>375.0</ymax>

2. coordinateCvt2YOLO

    def coordinateCvt2YOLO(image_width, image_height, xmin, xmax, ymin, ymax):

        #calculate bbox_center
        bbox_center_x = (xmin + xmax) / 2 
        bbox_center_y = (ymin + ymax) / 2

        #calculate bbox_size
        bbox_width = xmax - xmin  
        bbox_height = ymax - ymin 

        #normalization
        normalized_x = bbox_center_x / image_width  
        normalized_w = bbox_width / image_width 
        normalized_y = bbox_center_y / image_height 
        normalized_h = bbox_height / image_height 

        return (round(normalized_x,3), round(normalized_y,3), round(normalized_w,3), round(normalized_h,3))
xmin = data[key]["objects"][str(idx)]["bndbox"]["xmin"]
ymin = data[key]["objects"][str(idx)]["bndbox"]["ymin"]
xmax = data[key]["objects"][str(idx)]["bndbox"]["xmax"]
ymax = data[key]["objects"][str(idx)]["bndbox"]["ymax"]

b = (float(xmin), float(xmax), float(ymin), float(ymax))
bb = self.coordinateCvt2YOLO((img_width, img_height), b)

3. dataloader (data.Dataset)

생성자(__init__)에서 데이터를 파싱, 컨버팅(cvtData())하고 __getitem__ 통해 img, target 을 반환

Image type : PIL.Image.Image (RGB)

BBoxes type : xmin, ymin, xmax, ymax

BBoxes example
[[class, normalized_x , normalized_y, normalized_w, normalized_h]]  
[[0.0, 0.636, 0.643, 0.356, 0.64]]

Clone this wiki locally