Skip to content

Commit a52d7a0

Browse files
authored
Docs: Use Image(mode="F") for PNG/JPEG depth maps (#7715)
png depth maps docs
1 parent d0aa000 commit a52d7a0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/source/depth_estimation.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ The dataset has two fields:
3737
* `image`: a PIL PNG image object with `uint8` data type.
3838
* `depth_map`: a PIL Tiff image object with `float32` data type which is the depth map of the image.
3939

40-
It is mention-worthy that JPEG/PNG format can only store `uint8` or `uint16` data. As the depth map is `float32` data, it can't be stored using PNG/JPEG. However, we can save the depth map using TIFF format as it supports a wider range of data types, including `float32` data.
40+
Here the depth maps are using TIFF format as it supports a wide range of data types, including `float32` data.
41+
However it is mention-worthy that JPEG/PNG format can only store `uint8` or `uint16` data.
42+
Therefore you have depth maps saved as JPEG/PNG, use the `Image(mode="F")` type to load them as single channel `float32` like normal depth maps:
43+
44+
```python
45+
>>> from datasets import Image
46+
47+
>>> train_dataset = train_dataset.cast_column("depth_map", Image(mode="F"))
48+
```
4149

4250
Next, check out an image with:
4351

0 commit comments

Comments
 (0)