Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0/1D test for tile layer #25409

Open
wants to merge 7 commits into
base: 5.x
Choose a base branch
from

Conversation

Abdurrahheem
Copy link
Contributor

This PR introduces 0/1D test for Tile layer. It also add fuctionality to support 0/1D cases.

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

@Abdurrahheem Abdurrahheem added this to the 5.0 milestone Apr 13, 2024
@Abdurrahheem Abdurrahheem self-assigned this Apr 13, 2024
@Abdurrahheem Abdurrahheem marked this pull request as ready for review April 14, 2024 07:57
@Abdurrahheem Abdurrahheem changed the title 0D test for tile layer 0/1D test for tile layer Apr 14, 2024
@asmorkalov asmorkalov assigned dkurt and unassigned Abdurrahheem Apr 15, 2024
modules/dnn/src/layers/tile_layer.cpp Outdated Show resolved Hide resolved
modules/dnn/test/test_layers_1d.cpp Outdated Show resolved Hide resolved
@Abdurrahheem
Copy link
Contributor Author

@dkurt could you please give quick look if this PR good?

@Abdurrahheem
Copy link
Contributor Author

@dkurt added removed tests

@Abdurrahheem
Copy link
Contributor Author

@dkurt anything else?

@dkurt dkurt added the backport is needed Label for maintainers. Authors of PR can ignore this label Apr 26, 2024
@dkurt dkurt removed the backport is needed Label for maintainers. Authors of PR can ignore this label May 7, 2024
Comment on lines +88 to +106
if (ndims > 1){
for (int i = 0; i < ndims; i++)
{
rep_i = repeats[i];
if (rep_i != 1)
{
tmp = tmp.reshape(0, dims);
tmp = cv::repeat(tmp, 1, rep_i);
}
dims *= out_shape[i];
}
tmp = tmp.reshape(0, out_shape);
} else {
for (int i = 0; i < repeats.size(); i++){
tmp = tmp.reshape(0, dims);
tmp = cv::repeat(tmp, 1, rep_i);
tmp = cv::repeat(tmp, repeats[i], 1);
dims *= out_shape[i];
}
dims *= out_shape[i];
tmp = tmp.reshape(0, out_shape);
Copy link
Member

Choose a reason for hiding this comment

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

Do these changes imply we need to do something to cv::repeat so that it can be used in the same way regardless 1D or 2D mat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

may be. @dkurt what do you think?

outputs[0][i] *= repeats[i];
}
} else {
CV_CheckGE((int)repeats.size(), 1, "Provide at least one repeat along any dimention");
Copy link
Contributor

Choose a reason for hiding this comment

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

"Tile: Provide at least one repeat along any dimension"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants