Adding an example for `depth-estimation` pipeline. (#20237)

* Adding an example for `depth-estimation` pipeline.

* Adding missing internal link to tutorial.
This commit is contained in:
Nicolas Patry 2022-11-16 09:52:45 +01:00 committed by GitHub
parent 1f029b6ae7
commit 4fb34de99e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -24,6 +24,21 @@ class DepthEstimationPipeline(Pipeline):
"""
Depth estimation pipeline using any `AutoModelForDepthEstimation`. This pipeline predicts the depth of an image.
Example:
```python
>>> from transformers import pipeline
>>> depth_estimator = pipeline(task="depth-estimation", model="Intel/dpt-large")
>>> output = depth_estimator("http://images.cocodataset.org/val2017/000000039769.jpg")
>>> # This is a tensor with the values being the depth expressed in meters for each pixel
>>> output["predicted_depth"].shape
torch.Size([1, 384, 384])
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
This depth estimation pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"depth-estimation"`.