Fixed OpenVINO Docs formatting (#14773)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Francesco Mattioli 2024-07-29 23:57:14 +02:00 committed by GitHub
parent 2ebd01faa8
commit 3b1517f589
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 98 additions and 96 deletions

View file

@ -100,22 +100,22 @@ To train a YOLO model on the CIFAR-10 dataset using Ultralytics, you can follow
=== "Python" === "Python"
```python ```python
from ultralytics import YOLO from ultralytics import YOLO
# Load a model # Load a model
model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training) model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training)
# Train the model # Train the model
results = model.train(data="cifar10", epochs=100, imgsz=32) results = model.train(data="cifar10", epochs=100, imgsz=32)
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Start training from a pretrained *.pt model # Start training from a pretrained *.pt model
yolo detect train data=cifar10 model=yolov8n-cls.pt epochs=100 imgsz=32 yolo detect train data=cifar10 model=yolov8n-cls.pt epochs=100 imgsz=32
``` ```
For more details, refer to the model [Training](../../modes/train.md) page. For more details, refer to the model [Training](../../modes/train.md) page.

View file

@ -126,22 +126,22 @@ To train a YOLO model on the ImageNette dataset for 100 epochs, you can use the
=== "Python" === "Python"
```python ```python
from ultralytics import YOLO from ultralytics import YOLO
# Load a model # Load a model
model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training) model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training)
# Train the model # Train the model
results = model.train(data="imagenette", epochs=100, imgsz=224) results = model.train(data="imagenette", epochs=100, imgsz=224)
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Start training from a pretrained *.pt model # Start training from a pretrained *.pt model
yolo detect train data=imagenette model=yolov8n-cls.pt epochs=100 imgsz=224 yolo detect train data=imagenette model=yolov8n-cls.pt epochs=100 imgsz=224
``` ```
For more details, see the [Training](../../modes/train.md) documentation page. For more details, see the [Training](../../modes/train.md) documentation page.

View file

@ -39,18 +39,18 @@ To use Multi-Object Tracking with Ultralytics YOLO, you can start by using the P
=== "Python" === "Python"
```python ```python
from ultralytics import YOLO from ultralytics import YOLO
model = YOLO("yolov8n.pt") # Load the YOLOv8 model model = YOLO("yolov8n.pt") # Load the YOLOv8 model
results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True) results = model.track(source="https://youtu.be/LNwODJXcvt4", conf=0.3, iou=0.5, show=True)
``` ```
=== "CLI" === "CLI"
```bash ```bash
yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3 iou=0.5 show yolo track model=yolov8n.pt source="https://youtu.be/LNwODJXcvt4" conf=0.3 iou=0.5 show
``` ```
These commands load the YOLOv8 model and use it for tracking objects in the given video source with specific confidence (`conf`) and Intersection over Union (`iou`) thresholds. For more details, refer to the [track mode documentation](../../modes/track.md). These commands load the YOLOv8 model and use it for tracking objects in the given video source with specific confidence (`conf`) and Intersection over Union (`iou`) thresholds. For more details, refer to the [track mode documentation](../../modes/track.md).

View file

