Skip to content

speedup random forest getVotes method.#26046

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
ivafanas:speedup_random_forest_get_votes
Aug 20, 2024
Merged

speedup random forest getVotes method.#26046
asmorkalov merged 1 commit intoopencv:4.xfrom
ivafanas:speedup_random_forest_get_votes

Conversation

@ivafanas
Copy link
Copy Markdown

Speedup DTreesImplForRTrees::getVotes method in about x2 times.

Mat objects are usually not expensive for creation or copying. But if algorithm itself is fast, operations on Mat objects start to take significant time. Naive extraction of loop invariant temporary Mat wrapper object creation allows to decrease getVotes method run time in about x2 times.

@asmorkalov
Copy link
Copy Markdown
Contributor

The classic ml module was moved to opencv_contrib repo in 5.x branch. It means that the optimization will not be promoted to 5.x automatically. Could @ivafanas could you create yet another PR there. See https://github.com/opencv/opencv_contrib/blob/5.x/modules/ml/src/rtrees.cpp

@asmorkalov asmorkalov added the port to 5.x is needed Label for maintainers. Authors of PR can ignore this label Aug 20, 2024
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@asmorkalov asmorkalov self-assigned this Aug 20, 2024
@asmorkalov asmorkalov merged commit ec2e2da into opencv:4.x Aug 20, 2024
@ivafanas
Copy link
Copy Markdown
Author

Nice, I'll do that.

@asmorkalov asmorkalov added port/backport done Label for maintainers. Authors of PR can ignore this and removed port to 5.x is needed Label for maintainers. Authors of PR can ignore this labels Aug 27, 2024
@asmorkalov asmorkalov mentioned this pull request Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: ml optimization port/backport done Label for maintainers. Authors of PR can ignore this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants