Skip to content

Commit

Permalink
add support for fiftyone > 0.14.2 (#296)
Browse files Browse the repository at this point in the history
* add support for fiftyone > 0.14.2

* update to v0.8.13

* handle when coco image names inclue folder
  • Loading branch information
fcakyon authored Dec 6, 2021
1 parent e002f1d commit 7a2bf29
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 72 deletions.
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ sahi predict --slice_width 256 --slice_height 256 --overlap_height_ratio 0.1 --o
<big><b>Explore COCO dataset via FiftyOne app:</b></big>
</summary>

For supported version: `pip install fiftyone>=0.11.1<0.15.0`
For supported version: `pip install fiftyone>=0.14.2<0.15.0`

```python
from sahi.utils.fiftyone import launch_fiftyone_app
Expand Down Expand Up @@ -437,15 +437,8 @@ If you use this package in your work, please cite it as:

```
@software{akyon2021sahi,
author = {Akyon, Fatih Cagatay and
Cengiz, Cemil and
Altinuc, Sinan Onur and
Cavusoglu, Devrim and
Sahin, Kadir and
Eryuksel, Ogulcan},
title = {{SAHI: A lightweight vision library for performing
large scale object detection and instance
segmentation}},
author = {Akyon, Fatih Cagatay and Cengiz, Cemil and Altinuc, Sinan Onur and Cavusoglu, Devrim and Sahin, Kadir and Eryuksel, Ogulcan},
title = {{SAHI: A lightweight vision library for performing large scale object detection and instance segmentation}},
month = nov,
year = 2021,
publisher = {Zenodo},
Expand Down
2 changes: 1 addition & 1 deletion sahi/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8.12"
__version__ = "0.8.13"
62 changes: 1 addition & 61 deletions sahi/utils/fiftyone.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,12 @@
try:
import fiftyone as fo
from fiftyone.utils.coco import COCODetectionDatasetImporter as BaseCOCODetectionDatasetImporter
from fiftyone.utils.coco import _get_matching_image_ids, _parse_label_types, load_coco_detection_annotations
from fiftyone.utils.coco import _get_matching_image_ids, load_coco_detection_annotations
except ModuleNotFoundError:
raise ModuleNotFoundError('Please run "pip install -U fiftyone" to install fiftyone first for fiftyone utilities.')


class COCODetectionDatasetImporter(BaseCOCODetectionDatasetImporter):
def __init__(
self,
dataset_dir=None,
data_path=None,
labels_path=None,
label_types=None,
classes=None,
image_ids=None,
include_id=False,
extra_attrs=None,
only_matching=False,
use_polylines=False,
tolerance=None,
shuffle=False,
seed=None,
max_samples=None,
):
data_path = self._parse_data_path(
dataset_dir=dataset_dir,
data_path=data_path,
default="data/",
)

labels_path = self._parse_labels_path(
dataset_dir=dataset_dir,
labels_path=labels_path,
default="labels.json",
)

label_types = _parse_label_types(label_types)

if include_id:
label_types.append("coco_id")

super().__init__(
dataset_dir=dataset_dir,
shuffle=shuffle,
seed=seed,
max_samples=max_samples,
)

self.data_path = data_path
self.labels_path = labels_path
self.label_types = label_types
self.classes = classes
self.image_ids = image_ids
self.extra_attrs = extra_attrs
self.only_matching = only_matching
self.use_polylines = use_polylines
self.tolerance = tolerance

self._info = None
self._classes = None
self._supercategory_map = None
self._image_paths_map = None
self._image_dicts_map = None
self._annotations = None
self._filenames = None
self._iter_filenames = None

def setup(self):
if self.labels_path is not None and os.path.isfile(self.labels_path):
(
Expand Down

0 comments on commit 7a2bf29

Please sign in to comment.