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

Extension type improvements to support 3d types #173

Merged
merged 2 commits into from
Sep 19, 2022

Conversation

changhiskhan
Copy link
Contributor

Support point2d, box 2d/3d

Also added polygon 2d/3d to support segmentation

@changhiskhan changhiskhan requested a review from eddyxu September 19, 2022 01:29
Copy link
Contributor

@eddyxu eddyxu left a 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
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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))?

Copy link
Contributor Author

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]):
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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 .

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@changhiskhan changhiskhan force-pushed the changhiskhan/extensions-3d branch from 4335361 to 5db9ef5 Compare September 19, 2022 20:12
@changhiskhan changhiskhan merged commit c47eaaf into main Sep 19, 2022
@changhiskhan changhiskhan deleted the changhiskhan/extensions-3d branch September 19, 2022 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants