Docs Prettier reformat (#13483)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
2f2e81614f
commit
e5185ccf63
90 changed files with 763 additions and 742 deletions
|
|
@ -26,7 +26,7 @@ In the world of machine learning and computer vision, the process of making sens
|
|||
## Real-world Applications
|
||||
|
||||
| Manufacturing | Sports | Safety |
|
||||
|:-------------------------------------------------:|:----------------------------------------------------:|:-------------------------------------------:|
|
||||
| :-----------------------------------------------: | :--------------------------------------------------: | :-----------------------------------------: |
|
||||
| ![Vehicle Spare Parts Detection][car spare parts] | ![Football Player Detection][football player detect] | ![People Fall Detection][human fall detect] |
|
||||
| Vehicle Spare Parts Detection | Football Player Detection | People Fall Detection |
|
||||
|
||||
|
|
@ -104,16 +104,16 @@ YOLOv8 can process different types of input sources for inference, as shown in t
|
|||
|
||||
Use `stream=True` for processing long videos or large datasets to efficiently manage memory. When `stream=False`, the results for all frames or data points are stored in memory, which can quickly add up and cause out-of-memory errors for large inputs. In contrast, `stream=True` utilizes a generator, which only keeps the results of the current frame or data point in memory, significantly reducing memory consumption and preventing out-of-memory issues.
|
||||
|
||||
| Source | Argument | Type | Notes |
|
||||
|----------------|--------------------------------------------|-----------------|---------------------------------------------------------------------------------------------|
|
||||
| image | `'image.jpg'` | `str` or `Path` | Single image file. |
|
||||
| URL | `'https://ultralytics.com/images/bus.jpg'` | `str` | URL to an image. |
|
||||
| screenshot | `'screen'` | `str` | Capture a screenshot. |
|
||||
| PIL | `Image.open('im.jpg')` | `PIL.Image` | HWC format with RGB channels. |
|
||||
| OpenCV | `cv2.imread('im.jpg')` | `np.ndarray` | HWC format with BGR channels `uint8 (0-255)`. |
|
||||
| numpy | `np.zeros((640,1280,3))` | `np.ndarray` | HWC format with BGR channels `uint8 (0-255)`. |
|
||||
| torch | `torch.zeros(16,3,320,640)` | `torch.Tensor` | BCHW format with RGB channels `float32 (0.0-1.0)`. |
|
||||
| CSV | `'sources.csv'` | `str` or `Path` | CSV file containing paths to images, videos, or directories. |
|
||||
| Source | Argument | Type | Notes |
|
||||
| --------------- | ------------------------------------------ | --------------- | ------------------------------------------------------------------------------------------- |
|
||||
| image | `'image.jpg'` | `str` or `Path` | Single image file. |
|
||||
| URL | `'https://ultralytics.com/images/bus.jpg'` | `str` | URL to an image. |
|
||||
| screenshot | `'screen'` | `str` | Capture a screenshot. |
|
||||
| PIL | `Image.open('im.jpg')` | `PIL.Image` | HWC format with RGB channels. |
|
||||
| OpenCV | `cv2.imread('im.jpg')` | `np.ndarray` | HWC format with BGR channels `uint8 (0-255)`. |
|
||||
| numpy | `np.zeros((640,1280,3))` | `np.ndarray` | HWC format with BGR channels `uint8 (0-255)`. |
|
||||
| torch | `torch.zeros(16,3,320,640)` | `torch.Tensor` | BCHW format with RGB channels `float32 (0.0-1.0)`. |
|
||||
| CSV | `'sources.csv'` | `str` or `Path` | CSV file containing paths to images, videos, or directories. |
|
||||
| video ✅ | `'video.mp4'` | `str` or `Path` | Video file in formats like MP4, AVI, etc. |
|
||||
| directory ✅ | `'path/'` | `str` or `Path` | Path to a directory containing images or videos. |
|
||||
| glob ✅ | `'path/*.jpg'` | `str` | Glob pattern to match multiple files. Use the `*` character as a wildcard. |
|
||||
|
|
@ -368,7 +368,7 @@ Below are code examples for using each source type:
|
|||
Inference arguments:
|
||||
|
||||
| Argument | Type | Default | Description |
|
||||
|-----------------|----------------|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| --------------- | -------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `source` | `str` | `'ultralytics/assets'` | Specifies the data source for inference. Can be an image path, video file, directory, URL, or device ID for live feeds. Supports a wide range of formats and sources, enabling flexible application across different types of input. |
|
||||
| `conf` | `float` | `0.25` | Sets the minimum confidence threshold for detections. Objects detected with confidence below this threshold will be disregarded. Adjusting this value can help reduce false positives. |
|
||||
| `iou` | `float` | `0.7` | Intersection Over Union (IoU) threshold for Non-Maximum Suppression (NMS). Lower values result in fewer detections by eliminating overlapping boxes, useful for reducing duplicates. |
|
||||
|
|
@ -388,7 +388,7 @@ Inference arguments:
|
|||
Visualization arguments:
|
||||
|
||||
| Argument | Type | Default | Description |
|
||||
|---------------|---------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| ------------- | ------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `show` | `bool` | `False` | If `True`, displays the annotated images or videos in a window. Useful for immediate visual feedback during development or testing. |
|
||||
| `save` | `bool` | `False` | Enables saving of the annotated images or videos to file. Useful for documentation, further analysis, or sharing results. |
|
||||
| `save_frames` | `bool` | `False` | When processing videos, saves individual frames as images. Useful for extracting specific frames or for detailed frame-by-frame analysis. |
|
||||
|
|
@ -409,7 +409,7 @@ YOLOv8 supports various image and video formats, as specified in [ultralytics/da
|
|||
The below table contains valid Ultralytics image formats.
|
||||
|
||||
| Image Suffixes | Example Predict Command | Reference |
|
||||
|----------------|----------------------------------|----------------------------------------------------------------------------|
|
||||
| -------------- | -------------------------------- | -------------------------------------------------------------------------- |
|
||||
| `.bmp` | `yolo predict source=image.bmp` | [Microsoft BMP File Format](https://en.wikipedia.org/wiki/BMP_file_format) |
|
||||
| `.dng` | `yolo predict source=image.dng` | [Adobe DNG](https://en.wikipedia.org/wiki/Digital_Negative) |
|
||||
| `.jpeg` | `yolo predict source=image.jpeg` | [JPEG](https://en.wikipedia.org/wiki/JPEG) |
|
||||
|
|
@ -426,7 +426,7 @@ The below table contains valid Ultralytics image formats.
|
|||
The below table contains valid Ultralytics video formats.
|
||||
|
||||
| Video Suffixes | Example Predict Command | Reference |
|
||||
|----------------|----------------------------------|----------------------------------------------------------------------------------|
|
||||
| -------------- | -------------------------------- | -------------------------------------------------------------------------------- |
|
||||
| `.asf` | `yolo predict source=video.asf` | [Advanced Systems Format](https://en.wikipedia.org/wiki/Advanced_Systems_Format) |
|
||||
| `.avi` | `yolo predict source=video.avi` | [Audio Video Interleave](https://en.wikipedia.org/wiki/Audio_Video_Interleave) |
|
||||
| `.gif` | `yolo predict source=video.gif` | [Graphics Interchange Format](https://en.wikipedia.org/wiki/GIF) |
|
||||
|
|
@ -460,7 +460,7 @@ All Ultralytics `predict()` calls will return a list of `Results` objects:
|
|||
`Results` objects have the following attributes:
|
||||
|
||||
| Attribute | Type | Description |
|
||||
|--------------|-----------------------|------------------------------------------------------------------------------------------|
|
||||
| ------------ | --------------------- | ---------------------------------------------------------------------------------------- |
|
||||
| `orig_img` | `numpy.ndarray` | The original image as a numpy array. |
|
||||
| `orig_shape` | `tuple` | The original image shape in (height, width) format. |
|
||||
| `boxes` | `Boxes, optional` | A Boxes object containing the detection bounding boxes. |
|
||||
|
|
@ -475,7 +475,7 @@ All Ultralytics `predict()` calls will return a list of `Results` objects:
|
|||
`Results` objects have the following methods:
|
||||
|
||||
| Method | Return Type | Description |
|
||||
|---------------|-----------------|-------------------------------------------------------------------------------------|
|
||||
| ------------- | --------------- | ----------------------------------------------------------------------------------- |
|
||||
| `update()` | `None` | Update the boxes, masks, and probs attributes of the Results object. |
|
||||
| `cpu()` | `Results` | Return a copy of the Results object with all tensors on CPU memory. |
|
||||
| `numpy()` | `Results` | Return a copy of the Results object with all tensors as numpy arrays. |
|
||||
|
|
@ -515,7 +515,7 @@ For more details see the [`Results` class documentation](../reference/engine/res
|
|||
Here is a table for the `Boxes` class methods and properties, including their name, type, and description:
|
||||
|
||||
| Name | Type | Description |
|
||||
|-----------|---------------------------|--------------------------------------------------------------------|
|
||||
| --------- | ------------------------- | ------------------------------------------------------------------ |
|
||||
| `cpu()` | Method | Move the object to CPU memory. |
|
||||
| `numpy()` | Method | Convert the object to a numpy array. |
|
||||
| `cuda()` | Method | Move the object to CUDA memory. |
|
||||
|
|
@ -553,7 +553,7 @@ For more details see the [`Boxes` class documentation](../reference/engine/resul
|
|||
Here is a table for the `Masks` class methods and properties, including their name, type, and description:
|
||||
|
||||
| Name | Type | Description |
|
||||
|-----------|---------------------------|-----------------------------------------------------------------|
|
||||
| --------- | ------------------------- | --------------------------------------------------------------- |
|
||||
| `cpu()` | Method | Returns the masks tensor on CPU memory. |
|
||||
| `numpy()` | Method | Returns the masks tensor as a numpy array. |
|
||||
| `cuda()` | Method | Returns the masks tensor on GPU memory. |
|
||||
|
|
@ -586,7 +586,7 @@ For more details see the [`Masks` class documentation](../reference/engine/resul
|
|||
Here is a table for the `Keypoints` class methods and properties, including their name, type, and description:
|
||||
|
||||
| Name | Type | Description |
|
||||
|-----------|---------------------------|-------------------------------------------------------------------|
|
||||
| --------- | ------------------------- | ----------------------------------------------------------------- |
|
||||
| `cpu()` | Method | Returns the keypoints tensor on CPU memory. |
|
||||
| `numpy()` | Method | Returns the keypoints tensor as a numpy array. |
|
||||
| `cuda()` | Method | Returns the keypoints tensor on GPU memory. |
|
||||
|
|
@ -620,7 +620,7 @@ For more details see the [`Keypoints` class documentation](../reference/engine/r
|
|||
Here's a table summarizing the methods and properties for the `Probs` class:
|
||||
|
||||
| Name | Type | Description |
|
||||
|------------|---------------------------|-------------------------------------------------------------------------|
|
||||
| ---------- | ------------------------- | ----------------------------------------------------------------------- |
|
||||
| `cpu()` | Method | Returns a copy of the probs tensor on CPU memory. |
|
||||
| `numpy()` | Method | Returns a copy of the probs tensor as a numpy array. |
|
||||
| `cuda()` | Method | Returns a copy of the probs tensor on GPU memory. |
|
||||
|
|
@ -655,7 +655,7 @@ For more details see the [`Probs` class documentation](../reference/engine/resul
|
|||
Here is a table for the `OBB` class methods and properties, including their name, type, and description:
|
||||
|
||||
| Name | Type | Description |
|
||||
|-------------|---------------------------|-----------------------------------------------------------------------|
|
||||
| ----------- | ------------------------- | --------------------------------------------------------------------- |
|
||||
| `cpu()` | Method | Move the object to CPU memory. |
|
||||
| `numpy()` | Method | Convert the object to a numpy array. |
|
||||
| `cuda()` | Method | Move the object to CUDA memory. |
|
||||
|
|
@ -705,7 +705,7 @@ The `plot()` method in `Results` objects facilitates visualization of prediction
|
|||
The `plot()` method supports various arguments to customize the output:
|
||||
|
||||
| Argument | Type | Description | Default |
|
||||
|--------------|-----------------|----------------------------------------------------------------------------|---------------|
|
||||
| ------------ | --------------- | -------------------------------------------------------------------------- | ------------- |
|
||||
| `conf` | `bool` | Include detection confidence scores. | `True` |
|
||||
| `line_width` | `float` | Line width of bounding boxes. Scales with image size if `None`. | `None` |
|
||||
| `font_size` | `float` | Text font size. Scales with image size if `None`. | `None` |
|
||||
|
|
@ -800,7 +800,5 @@ Here's a Python script using OpenCV (`cv2`) and YOLOv8 to run inference on video
|
|||
This script will run predictions on each frame of the video, visualize the results, and display them in a window. The loop can be exited by pressing 'q'.
|
||||
|
||||
[car spare parts]: https://github.com/RizwanMunawar/ultralytics/assets/62513924/a0f802a8-0776-44cf-8f17-93974a4a28a1
|
||||
|
||||
[football player detect]: https://github.com/RizwanMunawar/ultralytics/assets/62513924/7d320e1f-fc57-4d7f-a691-78ee579c3442
|
||||
|
||||
[human fall detect]: https://github.com/RizwanMunawar/ultralytics/assets/62513924/86437c4a-3227-4eee-90ef-9efb697bdb43
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue