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

add image-level feature support #320

Merged
merged 3 commits into from
Mar 31, 2018
Merged

add image-level feature support #320

merged 3 commits into from
Mar 31, 2018

Conversation

Lamply
Copy link
Contributor

@Lamply Lamply commented Mar 30, 2018

Resize Cx1x1 feature map to CxHxW, use in DeepLabv3 etc.

@@ -56,26 +62,42 @@ int Interp::forward(const Mat &bottom_blob, Mat &top_blob) const
if (top_blob.empty())
return -100;

if (resize_type == 1)//nearest
if (resize_type == 1 || bottom_blob.dims == 1)//nearest
Copy link
Member

Choose a reason for hiding this comment

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

If bottom_blob is a vector, the resize_type is ignored. move this condition out of resize_type path.

if (bottom_blob.dims == 1)
{
    // handle this special case, ignore resize_type

    return 0;
}

// all the following code shall not be changed
if (resize_type == 1)//nearest
{
}

{
const float *ptr = ((float*)bottom_blob.data+q);
float *output_ptr = top_blob.channel(q);
for (int i = 0; i < top_blob.cstep; ++i)
Copy link
Member

Choose a reason for hiding this comment

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

This is what the Mat::fill() does

@@ -56,26 +62,38 @@ int Interp::forward(const Mat &bottom_blob, Mat &top_blob) const
if (top_blob.empty())
return -100;

if (bottom_blob.dims == 1)
{
#pragma omp parallel for
Copy link
Member

Choose a reason for hiding this comment

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

always use space, not tab

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, thanks

for (int q = 0; q < c; ++q)
{
const float *ptr = bottom_blob.channel(q);
float *output_ptr = top_blob.channel(q);
Copy link
Member

Choose a reason for hiding this comment

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

keep the ident space of this block

@nihui nihui merged commit 9748c00 into Tencent:master Mar 31, 2018
ghimiredhikura pushed a commit to ghimiredhikura/NCNNSFD that referenced this pull request Jul 26, 2020
* add image-level feature support

* move special case out

* tab to space
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.

None yet

2 participants