Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【PPSCI Doc No.1】ppsci.data.process.transform.CropData #687

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ppsci/data/process/transform/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,24 @@ 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").

Returns:
CropData: An instance of the CropData class.

Liyulingyue marked this conversation as resolved.
Show resolved Hide resolved
Examples:
>>> import ppsci
>>> import numpy as np
>>> crop_data = ppsci.data.transform.CropData((0, 0), (720, 1440))
>>> input_item = {"input": np.zeros((1, 3, 720, 1440))}
>>> label_item = {"label": np.zeros((1, 3, 720, 1440))}
>>> weight_item = {"weight": np.ones((1, 3, 720, 1440))}
>>> input_item, label_item, weight_item = crop_data(input_item, label_item, weight_item)
Liyulingyue marked this conversation as resolved.
Show resolved Hide resolved
"""

def __init__(
Expand Down