コード例 #1
0
 def _parse_detection(self, obj, img=None):
     coco_obj = COCOObject.from_annotation_dict(obj)
     frame_size = etai.to_frame_size(img=img)
     return coco_obj.to_detection(
         frame_size,
         classes=self.classes,
         supercategory_map=self.supercategory_map,
     )
コード例 #2
0
    def from_abs(cls, x, y, **kwargs):
        '''Constructs a RelativePoint from absolute (x, y) pixel coordinates.

        Args:
            **kwargs: a valid argument for etai.to_frame_size()
        '''
        w, h = etai.to_frame_size(**kwargs)
        x /= 1.0 * w
        y /= 1.0 * h
        return cls(x, y)
コード例 #3
0
    def coords_in(self, **kwargs):
        '''Returns the absolute (x, y) coordinates of this point in the
        specified image.

        Args:
            **kwargs: a valid argument for etai.to_frame_size()

        Returns:
            (x, y): the absolute x and y coordinates of this point
        '''
        w, h = etai.to_frame_size(**kwargs)
        return int(w * 1.0 * self.x), int(h * 1.0 * self.y)
コード例 #4
0
    def _parse_label(self, labels, img):
        if labels is None:
            return None

        if etau.is_str(labels):
            labels = etas.load_json(labels)

        frame_size = etai.to_frame_size(img=img)
        label = _parse_bdd_annotation(labels, frame_size)

        if label is not None and self.expand:
            label = label.expand(
                prefix=self.prefix,
                labels_dict=self.labels_dict,
                multilabel=self.multilabel,
                skip_non_categorical=self.skip_non_categorical,
            )

        return label
コード例 #5
0
ファイル: kitti.py プロジェクト: zfyong/fiftyone
 def _parse_label(self, target, img=None):
     frame_size = etai.to_frame_size(img=img)
     return load_kitti_detection_annotations(target, frame_size)
コード例 #6
0
ファイル: bdd.py プロジェクト: zfyong/fiftyone
    def _parse_label(self, labels, img):
        if etau.is_str(labels):
            labels = etas.load_json(labels)

        frame_size = etai.to_frame_size(img=img)
        return _parse_bdd_annotation(labels, frame_size)