Skip to content

G-API: IE. Adding support for INT32 type.#19792

Merged
alalek merged 6 commits intoopencv:masterfrom
mpashchenkov:mp/ie-add-int32
Mar 29, 2021
Merged

G-API: IE. Adding support for INT32 type.#19792
alalek merged 6 commits intoopencv:masterfrom
mpashchenkov:mp/ie-add-int32

Conversation

@mpashchenkov
Copy link
Copy Markdown
Contributor

@mpashchenkov mpashchenkov commented Mar 26, 2021

Summary:

  • This PR should solve problem with semantic-segmentation-adas-0001 network.
  • Added support for int32 input and output;
  • Added sample for semantic-segmentation-adas-0001.

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 other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to 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

Magic:

force_builders=Custom,Custom Win,Custom Mac
build_gapi_standalone:Linux x64=ade-0.1.1f
build_gapi_standalone:Win64=ade-0.1.1f
build_gapi_standalone:Mac=ade-0.1.1f
build_gapi_standalone:Linux x64 Debug=ade-0.1.1f

Xbuild_image:Custom=centos:7
Xbuildworker:Custom=linux-1
build_gapi_standalone:Custom=ade-0.1.1f

build_image:Custom=ubuntu-openvino-2021.1.0:20.04
build_image:Custom Win=openvino-2021.1.0
build_image:Custom Mac=openvino-2021.1.0

test_modules:Custom=gapi
test_modules:Custom Win=gapi
test_modules:Custom Mac=gapi

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

{ 230, 0, 0 },
{ 32, 11, 119 },
{ 0, 74, 111 },
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These two things above can be stored into config namespace not to leave it without namespace..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What do you want to use namespace for here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm, actually the goal is just to use namespace. To have all the supporting stuff in one place and be sure you're referring to the them right

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tend do agree, config::colors or config::keys would be easier to read when you see it in the code below

CV_Assert(ext == ".xml");
return model_path.substr(0u, sz - EXT_LEN) + ".bin";
}
} // anonymous namespace
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it's not really needed to store it in an anonymous namespace.
Maybe, to one of around - below or above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, need.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So, at your discretion whether to move it into, for example, custom namespace below

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we have this feature already? I believe someone in the team has proposed that a while ago -- only passing .xml so that .bin is identified automatically

validate();
}

#if INF_ENGINE_RELEASE >= 2020010000
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why such #if needed in there, if it's handled inside giewrapper

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is for findDataFile(). For age gender we can find path for old IE. I don't know old path for semantic segmentation. And old IE isn't tested now, old path for network is deprecated.

old path - look at std::string SUBDIR *

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should I delete it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed test.

Maxim Pashchenkov added 2 commits March 29, 2021 11:56
@mpashchenkov mpashchenkov added this to the 4.5.2 milestone Mar 29, 2021
Copy link
Copy Markdown
Contributor

@OrestChura OrestChura left a comment

Choose a reason for hiding this comment

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

Everything's great, thanks. Some cavils are not important

{ 230, 0, 0 },
{ 32, 11, 119 },
{ 0, 74, 111 },
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm, actually the goal is just to use namespace. To have all the supporting stuff in one place and be sure you're referring to the them right

CV_Assert(ext == ".xml");
return model_path.substr(0u, sz - EXT_LEN) + ".bin";
}
} // anonymous namespace
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So, at your discretion whether to move it into, for example, custom namespace below

Copy link
Copy Markdown
Contributor

@dmatveev dmatveev left a comment

Choose a reason for hiding this comment

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

Please prioritize merge

{ 230, 0, 0 },
{ 32, 11, 119 },
{ 0, 74, 111 },
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tend do agree, config::colors or config::keys would be easier to read when you see it in the code below

CV_Assert(ext == ".xml");
return model_path.substr(0u, sz - EXT_LEN) + ".bin";
}
} // anonymous namespace
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we have this feature already? I believe someone in the team has proposed that a while ago -- only passing .xml so that .bin is identified automatically

}
};

GAPI_OCV_KERNEL(OCVPostProcessing, PostProcessing) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd call it "colorize" or smt like this

Comment on lines +78 to +80
cv::resize(maskImg, out, in.size());
const float blending = 0.3f;
out = in * blending + out * (1 - blending);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd move it out of the kernel, if possible, and make it part of the graph.

Custom kernel could only produce a mask, and the rest done with our standard ops.

There are performance reasons to do that (e.g. involving a fluid backend for *, +, 1- and so on)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again, it can be done after we merge this fix itself, so just take all sample-related comments as a to-do

Copy link
Copy Markdown
Contributor

@TolyaTalamanov TolyaTalamanov left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@alalek I believe it can be merged

@alalek alalek merged commit e700766 into opencv:master Mar 29, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
G-API: IE. Adding support for INT32 type.

* Added support for int32

* Added sample for semantic-segmentation-adas-0001

* Alignment

* Alignment 2

* Rstrt build

* Removed test for sem seg
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.

5 participants