Conversation
bounding_box = (
bounding_box.clone()
if format == features.BoundingBoxFormat.XYXY
else convert_format_bounding_box(bounding_box, old_format=format, new_format=features.BoundingBoxFormat.XYXY)
)IMO, this is too bulky. I do not mind to have |
Same here with the focus on consistency. If one Vasilis argument was that besides for I'm ok with or without the |
datumbox
left a comment
There was a problem hiding this comment.
LGTM, only one comment below.
|
@datumbox @pmeier can we do the following:
bounding_box = convert_format_bounding_box(
bounding_box.clone(), old_format=format, new_format=features.BoundingBoxFormat.XYXY
)? |
|
@vfdev-5 that would make our only operator that does in-place ops (outside of the optimizations that have no effect). If we were to go down that route, purely for speed reasons, I would recommend adopting the |
Conflicts: torchvision/prototype/features/_image.py torchvision/prototype/features/_video.py
Summary: * remove copy from convert_color_space * remove copy from convert_format_bounding_box * remove .to_* methods from features * remove unnecessary clones * add perf todos * refactor convert_color_space * lint * remove another clone * and another clone * remove a missed copy Reviewed By: YosuaMichael Differential Revision: D40722906 fbshipit-source-id: 3b757af1b69fcd85b085a5df9ff88cdaeafca130
This PR stems from the discussion in #6783 (comment). @datumbox and I agreed to the following things:
Let's not have a
copyflag on ourconvert_*kernels. It is currently unused forconvert_color_space. It is used extensively forconvert_bounding_boxin our kernels due the idiom of converting to a specific format, performing the computation, and converting back. In the future, we wanted to have a look at these kernels anyway for possible performance gains by implementing the computation for every format. After this PR the current implementation likechanges to
Let's not have any
.to_*()methods on the features. While useful for debugging, they go against the other idioms we are using. We can always re-add them later if there is user demand for it. Note thatLabel.to_categories()is an exception since it has no transformation associated with it.cc @vfdev-5 @datumbox @bjuncek