diff --git a/docs/en/help/contributing.md b/docs/en/help/contributing.md index 18a157ac..8f6ae10a 100644 --- a/docs/en/help/contributing.md +++ b/docs/en/help/contributing.md @@ -53,27 +53,62 @@ I have read the CLA Document and I sign the CLA When adding new functions or classes, please include a [Google-style docstring](https://google.github.io/styleguide/pyguide.html) to provide clear and concise documentation for other developers. This will help ensure that your contributions are easy to understand and maintain. -Example Google-style docstring: +!!! Example "Example Docstrings" -```python -def example_function(arg1: int, arg2: int) -> bool: - """ - Example function that demonstrates Google-style docstrings. + === "Google-style" - Args: - arg1 (int): The first argument. - arg2 (int): The second argument. + This example shows both Google-style docstrings. Note that both input and output `types` must always be enclosed by parentheses, i.e. `(bool)`. + ```python + def example_function(arg1, arg2=4): + """ + Example function that demonstrates Google-style docstrings. + + Args: + arg1 (int): The first argument. + arg2 (int): The second argument. Default value is 4. + + Returns: + (bool): True if successful, False otherwise. + + Examples: + >>> result = example_function(1, 2) # returns False + """ + if arg1 == arg2: + return True + return False + ``` - Returns: - (bool): True if successful, False otherwise. + === "Google-style with type hints" - Examples: - >>> result = example_function(1, 2) # returns False - """ - if arg1 == arg2: - return True - return False -``` + This example shows both Google-style docstrings and argument and return type hints, though both are not required, one can be used without the other. + ```python + def example_function(arg1: int, arg2: int = 4) -> bool: + """ + Example function that demonstrates Google-style docstrings. + + Args: + arg1: The first argument. + arg2: The second argument. Default value is 4. + + Returns: + True if successful, False otherwise. + + Examples: + >>> result = example_function(1, 2) # returns False + """ + if arg1 == arg2: + return True + return False + ``` + + === "Single-line" + + Smaller or simpler functions can utilize a single-line docstring. Note the docstring must use 3 double-quotes, and be a complete sentence starting with a capital letter and ending with a period. + ```python + def example_small_function(arg1: int, arg2: int = 4) -> bool: + """Example function that demonstrates a single-line docstring.""" + return arg1 == arg2 + ``` ### GitHub Actions CI Tests diff --git a/docs/en/hub/inference-api.md b/docs/en/hub/inference-api.md index f37c0a95..e5d88cf3 100644 --- a/docs/en/hub/inference-api.md +++ b/docs/en/hub/inference-api.md @@ -1,7 +1,7 @@ --- comments: true -description: Access object detection capabilities of YOLOv8 via our RESTful API. Learn how to use the YOLO Inference API with Python or CLI for swift object detection. -keywords: Ultralytics, YOLOv8, Inference API, object detection, RESTful API, Python, CLI, Quickstart +description: Access object detection capabilities of YOLOv8 via our RESTful API. Learn how to use the YOLO Inference API with Python or cURL for swift object detection. +keywords: Ultralytics, YOLOv8, Inference API, object detection, RESTful API, Python, cURL, Quickstart --- # YOLO Inference API @@ -44,9 +44,9 @@ print(response.json()) In this example, replace `API_KEY` with your actual API key, `MODEL_ID` with the desired model ID, and `path/to/image.jpg` with the path to the image you want to analyze. -## Example Usage with CLI +## Example Usage with cURL -You can use the YOLO Inference API with the command-line interface (CLI) by utilizing the `curl` command. Replace `API_KEY` with your actual API key, `MODEL_ID` with the desired model ID, and `image.jpg` with the path to the image you want to analyze: +You can use the YOLO Inference API with client URL (cURL) by utilizing the `curl` command. Replace `API_KEY` with your actual API key, `MODEL_ID` with the desired model ID, and `image.jpg` with the path to the image you want to analyze: ```bash curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \ @@ -103,11 +103,11 @@ The JSON list contains information about the detected objects, their coordinates ### Detect Model Format -YOLO detection models, such as `yolov8n.pt`, can return JSON responses from local inference, CLI inference, and Python inference. All of these methods produce the same JSON response format. +YOLO detection models, such as `yolov8n.pt`, can return JSON responses from local inference, cURL inference, and Python inference. All of these methods produce the same JSON response format. !!! Example "Detect Model JSON Response" - === "Local" + === "`ultralytics`" ```python from ultralytics import YOLO @@ -122,7 +122,7 @@ YOLO detection models, such as `yolov8n.pt`, can return JSON responses from loca print(results[0].tojson()) ``` - === "CLI" + === "cURL" ```bash curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \ @@ -201,11 +201,11 @@ YOLO detection models, such as `yolov8n.pt`, can return JSON responses from loca ### Segment Model Format -YOLO segmentation models, such as `yolov8n-seg.pt`, can return JSON responses from local inference, CLI inference, and Python inference. All of these methods produce the same JSON response format. +YOLO segmentation models, such as `yolov8n-seg.pt`, can return JSON responses from local inference, cURL inference, and Python inference. All of these methods produce the same JSON response format. !!! Example "Segment Model JSON Response" - === "Local" + === "`ultralytics`" ```python from ultralytics import YOLO @@ -220,7 +220,7 @@ YOLO segmentation models, such as `yolov8n-seg.pt`, can return JSON responses fr print(results[0].tojson()) ``` - === "CLI" + === "cURL" ```bash curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \ @@ -342,11 +342,11 @@ YOLO segmentation models, such as `yolov8n-seg.pt`, can return JSON responses fr ### Pose Model Format -YOLO pose models, such as `yolov8n-pose.pt`, can return JSON responses from local inference, CLI inference, and Python inference. All of these methods produce the same JSON response format. +YOLO pose models, such as `yolov8n-pose.pt`, can return JSON responses from local inference, cURL inference, and Python inference. All of these methods produce the same JSON response format. !!! Example "Pose Model JSON Response" - === "Local" + === "`ultralytics`" ```python from ultralytics import YOLO @@ -361,7 +361,7 @@ YOLO pose models, such as `yolov8n-pose.pt`, can return JSON responses from loca print(results[0].tojson()) ``` - === "CLI" + === "cURL" ```bash curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \ diff --git a/docs/en/tasks/obb.md b/docs/en/tasks/obb.md index a11d571d..c2ab73de 100644 --- a/docs/en/tasks/obb.md +++ b/docs/en/tasks/obb.md @@ -18,6 +18,19 @@ The output of an oriented object detector is a set of rotated bounding boxes tha YOLOv8 OBB models use the `-obb` suffix, i.e. `yolov8n-obb.pt` and are pretrained on [DOTAv1](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/DOTAv1.yaml). +

+
+ +
+ Watch: Object Detection using Ultralytics YOLOv8 Oriented Bounding Boxes (YOLOv8-OBB) +

+ +## Visual Samples + | Ships Detection using OBB | Vehicle Detection using OBB | |:-------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------:| | ![Ships Detection using OBB](https://github.com/RizwanMunawar/ultralytics/assets/62513924/5051d324-416f-4b58-ab62-f1bf9d7134b0) | ![Vehicle Detection using OBB](https://github.com/RizwanMunawar/ultralytics/assets/62513924/9a366262-910a-403b-a5e2-9c68b75700d3) | diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 310095c5..fc968dbf 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -533,7 +533,7 @@ plugins: add_desc: False add_image: True add_share_buttons: True - default_image: https://github.com/ultralytics/ultralytics/assets/26833433/6d09221c-c52a-4234-9a5d-b862e93c6529 + default_image: https://github.com/ultralytics/assets/blob/main/yolov8/banner-yolov8.png - mkdocs-jupyter - redirects: redirect_maps: diff --git a/pyproject.toml b/pyproject.toml index 4f22c6e8..1afacc11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,7 +93,7 @@ dev = [ "mkdocstrings[python]", "mkdocs-jupyter", # for notebooks "mkdocs-redirects", # for 301 redirects - "mkdocs-ultralytics-plugin>=0.0.38", # for meta descriptions and images, dates and authors + "mkdocs-ultralytics-plugin>=0.0.40", # for meta descriptions and images, dates and authors ] export = [ "onnx>=1.12.0", # ONNX export