Skip to content

Commit

Permalink
Merge pull request #136 from roboflow/0.10.0-release
Browse files Browse the repository at this point in the history
`0.10.0` release
  • Loading branch information
SkalskiP authored Jun 14, 2023
2 parents 282aa2c + 584c4fe commit 9cff624
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 41 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
author: Roboflow
message: If you use this software, please cite it as below.
title: supervision
version: 0.9.0
version: 0.10.0
date-released: 2023-01-19
license: MIT
repository-code: https://github.com/roboflow/supervision
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,22 @@ pip install -e ".[dev]"
... annotations_directory_path='...'
... )
```

- Load classification datasets in one of supported formats

```python
>>> cs = sv.ClassificationDataset.from_folder_structure(
... root_directory_path='...'
... )
```

- Save classification datasets in one of supported formats

```python
>>> cs.as_folder_structure(
... root_directory_path='...'
... )
```

</details>

Expand Down
57 changes: 24 additions & 33 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,47 @@
### 0.9.0 <small>June 7, 2023</small>
### 0.10.0 <small>June 14, 2023</small>

- Added [[#118](https://github.com/roboflow/supervision/pull/118)]: ability to select [`sv.Detections`](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.__getitem__) by index, list of indexes or slice. Here is an example illustrating the new selection methods.
- Added [[#125](https://github.com/roboflow/supervision/pull/125)]: ability to load and save [`sv.ClassificationDataset`](https://roboflow.github.io/supervision/dataset/core/#classificationdataset) in a folder structure format.

```python
>>> import supervision as sv

>>> detections = sv.Detections(...)
>>> len(detections[0])
1
>>> len(detections[[0, 1]])
2
>>> len(detections[0:2])
2
>>> cs = sv.ClassificationDataset.from_folder_structure(
... root_directory_path='...'
... )

>>> cs.as_folder_structure(
... root_directory_path='...'
... )
```

- Added [[#101](https://github.com/roboflow/supervision/pull/101)]: ability to extract masks from YOLOv8 result using [`sv.Detections.from_yolov8`](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_yolov8). Here is an example illustrating how to extract boolean masks from the result of the YOLOv8 model inference.
- Added [[#125](https://github.com/roboflow/supervision/pull/125)]: support for [`sv.ClassificationDataset.split`](https://roboflow.github.io/supervision/dataset/core/#supervision.dataset.core.ClassificationDataset.split) allowing to divide `sv.ClassificationDataset` into two parts.

```python
>>> import cv2
>>> from ultralytics import YOLO
>>> import supervision as sv
- Added [[#110](https://github.com/roboflow/supervision/pull/110)]: ability to extract masks from Roboflow API results using [`sv.Detections.from_roboflow`](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_roboflow).

>>> image = cv2.imread(...)
>>> image.shape
(640, 640, 3)
- Added [[commit hash](https://github.com/roboflow/supervision/commit/d000292eb2f2342544e0947b65528082e60fb8d6)]: Supervision Quickstart [notebook](https://colab.research.google.com/github/roboflow/supervision/blob/main/demo.ipynb) where you can learn more about Detection, Dataset and Video APIs.

>>> model = YOLO('yolov8s-seg.pt')
>>> result = model(image)[0]
>>> detections = sv.Detections.from_yolov8(result)
>>> detections.mask.shape
(2, 640, 640)
```
- Changed [[#135](https://github.com/roboflow/supervision/pull/135)]: `sv.get_video_frames_generator` documentation to better describe actual behavior.

- Added [[#122](https://github.com/roboflow/supervision/pull/122)]: ability to crop image using [`sv.crop`](https://roboflow.github.io/supervision/utils/image/#crop). Here is an example showing how to get a separate crop for each detection in `sv.Detections`.
### 0.9.0 <small>June 7, 2023</small>

- Added [[#118](https://github.com/roboflow/supervision/pull/118)]: ability to select [`sv.Detections`](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.__getitem__) by index, list of indexes or slice. Here is an example illustrating the new selection methods.

```python
>>> import cv2
>>> import supervision as sv

>>> image = cv2.imread(...)
>>> detections = sv.Detections(...)
>>> len(detections)
>>> len(detections[0])
1
>>> len(detections[[0, 1]])
2
>>> crops = [
... sv.crop(image=image, xyxy=xyxy)
... for xyxy
... in detections.xyxy
... ]
>>> len(crops)
>>> len(detections[0:2])
2
```

- Added [[#101](https://github.com/roboflow/supervision/pull/101)]: ability to extract masks from YOLOv8 result using [`sv.Detections.from_yolov8`](https://roboflow.github.io/supervision/detection/core/#supervision.detection.core.Detections.from_yolov8). Here is an example illustrating how to extract boolean masks from the result of the YOLOv8 model inference.

- Added [[#122](https://github.com/roboflow/supervision/pull/122)]: ability to crop image using [`sv.crop`](https://roboflow.github.io/supervision/utils/image/#crop). Here is an example showing how to get a separate crop for each detection in `sv.Detections`.

- Added [[#120](https://github.com/roboflow/supervision/pull/120)]: ability to conveniently save multiple images into directory using [`sv.ImageSink`](https://roboflow.github.io/supervision/utils/image/#imagesink). Here is an example showing how to save every tenth video frame as a separate image.

```python
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ def get_version():
'Operating System :: Unix',
'Operating System :: MacOS'
],
keywords="machine-learning, deep-learning, vision, ML, DL, AI, YOLOv5, YOLOv8, Roboflow",
keywords="machine-learning, deep-learning, vision, ML, DL, AI, YOLOv5, YOLOv8, SAM, Roboflow",
python_requires='>=3.7',
)
2 changes: 1 addition & 1 deletion supervision/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.9.0"
__version__ = "0.10.0"

from supervision.classification.core import Classifications
from supervision.dataset.core import (
Expand Down
8 changes: 3 additions & 5 deletions supervision/dataset/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def split(
)
return train_dataset, test_dataset

def as_multiclass_folder_structure(self, root_directory_path: str) -> None:
def as_folder_structure(self, root_directory_path: str) -> None:
"""
Saves the dataset as a multi-class folder structure.
Expand All @@ -421,9 +421,7 @@ def as_multiclass_folder_structure(self, root_directory_path: str) -> None:
cv2.imwrite(image_path, image)

@classmethod
def from_multiclass_folder_structure(
cls, root_directory_path: str
) -> ClassificationDataset:
def from_folder_structure(cls, root_directory_path: str) -> ClassificationDataset:
"""
Load data from a multiclass folder structure into a ClassificationDataset.
Expand All @@ -446,7 +444,7 @@ def from_multiclass_folder_structure(
>>> project = rf.workspace(WORKSPACE_ID).project(PROJECT_ID)
>>> dataset = project.version(PROJECT_VERSION).download("folder")
>>> cd = sv.ClassificationDataset.from_multiclass_folder_structure(
>>> cd = sv.ClassificationDataset.from_folder_structure(
... root_directory_path=f"{dataset.location}/train"
... )
```
Expand Down

0 comments on commit 9cff624

Please sign in to comment.