Minor fix in docs for python admonition and code blocks (#16646)
This commit is contained in:
parent
7d6528a41a
commit
05fd3a3e73
4 changed files with 23 additions and 23 deletions
|
|
@ -141,7 +141,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
||||||
|
|
||||||
=== "Black Background Pixels"
|
=== "Black Background Pixels"
|
||||||
|
|
||||||
```py
|
```python
|
||||||
# Create 3-channel mask
|
# Create 3-channel mask
|
||||||
mask3ch = cv2.cvtColor(b_mask, cv2.COLOR_GRAY2BGR)
|
mask3ch = cv2.cvtColor(b_mask, cv2.COLOR_GRAY2BGR)
|
||||||
|
|
||||||
|
|
@ -192,7 +192,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
||||||
|
|
||||||
=== "Transparent Background Pixels"
|
=== "Transparent Background Pixels"
|
||||||
|
|
||||||
```py
|
```python
|
||||||
# Isolate object with transparent background (when saved as PNG)
|
# Isolate object with transparent background (when saved as PNG)
|
||||||
isolated = np.dstack([img, b_mask])
|
isolated = np.dstack([img, b_mask])
|
||||||
```
|
```
|
||||||
|
|
@ -248,7 +248,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
||||||
|
|
||||||
??? example "Example Final Step"
|
??? example "Example Final Step"
|
||||||
|
|
||||||
```py
|
```python
|
||||||
# Save isolated object to file
|
# Save isolated object to file
|
||||||
_ = cv2.imwrite(f"{img_name}_{label}-{ci}.png", iso_crop)
|
_ = cv2.imwrite(f"{img_name}_{label}-{ci}.png", iso_crop)
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ The dataset YAML is the same standard YOLOv5 and YOLOv8 YAML format.
|
||||||
|
|
||||||
After zipping your dataset, you should [validate it](https://docs.ultralytics.com/reference/hub/__init__/#ultralytics.hub.check_dataset) before uploading it to [Ultralytics HUB](https://www.ultralytics.com/hub). [Ultralytics HUB](https://www.ultralytics.com/hub) conducts the dataset validation check post-upload, so by ensuring your dataset is correctly formatted and error-free ahead of time, you can forestall any setbacks due to dataset rejection.
|
After zipping your dataset, you should [validate it](https://docs.ultralytics.com/reference/hub/__init__/#ultralytics.hub.check_dataset) before uploading it to [Ultralytics HUB](https://www.ultralytics.com/hub). [Ultralytics HUB](https://www.ultralytics.com/hub) conducts the dataset validation check post-upload, so by ensuring your dataset is correctly formatted and error-free ahead of time, you can forestall any setbacks due to dataset rejection.
|
||||||
|
|
||||||
```py
|
```python
|
||||||
from ultralytics.hub import check_dataset
|
from ultralytics.hub import check_dataset
|
||||||
|
|
||||||
check_dataset("path/to/dataset.zip", task="detect")
|
check_dataset("path/to/dataset.zip", task="detect")
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ Expand sections below for information on how these models were exported and test
|
||||||
|
|
||||||
See [export mode](../modes/export.md) for details regarding export configuration arguments.
|
See [export mode](../modes/export.md) for details regarding export configuration arguments.
|
||||||
|
|
||||||
```py
|
```python
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
|
||||||
model = YOLO("yolov8n.pt")
|
model = YOLO("yolov8n.pt")
|
||||||
|
|
@ -401,7 +401,7 @@ Expand sections below for information on how these models were exported and test
|
||||||
|
|
||||||
See [predict mode](../modes/predict.md) for additional information.
|
See [predict mode](../modes/predict.md) for additional information.
|
||||||
|
|
||||||
```py
|
```python
|
||||||
import cv2
|
import cv2
|
||||||
|
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
|
@ -421,7 +421,7 @@ Expand sections below for information on how these models were exported and test
|
||||||
|
|
||||||
See [`val` mode](../modes/val.md) to learn more about validation configuration arguments.
|
See [`val` mode](../modes/val.md) to learn more about validation configuration arguments.
|
||||||
|
|
||||||
```py
|
```python
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
|
||||||
model = YOLO("yolov8n.engine")
|
model = YOLO("yolov8n.engine")
|
||||||
|
|
|
||||||
|
|
@ -306,26 +306,26 @@ Explorer API can be used to explore datasets with advanced semantic, vector-simi
|
||||||
|
|
||||||
!!! tip "Detection Trainer Example"
|
!!! tip "Detection Trainer Example"
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from ultralytics.models.yolo import DetectionPredictor, DetectionTrainer, DetectionValidator
|
from ultralytics.models.yolo import DetectionPredictor, DetectionTrainer, DetectionValidator
|
||||||
|
|
||||||
# trainer
|
# trainer
|
||||||
trainer = DetectionTrainer(overrides={})
|
trainer = DetectionTrainer(overrides={})
|
||||||
trainer.train()
|
trainer.train()
|
||||||
trained_model = trainer.best
|
trained_model = trainer.best
|
||||||
|
|
||||||
# Validator
|
# Validator
|
||||||
val = DetectionValidator(args=...)
|
val = DetectionValidator(args=...)
|
||||||
val(model=trained_model)
|
val(model=trained_model)
|
||||||
|
|
||||||
# predictor
|
# predictor
|
||||||
pred = DetectionPredictor(overrides={})
|
pred = DetectionPredictor(overrides={})
|
||||||
pred(source=SOURCE, model=trained_model)
|
pred(source=SOURCE, model=trained_model)
|
||||||
|
|
||||||
# resume from last weight
|
# resume from last weight
|
||||||
overrides["resume"] = trainer.last
|
overrides["resume"] = trainer.last
|
||||||
trainer = detect.DetectionTrainer(overrides=overrides)
|
trainer = detect.DetectionTrainer(overrides=overrides)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can easily customize Trainers to support custom tasks or explore R&D ideas. Learn more about Customizing `Trainers`, `Validators` and `Predictors` to suit your project needs in the Customization Section.
|
You can easily customize Trainers to support custom tasks or explore R&D ideas. Learn more about Customizing `Trainers`, `Validators` and `Predictors` to suit your project needs in the Customization Section.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue