Skip to content

Commit

Permalink
【PPSCI Doc No.1】ppsci.data.process.transform.CropData (PaddlePaddle#687)
Browse files Browse the repository at this point in the history
* add discribe

* Apply suggestions from code review

* Update ppsci/data/process/transform/preprocess.py

Co-authored-by: HydrogenSulfate <[email protected]>

---------

Co-authored-by: HydrogenSulfate <[email protected]>
  • Loading branch information
Liyulingyue and HydrogenSulfate authored Dec 20, 2023
1 parent fa63860 commit 6c42a84
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ppsci/data/process/transform/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,25 @@ def __call__(self, input_item, label_item, weight_item):
class CropData:
"""Crop data class.
This class is used to crop data based on a specified bounding box.
Args:
xmin (Tuple[int, ...]): Bottom left corner point, [x0, y0].
xmax (Tuple[int, ...]): Top right corner point, [x1, y1].
apply_keys (Tuple[str, ...], optional): Which data is the crop method applied to. Defaults to ("input", "label").
Examples:
>>> import ppsci
>>> crop_data = ppsci.data.transform.CropData((0, 0), (720, 1440))
>>> import numpy as np
>>> crop_data = ppsci.data.transform.CropData((0, 0), (256, 512))
>>> input_item = {"input": np.zeros((3, 720, 1440))}
>>> label_item = {"label": np.zeros((3, 720, 1440))}
>>> weight_item = {"weight": np.ones((3, 720, 1440))}
>>> input_item, label_item, weight_item = crop_data(input_item, label_item, weight_item)
>>> print(input_item["input"].shape)
(3, 256, 512)
>>> print(label_item["label"].shape)
(3, 256, 512)
"""

def __init__(
Expand Down

0 comments on commit 6c42a84

Please sign in to comment.