Add real-world projects in Ultralytics + guides in Docs (#6695)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
9618025416
commit
8c4094e7d9
13 changed files with 869 additions and 23 deletions
|
|
@ -24,7 +24,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
from ultralytics import YOLO
|
||||
```
|
||||
|
||||
???+ tip "Ultralytics Install"
|
||||
???+ tip "Ultralytics Install"
|
||||
|
||||
See the Ultralytics [Quickstart](../quickstart.md/#install-ultralytics) Installation section for a quick walkthrough on installing the required libraries.
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
res = m.predict()
|
||||
```
|
||||
|
||||
??? question "No Prediction Arguments?"
|
||||
??? question "No Prediction Arguments?"
|
||||
|
||||
Without specifying a source, the example images from the library will be used:
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
|
||||
This is helpful for rapid testing with the `predict()` method.
|
||||
|
||||
For additional information about Segmentation Models, visit the [Segment Task](../tasks/segment.md/#models) page. To learn more about `predict()` method, see [Predict Mode](../modes/predict.md) section of the Documentation.
|
||||
For additional information about Segmentation Models, visit the [Segment Task](../tasks/segment.md/#models) page. To learn more about `predict()` method, see [Predict Mode](../modes/predict.md) section of the Documentation.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -67,10 +67,10 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
|
||||
```
|
||||
|
||||
1. To learn more about working with detection results, see [Boxes Section for Predict Mode](../modes/predict.md/#boxes).
|
||||
2. To learn more about `predict()` results see [Working with Results for Predict Mode](../modes/predict.md/#working-with-results)
|
||||
1. To learn more about working with detection results, see [Boxes Section for Predict Mode](../modes/predict.md/#boxes).
|
||||
2. To learn more about `predict()` results see [Working with Results for Predict Mode](../modes/predict.md/#working-with-results)
|
||||
|
||||
??? info "For-Loop"
|
||||
??? info "For-Loop"
|
||||
|
||||
A single image will only iterate the first loop once. A single image with only a single detection will iterate each loop _only_ once.
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
|
||||
1. Start with generating a binary mask from the source image and then draw a filled contour onto the mask. This will allow the object to be isolated from the other parts of the image. An example from `bus.jpg` for one of the detected `person` class objects is shown on the right.
|
||||
|
||||
{ width="240", align="right" }
|
||||
{ width="240", align="right" }
|
||||
``` { .py .annotate }
|
||||
# Create binary mask
|
||||
b_mask = np.zeros(img.shape[:2], np.uint8)
|
||||
|
|
@ -100,11 +100,11 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
|
||||
```
|
||||
|
||||
1. For more info on `c.masks.xy` see [Masks Section from Predict Mode](../modes/predict.md/#masks).
|
||||
1. For more info on `c.masks.xy` see [Masks Section from Predict Mode](../modes/predict.md/#masks).
|
||||
|
||||
2. Here, the values are cast into `np.int32` for compatibility with `drawContours()` function from OpenCV.
|
||||
2. Here, the values are cast into `np.int32` for compatibility with `drawContours()` function from OpenCV.
|
||||
|
||||
3. The OpenCV `drawContours()` function expects contours to have a shape of `[N, 1, 2]` expand section below for more details.
|
||||
3. The OpenCV `drawContours()` function expects contours to have a shape of `[N, 1, 2]` expand section below for more details.
|
||||
|
||||
<details>
|
||||
<summary> Expand to understand what is happening when defining the <code>contour</code> variable.</summary>
|
||||
|
|
@ -141,7 +141,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
|
||||
1. Next the there are 2 options for how to move forward with the image from this point and a subsequent option for each.
|
||||
|
||||
### Object Isolation Options
|
||||
### Object Isolation Options
|
||||
|
||||
!!! Example ""
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
|
||||
- Finally the image region for the bounding box is cropped using index slicing, where the bounds are set using the `[ymin:ymax, xmin:xmax]` coordinates of the detection bounding box.
|
||||
|
||||
??? question "What if I want the cropped object **including** the background?"
|
||||
??? question "What if I want the cropped object **including** the background?"
|
||||
|
||||
This is a built in feature for the Ultralytics library. See the `save_crop` argument for [Predict Mode Inference Arguments](../modes/predict.md/#inference-arguments) for details.
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab
|
|||
|
||||
- **NOTE:** this step is optional and can be skipped if not required for your specific use case.
|
||||
|
||||
??? example "Example Final Step"
|
||||
??? example "Example Final Step"
|
||||
|
||||
```py
|
||||
# Save isolated object to file
|
||||
|
|
@ -311,9 +311,9 @@ for r in res:
|
|||
|
||||
```
|
||||
|
||||
1. The line populating `contour` is combined into a single line here, where it was split to multiple above.
|
||||
2. {==What goes here is up to you!==}
|
||||
3. See [Predict Mode](../modes/predict.md) for additional information.
|
||||
4. See [Segment Task](../tasks/segment.md/#models) for more information.
|
||||
5. Learn more about [Working with Results](../modes/predict.md/#working-with-results)
|
||||
6. Learn more about [Segmentation Mask Results](../modes/predict.md/#masks)
|
||||
1. The line populating `contour` is combined into a single line here, where it was split to multiple above.
|
||||
2. {==What goes here is up to you!==}
|
||||
3. See [Predict Mode](../modes/predict.md) for additional information.
|
||||
4. See [Segment Task](../tasks/segment.md/#models) for more information.
|
||||
5. Learn more about [Working with Results](../modes/predict.md/#working-with-results)
|
||||
6. Learn more about [Segmentation Mask Results](../modes/predict.md/#masks)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue