UI: Don't pass the shapes to the lambda function when continuing tracking #9548
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and context
Currently, the UI always passes the current shape points when calling the tracker function. When initializing the tracking state, this makes sense.
However, when continuing tracking, the utility of this is dubious.
The point coordinates passed in this way are those for the previous frame; however, the function does not have access to that frame itself. Therefore, it cannot examine the pixel data that the shape covers.
In every case, these shapes are data that the function has already seen: it's either the shape that the function received in the initial request, or the shape that the function has output in the previous request. Therefore, if the function really needs this data, it can already ensure access to it by including it into the tracking state.
OTOH, including the shapes has some downsides:
It's unnecessary data bloating the request. For rectangles, this isn't a big deal, but for, say, masks the extra data could be significant.
It complicates the mental model for the tracker API.
Because of all this, this patch removes the passing of the shapes.
This is a breaking change. However, none of the example trackers in this repository use the previous-frame shapes, and neither does the private SAM2 tracker, so chances are that most 3rd-party trackers won't either. I have included compatibility code that passes a dummy
shapes
array to the Nuclio function, so that code that relies on its length will still work.How has this been tested?
I have tried using TransT and SiamMask (and they still work).
Checklist
develop
branch[ ] I have updated the documentation accordingly[ ] I have added tests to cover my changes[ ] I have linked related issues (see GitHub docs)License
Feel free to contact the maintainers if that's a concern.