Skip to content

Conversation

@mgumowsk
Copy link
Contributor

@mgumowsk mgumowsk commented Jan 22, 2025

What does this PR do?

Ready for python replacement, this will have the same structure results as python version:

  • AnomalyDetection
  • Classification
  • Detection
  • KeypointDetection
  • Segmentation

Still needs work:

  • InstanceSegmentation - this will be done in a separate PR

@mgumowsk mgumowsk requested a review from sovrasov January 23, 2025 08:05
@github-actions github-actions bot added the cpp C++ related changes label Jan 27, 2025
nb::class_<InstanceSegmentationResult, ResultBase>(m, "InstanceSegmentationResult")
.def(nb::init<int64_t, std::shared_ptr<MetaData>>(), nb::arg("frameId") = -1, nb::arg("metaData") = nullptr)
.def_prop_ro(
"feature_vector",
Copy link
Member

Choose a reason for hiding this comment

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

Iseg result also contains a saliency map as a vector of cv::Mat. Perhaps, it's not that easy to expose but there is a chance a vector of nb::ndarray<uint8_t... would work here

.def_prop_ro(
"soft_prediction",
[](ResultBase& r) {
ImageResultWithSoftPrediction ir = r.asRef<ImageResultWithSoftPrediction>();
Copy link
Member

Choose a reason for hiding this comment

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

Would that work if the result entity is actually an ImageResult?
In sseg wrapper now we have the following logic:

if (return_soft_prediction) {
  return a ptr to ImageResultWithSoftPrediction
}
else 
  return a ptr to ImageResult

infer() method's return type is a ptr to ImageResult. I think that kind of design looks weird an overall inconvenient, because we always need to check if type conversion to ImageResultWithSoftPrediction is successful.
Related refactoring can be done in subsequent PR, here we just need to be sure that both the cases return_soft_prediction==true/false are handled correctly

@sovrasov
Copy link
Member

Closed as outdated

@sovrasov sovrasov closed this Jun 24, 2025
@mgumowsk mgumowsk deleted the mgumowsk/CVS-160560-nanobindings branch August 26, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cpp C++ related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants