|
3 | 3 | try:
|
4 | 4 | import fiftyone as fo
|
5 | 5 | from fiftyone.utils.coco import COCODetectionDatasetImporter as BaseCOCODetectionDatasetImporter
|
6 |
| - from fiftyone.utils.coco import _get_matching_image_ids, _parse_label_types, load_coco_detection_annotations |
| 6 | + from fiftyone.utils.coco import _get_matching_image_ids, load_coco_detection_annotations |
7 | 7 | except ModuleNotFoundError:
|
8 | 8 | raise ModuleNotFoundError('Please run "pip install -U fiftyone" to install fiftyone first for fiftyone utilities.')
|
9 | 9 |
|
10 | 10 |
|
11 | 11 | class COCODetectionDatasetImporter(BaseCOCODetectionDatasetImporter):
|
12 |
| - def __init__( |
13 |
| - self, |
14 |
| - dataset_dir=None, |
15 |
| - data_path=None, |
16 |
| - labels_path=None, |
17 |
| - label_types=None, |
18 |
| - classes=None, |
19 |
| - image_ids=None, |
20 |
| - include_id=False, |
21 |
| - extra_attrs=None, |
22 |
| - only_matching=False, |
23 |
| - use_polylines=False, |
24 |
| - tolerance=None, |
25 |
| - shuffle=False, |
26 |
| - seed=None, |
27 |
| - max_samples=None, |
28 |
| - ): |
29 |
| - data_path = self._parse_data_path( |
30 |
| - dataset_dir=dataset_dir, |
31 |
| - data_path=data_path, |
32 |
| - default="data/", |
33 |
| - ) |
34 |
| - |
35 |
| - labels_path = self._parse_labels_path( |
36 |
| - dataset_dir=dataset_dir, |
37 |
| - labels_path=labels_path, |
38 |
| - default="labels.json", |
39 |
| - ) |
40 |
| - |
41 |
| - label_types = _parse_label_types(label_types) |
42 |
| - |
43 |
| - if include_id: |
44 |
| - label_types.append("coco_id") |
45 |
| - |
46 |
| - super().__init__( |
47 |
| - dataset_dir=dataset_dir, |
48 |
| - shuffle=shuffle, |
49 |
| - seed=seed, |
50 |
| - max_samples=max_samples, |
51 |
| - ) |
52 |
| - |
53 |
| - self.data_path = data_path |
54 |
| - self.labels_path = labels_path |
55 |
| - self.label_types = label_types |
56 |
| - self.classes = classes |
57 |
| - self.image_ids = image_ids |
58 |
| - self.extra_attrs = extra_attrs |
59 |
| - self.only_matching = only_matching |
60 |
| - self.use_polylines = use_polylines |
61 |
| - self.tolerance = tolerance |
62 |
| - |
63 |
| - self._info = None |
64 |
| - self._classes = None |
65 |
| - self._supercategory_map = None |
66 |
| - self._image_paths_map = None |
67 |
| - self._image_dicts_map = None |
68 |
| - self._annotations = None |
69 |
| - self._filenames = None |
70 |
| - self._iter_filenames = None |
71 |
| - |
72 | 12 | def setup(self):
|
73 | 13 | if self.labels_path is not None and os.path.isfile(self.labels_path):
|
74 | 14 | (
|
|
0 commit comments