From f03a47a5df0b93018d7d149aee7e85f1b2f73187 Mon Sep 17 00:00:00 2001 From: Piotr Skalski Date: Thu, 18 May 2023 00:59:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20quick=20start=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 143 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6137f580..c86252dc 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ pip install supervision ```
-Install from source +install from source ```bash # clone repository and navigate to root directory @@ -95,9 +95,145 @@ pip install -e ".[dev]"
-## 📖 documentation +## 🔥 quickstart -Curious how Supervision can help you solve problems on your project? Visit our [documentation](https://roboflow.github.io/supervision) page! +### [detections processing](https://roboflow.github.io/supervision/detection/core/) + +```python +>>> import supervision as sv +>>> from ultralytics import YOLO + +>>> model = YOLO('yolov8s.pt') +>>> result = model(IMAGE)[0] +>>> detections = sv.Detections.from_yolov8(result) + +>>> len(detections) +5 +``` + +
+👉 more detections utils + +- Easily switch inference pipeline between supported object detection / instance segmentation models + + ```python + >>> import supervision as sv + >>> from segment_anything import sam_model_registry, SamAutomaticMaskGenerator + + >>> sam = sam_model_registry[MODEL_TYPE](checkpoint=CHECKPOINT_PATH).to(device=DEVICE) + >>> mask_generator = SamAutomaticMaskGenerator(sam) + >>> sam_result = mask_generator.generate(IMAGE) + >>> detections = sv.Detections.from_sam(sam_result=sam_result) + ``` + +- [Advanced filtering](https://roboflow.github.io/supervision/quickstart/detections/) + + ```python + >>> detections = detections[detections.class_id == 0] + >>> detections = detections[detections.confidence > 0.5] + >>> detections = detections[detections.area > 1000] + ``` + +- Image annotation + + ```python + >>> import supervision as sv + + >>> box_annotator = sv.BoxAnnotator() + >>> annotated_frame = box_annotator.annotate( + ... scene=IMAGE, + ... detections=detections + ... ) + ``` + +
+ +### [datasets processing](https://roboflow.github.io/supervision/dataset/core/) + +```python +>>> import supervision as sv + +>>> dataset = sv.DetectionDataset.from_yolo( +... images_directory_path='...', +... annotations_directory_path='...', +... data_yaml_path='...' +... ) + +>>> dataset.classes +['dog', 'person'] + +>>> len(dataset) +1000 +``` + +
+👉 more dataset utils + +- Load object detection / instance segmentation datasets in one of supported formats + + ```python + >>> dataset = sv.DetectionDataset.from_yolo( + ... images_directory_path='...', + ... annotations_directory_path='...', + ... data_yaml_path='...' + ... ) + + >>> dataset = sv.DetectionDataset.from_pascal_voc( + ... images_directory_path='...', + ... annotations_directory_path='...' + ... ) + ``` + +- Loop over dataset entries + + ```python + >>> for image, labels in dataset: + ... print(labels.xyxy) + + array([[404. , 719. , 538. , 884.5 ], + [155. , 497. , 404. , 833.5 ], + [ 20.154999, 347.825 , 416.125 , 915.895 ]], dtype=float32) + ``` + +- Split dataset for training, testing and validation + + ```python + >>> train_dataset, test_dataset = dataset.split(split_ratio=0.7) + >>> test_dataset, valid_dataset = test_dataset.split(split_ratio=0.5) + + >>> len(train_dataset), len(test_dataset), len(valid_dataset) + (700, 150, 150) + ``` + +- Save object detection / instance segmentation datasets in one of supported formats + + ```python + >>> dataset.as_yolo( + ... images_directory_path='...', + ... annotations_directory_path='...', + ... data_yaml_path='...' + ... ) + + >>> dataset.as_pascal_voc( + ... images_directory_path='...', + ... annotations_directory_path='...' + ... ) + ``` + +- Convert labels between suppoted formats + + ```python + >>> sv.DetectionDataset.from_yolo( + ... images_directory_path='...', + ... annotations_directory_path='...', + ... data_yaml_path='...' + ... ).as_pascal_voc( + ... images_directory_path='...', + ... annotations_directory_path='...' + ... ) + ``` + +
## 🎬 tutorials @@ -123,6 +259,10 @@ Curious how Supervision can help you solve problems on your project? Visit our [

+## 📚 documentation + +Curious how Supervision can help you solve problems on your project? Visit our [documentation](https://roboflow.github.io/supervision) page! + ## 🏆 contribution We love your input! Please see our [contributing guide](https://github.com/roboflow/supervision/blob/main/CONTRIBUTING.md) to get started. Thank you 🙏 to all our contributors!