Skip to content

feat!: (object detection) RF-detr support, generic model support#826

Open
chmjkb wants to merge 12 commits intomainfrom
@chmjkb/object-detection-generic
Open

feat!: (object detection) RF-detr support, generic model support#826
chmjkb wants to merge 12 commits intomainfrom
@chmjkb/object-detection-generic

Conversation

@chmjkb
Copy link
Collaborator

@chmjkb chmjkb commented Feb 23, 2026

Description

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

Run demo app with RF-DETR model

Screenshots

Related issues

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@chmjkb chmjkb force-pushed the @chmjkb/object-detection-generic branch from 4969b41 to 35c6056 Compare February 25, 2026 13:55
@chmjkb chmjkb marked this pull request as ready for review February 25, 2026 17:48
@chmjkb chmjkb marked this pull request as draft February 25, 2026 17:48
@chmjkb chmjkb marked this pull request as ready for review February 26, 2026 09:40
@msluszniak msluszniak added the feature PRs that implement a new feature label Feb 26, 2026
Comment on lines +33 to +39
ObjectDetection::ObjectDetection(
const std::string &modelSource, std::vector<float> normMean,
std::vector<float> normStd, std::shared_ptr<react::CallInvoker> callInvoker)
: ObjectDetection(modelSource, callInvoker) {
if (normMean.size() == 3) {
normMean_ = std::move(normMean);
} else if (!normMean.empty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add doxygen comments in here for these functions.


ObjectDetection::ObjectDetection(
const std::string &modelSource, std::vector<float> normMean,
std::vector<float> normStd, std::shared_ptr<react::CallInvoker> callInvoker)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add test with passing normMean and normStd

@msluszniak msluszniak linked an issue Feb 26, 2026 that may be closed by this pull request
Copy link
Member

@msluszniak msluszniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be cool if someone else also check this PR.

}
if (normStd.size() == 3) {
normStd_ = std::move(normStd);
} else if (!normStd.empty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to emit this warning for empty vectors as well?

Copy link
Contributor

@NorbertKlockiewicz NorbertKlockiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion the computer vision example app should by default use the rf-detr model as a default (currently it's using ssdLite)

std::shared_ptr<react::CallInvoker> callInvoker);
[[nodiscard("Registered non-void function")]] std::vector<types::Detection>
generate(std::string imageSource, double detectionThreshold);
generate(std::string imageSource, double detectionThreshold,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we load the model the labelNames shouldn't change, thus shouldn't we pass them in constructor?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also you should update the tests to use new signature as currently it fails:
error: too few arguments to function call, expected 3, have 2

image_processing::readImageToTensor(imageSource, getAllInputShapes()[0]);
ObjectDetection::generate(std::string imageSource, double detectionThreshold,
std::vector<std::string> labelNames) {
std::optional<cv::Scalar> mean =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do it once in the constructor and store std::optional<\cv::Scalar> mean/std as a class members instead of std::vector<\float>

…ject_detection/Constants.h

Co-authored-by: Mateusz Sluszniak <56299341+msluszniak@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PRs that implement a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a generic interface for object detection

3 participants