@ -97,19 +97,19 @@ Then, you can create a basic Streamlit application to run live inference:
=== "Python" === "Python"
```python ```python
from ultralytics import solutions from ultralytics import solutions
solutions.inference() solutions.inference()
### Make sure to run the file using command `streamlit run <file-name.py>` ### Make sure to run the file using command `streamlit run <file-name.py>`
``` ```
=== "CLI" === "CLI"
```bash ```bash
yolo streamlit-predict yolo streamlit-predict
``` ```
For more details on the practical setup, refer to the [Streamlit Application Code section](#streamlit-application-code) of the documentation. For more details on the practical setup, refer to the [Streamlit Application Code section](#streamlit-application-code) of the documentation.

View file

@ -180,9 +180,9 @@ Integrating DVCLive with Ultralytics YOLOv8 is straightforward. Start by install
=== "CLI" === "CLI"
```bash ```bash
pip install ultralytics dvclive pip install ultralytics dvclive
``` ```
Next, initialize a Git repository and configure DVCLive in your project: Next, initialize a Git repository and configure DVCLive in your project:
@ -190,13 +190,13 @@ Next, initialize a Git repository and configure DVCLive in your project:
=== "CLI" === "CLI"
```bash ```bash
git init -q git init -q
git config --local user.email "you@example.com" git config --local user.email "you@example.com"
git config --local user.name "Your Name" git config --local user.name "Your Name"
dvc init -q dvc init -q
git commit -m "DVC init" git commit -m "DVC init"
``` ```
Follow our [YOLOv8 Installation guide](../quickstart.md) for detailed setup instructions. Follow our [YOLOv8 Installation guide](../quickstart.md) for detailed setup instructions.
@ -262,9 +262,9 @@ DVCLive offers powerful tools to visualize the results of YOLOv8 experiments. He
=== "CLI" === "CLI"
```bash ```bash
dvc plots diff $(dvc exp list --names-only) dvc plots diff $(dvc exp list --names-only)
``` ```
To display these plots in a Jupyter Notebook, use: To display these plots in a Jupyter Notebook, use:

View file

@ -22,9 +22,9 @@ Here are some of the key features that make JupyterLab a great option for model
- **All-in-One Workspace**: JupyterLab is a one-stop shop for all your data science needs. Unlike the classic Jupyter Notebook, which had separate interfaces for text editing, terminal access, and notebooks, JupyterLab integrates all these features into a single, cohesive environment. You can view and edit various file formats, including JPEG, PDF, and CSV, directly within JupyterLab. An all-in-one workspace lets you access everything you need at your fingertips, streamlining your workflow and saving you time. - **All-in-One Workspace**: JupyterLab is a one-stop shop for all your data science needs. Unlike the classic Jupyter Notebook, which had separate interfaces for text editing, terminal access, and notebooks, JupyterLab integrates all these features into a single, cohesive environment. You can view and edit various file formats, including JPEG, PDF, and CSV, directly within JupyterLab. An all-in-one workspace lets you access everything you need at your fingertips, streamlining your workflow and saving you time.
- **Flexible Layouts**: One of JupyterLab's standout features is its flexible layout. You can drag, drop, and resize tabs to create a personalized layout that helps you work more efficiently. The collapsible left sidebar keeps essential tabs like the file browser, running kernels, and command palette within easy reach. You can have multiple windows open at once, allowing you to multitask and manage your projects more effectively. - **Flexible Layouts**: One of JupyterLab's standout features is its flexible layout. You can drag, drop, and resize tabs to create a personalized layout that helps you work more efficiently. The collapsible left sidebar keeps essential tabs like the file browser, running kernels, and command palette within easy reach. You can have multiple windows open at once, allowing you to multitask and manage your projects more effectively.
- **Interactive Code Consoles**: Code consoles in JupyterLab provide an interactive space to test out snippets of code or functions. They also serve as a log of computations made within a notebook. Creating a new console for a notebook and viewing all kernel activity is straightforward. This feature is especially useful when youre experimenting with new ideas or troubleshooting issues in your code. - **Interactive Code Consoles**: Code consoles in JupyterLab provide an interactive space to test out snippets of code or functions. They also serve as a log of computations made within a notebook. Creating a new console for a notebook and viewing all kernel activity is straightforward. This feature is especially useful when you're experimenting with new ideas or troubleshooting issues in your code.
- **Markdown Preview**: Working with Markdown files is more efficient in JupyterLab, thanks to its simultaneous preview feature. As you write or edit your Markdown file, you can see the formatted output in real-time. It makes it easier to double-check that your documentation looks perfect, saving you from having to switch back and forth between editing and preview modes. - **Markdown Preview**: Working with Markdown files is more efficient in JupyterLab, thanks to its simultaneous preview feature. As you write or edit your Markdown file, you can see the formatted output in real-time. It makes it easier to double-check that your documentation looks perfect, saving you from having to switch back and forth between editing and preview modes.
- **Run Code from Text Files**: If youre sharing a text file with code, JupyterLab makes it easy to run it directly within the platform. You can highlight the code and press Shift + Enter to execute it. It is great for verifying code snippets quickly and helps guarantee that the code you share is functional and error-free. - **Run Code from Text Files**: If you're sharing a text file with code, JupyterLab makes it easy to run it directly within the platform. You can highlight the code and press Shift + Enter to execute it. It is great for verifying code snippets quickly and helps guarantee that the code you share is functional and error-free.
## Why Should You Use JupyterLab for Your YOLOv8 Projects? ## Why Should You Use JupyterLab for Your YOLOv8 Projects?
@ -41,7 +41,7 @@ There are multiple platforms for developing and evaluating machine learning mode
When working with Kaggle, you might come across some common issues. Here are some tips to help you navigate the platform smoothly: When working with Kaggle, you might come across some common issues. Here are some tips to help you navigate the platform smoothly:
- **Managing Kernels**: Kernels are crucial because they manage the connection between the code you write in JupyterLab and the environment where it runs. They can also access and share data between notebooks. When you close a Jupyter Notebook, the kernel might still be running because other notebooks could be using it. If you want to completely shut down a kernel, you can select it, right-click, and choose "Shut Down Kernel" from the pop-up menu. - **Managing Kernels**: Kernels are crucial because they manage the connection between the code you write in JupyterLab and the environment where it runs. They can also access and share data between notebooks. When you close a Jupyter Notebook, the kernel might still be running because other notebooks could be using it. If you want to completely shut down a kernel, you can select it, right-click, and choose "Shut Down Kernel" from the pop-up menu.
- **Installing Python Packages**: Sometimes, you might need additional Python packages that arent pre-installed on the server. You can easily install these packages in your home directory or a virtual environment by using the command `python -m pip install package-name`. To see all installed packages, use `python -m pip list`. - **Installing Python Packages**: Sometimes, you might need additional Python packages that aren't pre-installed on the server. You can easily install these packages in your home directory or a virtual environment by using the command `python -m pip install package-name`. To see all installed packages, use `python -m pip list`.
- **Deploying Flask/FastAPI API to Posit Connect**: You can deploy your Flask and FastAPI APIs to Posit Connect using the [rsconnect-python](https://docs.posit.co/rsconnect-python/) package from the terminal. Doing so makes it easier to integrate your web applications with JupyterLab and share them with others. - **Deploying Flask/FastAPI API to Posit Connect**: You can deploy your Flask and FastAPI APIs to Posit Connect using the [rsconnect-python](https://docs.posit.co/rsconnect-python/) package from the terminal. Doing so makes it easier to integrate your web applications with JupyterLab and share them with others.
- **Installing JupyterLab Extensions**: JupyterLab supports various extensions to enhance functionality. You can install and customize these extensions to suit your needs. For detailed instructions, refer to [JupyterLab Extensions Guide](https://jupyterlab.readthedocs.io/en/latest/user/extensions.html) for more information. - **Installing JupyterLab Extensions**: JupyterLab supports various extensions to enhance functionality. You can install and customize these extensions to suit your needs. For detailed instructions, refer to [JupyterLab Extensions Guide](https://jupyterlab.readthedocs.io/en/latest/user/extensions.html) for more information.
- **Using Multiple Versions of Python**: If you need to work with different versions of Python, you can use Jupyter kernels configured with different Python versions. - **Using Multiple Versions of Python**: If you need to work with different versions of Python, you can use Jupyter kernels configured with different Python versions.
@ -79,7 +79,7 @@ Navigate to the directory where you saved the notebook file using your terminal.
jupyter lab jupyter lab
``` ```
Once youve run this command, it will open JupyterLab in your default web browser, as shown below. Once you've run this command, it will open JupyterLab in your default web browser, as shown below.
![Image Showing How JupyterLab Opens On the Browser](https://github.com/user-attachments/assets/bac4b140-1d64-4034-b980-7c0721121ec2) ![Image Showing How JupyterLab Opens On the Browser](https://github.com/user-attachments/assets/bac4b140-1d64-4034-b980-7c0721121ec2)
@ -91,14 +91,14 @@ In JupyterLab, open the tutorial.ipynb notebook. You can now start running the c
JupyterLab's interactive environment allows you to modify code, visualize outputs, and document your findings all in one place. You can try out different configurations and understand how YOLOv8 works. JupyterLab's interactive environment allows you to modify code, visualize outputs, and document your findings all in one place. You can try out different configurations and understand how YOLOv8 works.
For a detailed understanding of the model training process and best practices, refer to the [YOLOv8 Model Training guide](../modes/train.md). This guide will help you get the most out of your experiments and ensure youre using YOLOv8 effectively. For a detailed understanding of the model training process and best practices, refer to the [YOLOv8 Model Training guide](../modes/train.md). This guide will help you get the most out of your experiments and ensure you're using YOLOv8 effectively.
## Keep Learning about Jupyterlab ## Keep Learning about Jupyterlab
If you're excited to learn more about JupyterLab, here are some great resources to get you started: If you're excited to learn more about JupyterLab, here are some great resources to get you started:
- [**JupyterLab Documentation**](https://jupyterlab.readthedocs.io/en/stable/getting_started/starting.html): Dive into the official JupyterLab Documentation to explore its features and capabilities. It's a great way to understand how to use this powerful tool to its fullest potential. - [**JupyterLab Documentation**](https://jupyterlab.readthedocs.io/en/stable/getting_started/starting.html): Dive into the official JupyterLab Documentation to explore its features and capabilities. It's a great way to understand how to use this powerful tool to its fullest potential.
- [**Try It With Binder**](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/HEAD?urlpath=lab/tree/demo): Experiment with JupyterLab without installing anything by using Binder, which lets you launch a live JupyterLab instance directly in your browser. Its a great way to start experimenting immediately. - [**Try It With Binder**](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/HEAD?urlpath=lab/tree/demo): Experiment with JupyterLab without installing anything by using Binder, which lets you launch a live JupyterLab instance directly in your browser. It's a great way to start experimenting immediately.
- [**Installation Guide**](https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html): For a step-by-step guide on installing JupyterLab on your local machine, check out the installation guide. - [**Installation Guide**](https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html): For a step-by-step guide on installing JupyterLab on your local machine, check out the installation guide.
## Summary ## Summary

View file

@ -64,6 +64,8 @@ Export a YOLOv8n model to OpenVINO format and run inference with the exported mo
| `format` | `'openvino'` | format to export to | | `format` | `'openvino'` | format to export to |
| `imgsz` | `640` | image size as scalar or (h, w) list, i.e. (640, 480) | | `imgsz` | `640` | image size as scalar or (h, w) list, i.e. (640, 480) |
| `half` | `False` | FP16 quantization | | `half` | `False` | FP16 quantization |
| `int8` | `False` | INT8 quantization |
| `batch` | `1` | batch size for inference |
## Benefits of OpenVINO ## Benefits of OpenVINO
@ -262,14 +264,14 @@ To reproduce the Ultralytics benchmarks above on all export [formats](../modes/e
# Load a YOLOv8n PyTorch model # Load a YOLOv8n PyTorch model
model = YOLO("yolov8n.pt") model = YOLO("yolov8n.pt")
# Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all all export formats # Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all export formats
results = model.benchmarks(data="coco8.yaml") results = model.benchmarks(data="coco8.yaml")
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all all export formats # Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all export formats
yolo benchmark model=yolov8n.pt data=coco8.yaml yolo benchmark model=yolov8n.pt data=coco8.yaml
``` ```
@ -295,22 +297,22 @@ Exporting YOLOv8 models to the OpenVINO format can significantly enhance CPU spe
=== "Python" === "Python"
```python ```python
from ultralytics import YOLO from ultralytics import YOLO
# Load a YOLOv8n PyTorch model # Load a YOLOv8n PyTorch model
model = YOLO("yolov8n.pt") model = YOLO("yolov8n.pt")
# Export the model # Export the model
model.export(format="openvino") # creates 'yolov8n_openvino_model/' model.export(format="openvino") # creates 'yolov8n_openvino_model/'
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Export a YOLOv8n PyTorch model to OpenVINO format # Export a YOLOv8n PyTorch model to OpenVINO format
yolo export model=yolov8n.pt format=openvino # creates 'yolov8n_openvino_model/' yolo export model=yolov8n.pt format=openvino # creates 'yolov8n_openvino_model/'
``` ```
For more information, refer to the [export formats documentation](../modes/export.md). For more information, refer to the [export formats documentation](../modes/export.md).
@ -333,22 +335,22 @@ After exporting a YOLOv8 model to OpenVINO format, you can run inference using P
=== "Python" === "Python"
```python ```python
from ultralytics import YOLO from ultralytics import YOLO
# Load the exported OpenVINO model # Load the exported OpenVINO model
ov_model = YOLO("yolov8n_openvino_model/") ov_model = YOLO("yolov8n_openvino_model/")
# Run inference # Run inference
results = ov_model("https://ultralytics.com/images/bus.jpg") results = ov_model("https://ultralytics.com/images/bus.jpg")
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Run inference with the exported model # Run inference with the exported model
yolo predict model=yolov8n_openvino_model source='https://ultralytics.com/images/bus.jpg' yolo predict model=yolov8n_openvino_model source='https://ultralytics.com/images/bus.jpg'
``` ```
Refer to our [predict mode documentation](../modes/predict.md) for more details. Refer to our [predict mode documentation](../modes/predict.md) for more details.
@ -370,21 +372,21 @@ Yes, you can benchmark YOLOv8 models in various formats including PyTorch, Torch
=== "Python" === "Python"
```python ```python
from ultralytics import YOLO from ultralytics import YOLO
# Load a YOLOv8n PyTorch model # Load a YOLOv8n PyTorch model
model = YOLO("yolov8n.pt") model = YOLO("yolov8n.pt")
# Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all export formats # Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all export formats
results = model.benchmarks(data="coco8.yaml") results = model.benchmarks(data="coco8.yaml")
``` ```
=== "CLI" === "CLI"
```bash ```bash
# Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all export formats # Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all export formats
yolo benchmark model=yolov8n.pt data=coco8.yaml yolo benchmark model=yolov8n.pt data=coco8.yaml
``` ```
For detailed benchmark results, refer to our [benchmarks section](#openvino-yolov8-benchmarks) and [export formats](../modes/export.md) documentation. For detailed benchmark results, refer to our [benchmarks section](#openvino-yolov8-benchmarks) and [export formats](../modes/export.md) documentation.

View file

@ -136,14 +136,14 @@ class GCPRegions:
sorted_results = sorted(results, key=lambda x: x[1]) sorted_results = sorted(results, key=lambda x: x[1])
if verbose: if verbose:
print(f"{'Region':<20} {'Location':<35} {'Tier':<5} {'Latency (ms)'}") print(f"{'Region':<25} {'Location':<35} {'Tier':<5} {'Latency (ms)'}")
for region, mean, std, min_, max_ in sorted_results: for region, mean, std, min_, max_ in sorted_results:
tier, city, country = self.regions[region] tier, city, country = self.regions[region]
location = f"{city}, {country}" location = f"{city}, {country}"
if mean == float("inf"): if mean == float("inf"):
print(f"{region:<20} {location:<35} {tier:<5} {'Timeout'}") print(f"{region:<25} {location:<35} {tier:<5} {'Timeout'}")
else: else:
print(f"{region:<20} {location:<35} {tier:<5} {mean:.0f} ± {std:.0f} ({min_:.0f} - {max_:.0f})") print(f"{region:<25} {location:<35} {tier:<5} {mean:.0f} ± {std:.0f} ({min_:.0f} - {max_:.0f})")
print(f"\nLowest latency region{'s' if top > 1 else ''}:") print(f"\nLowest latency region{'s' if top > 1 else ''}:")
for region, mean, std, min_, max_ in sorted_results[:top]: for region, mean, std, min_, max_ in sorted_results[:top]:
tier, city, country = self.regions[region] tier, city, country = self.regions[region]