-
Notifications
You must be signed in to change notification settings - Fork 251
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
Extension type improvements to support 3d types #173
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits.
raise ValueError("ndims must be equal to compute IOU") | ||
size_self = self._box_sizes() | ||
if self is others: | ||
size_others = size_self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just return np.array([1, 1, 1, 1, ...])
here?
Otherwise, this seems to just save one compute of box sizes? i feel that it is not necessary at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's all-pairs so even if we're doing box_arr.iou(box_arr), it should return a matrix of ious no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then it returns a np.ones(shape=(self.array.length, self.array.length))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would it return all ones? If you have a list of boxes, box_i.iou(box_j) won't always be 1?
) | ||
|
||
def get_length(self, axis: Union[int, str]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we make a new name of it?
i.e, a 2d box (rectangle) has width / length , but this get_length()
is actually capable to get both IIUC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. This is the edge length along a given dimension.
how about get_edge_len
?
return self.get_max("y") | ||
|
||
def _box_sizes(self): | ||
sizes = self.get_length(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we do
sizes = np.ones_like(self.dims[0])
for i in range(self.ndims):
sizes *= self.get_length(i)
Or prob a reduce
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wanted to save the allocation and one array mult operation. i guess reduce could work well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to using np.multiply.reduce
4335361
to
5db9ef5
Compare
Support point2d, box 2d/3d
Also added polygon 2d/3d to support segmentation