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

Add docstrings for input type in YOLOTransform #308

Merged
merged 6 commits into from
Feb 12, 2022
Merged
Changes from all commits
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
18 changes: 18 additions & 0 deletions yolort/models/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,24 @@ def forward(
images: List[Tensor],
targets: Optional[List[Dict[str, Tensor]]] = None,
) -> Tuple[NestedTensor, Optional[Tensor]]:
"""
Perform letterboxing transformation.

Args:
images (List[Tensor]): Images to be processed. In general the type of images is a list
of 3-dim `Tensor`, except for the dataloader in training and evaluation, the `images`
will be a 4-dim `Tensor` in that case. Check out the belows link for more details:
https://github.com/zhiqwang/yolov5-rt-stack/pull/308#pullrequestreview-878689796
targets (List[Dict[Tensor]], optional): ground-truth boxes present in the image for
training. Default: None

Returns:
result (List[BoxList] or Dict[Tensor]): the output from the model.
During training, it returns a Dict[Tensor] which contains the losses.
During testing, it returns List[BoxList] contains additional fields
like `scores`, `labels` and `boxes`.
"""

device = images[0].device
images = [img for img in images]
if targets is not None:
Expand Down