Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 85d38ff

Browse files
committed
doc fixes
1 parent c4e3f77 commit 85d38ff

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

allennlp/modules/vision/region_detector.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,32 @@
1111

1212

1313
class RegionDetectorOutput(NamedTuple):
14+
"""
15+
The output type from the forward pass of a `RegionDetector`.
16+
"""
17+
1418
features: List[Tensor]
19+
"""
20+
A list of tensors, each with shape `(num_boxes, feature_dim)`.
21+
"""
22+
1523
boxes: List[Tensor]
24+
"""
25+
A list of tensors containing the coordinates for each box. Each has shape `(num_boxes, 4)`.
26+
"""
27+
1628
class_probs: Optional[List[Tensor]] = None
29+
"""
30+
An optional list of tensors. These tensors can have shape `(num_boxes,)` or
31+
`(num_boxes, *)` if probabilities for multiple classes are given.
32+
"""
33+
1734
class_labels: Optional[List[Tensor]] = None
35+
"""
36+
An optional list of tensors that give the labels corresponding to the `class_probs`
37+
tensors. This should be non-`None` whenever `class_probs` is, and each tensor
38+
should have the same shape as the corresponding tensor from `class_probs`.
39+
"""
1840

1941

2042
class RegionDetector(nn.Module, Registrable):
@@ -29,7 +51,8 @@ class RegionDetector(nn.Module, Registrable):
2951
- `boxes` (`List[Tensor]`): The coordinates of each region within the original image, with shape
3052
`(num_boxes, 4)`.
3153
- `class_probs` (`Optional[List[Tensor]]`): Class probabilities from some object
32-
detector that was used to find the regions of interest, with shape `(num_predicted_classes,)`.
54+
detector that was used to find the regions of interest, with shape `(num_boxes,)`
55+
or `(num_boxes, *)` if probabilities for more than one class are given.
3356
- `class_labels` (`Optional[List[Tensor]]`): The labels corresponding to `class_probs`.
3457
Each tensor in this list has the same shape as the corresponding tensor in `class_probs`.
3558

0 commit comments

Comments
 (0)