Skip to content

TrackerVit: Add support for loading model from memory buffer#26295

Closed
Quantizs wants to merge 1 commit intoopencv:4.xfrom
Quantizs:feature-create-vittrack-from-buffer
Closed

TrackerVit: Add support for loading model from memory buffer#26295
Quantizs wants to merge 1 commit intoopencv:4.xfrom
Quantizs:feature-create-vittrack-from-buffer

Conversation

@Quantizs
Copy link
Copy Markdown
Contributor

  • Extended the TrackerVit::Params structure to include an optional std::vector modelBuffer for loading models directly from memory.
  • Updated TrackerVitImpl to check if the modelBuffer is not empty, and if so, load the model from memory using dnn::readNetFromONNX.
  • If the modelBuffer is empty, the model continues to be loaded from the file path specified in Params::net, ensuring backward compatibility.
  • This enhancement provides flexibility for scenarios where models are loaded from in-memory sources rather than file paths.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

- Extended the TrackerVit::Params structure to include an optional
  std::vector<uchar> `modelBuffer` for loading models directly from memory.
- Updated TrackerVitImpl to check if the `modelBuffer` is not empty, and if so,
  load the model from memory using `dnn::readNetFromONNX`.
- If the `modelBuffer` is empty, the model continues to be loaded from the file
  path specified in `Params::net`, ensuring backward compatibility.
- This enhancement provides flexibility for scenarios where models are loaded
  from in-memory sources rather than file paths.
@asmorkalov
Copy link
Copy Markdown
Contributor

Replaced by #26875

@asmorkalov asmorkalov closed this Feb 6, 2025
asmorkalov added a commit that referenced this pull request Feb 14, 2025
Added trackers factory with pre-loaded dnn models #26875

Replaces #26295

Allows to substitute custom models or initialize tracker from in-memory model.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
NanQin555 pushed a commit to NanQin555/opencv that referenced this pull request Feb 24, 2025
Added trackers factory with pre-loaded dnn models opencv#26875

Replaces opencv#26295

Allows to substitute custom models or initialize tracker from in-memory model.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
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