Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
ONNX diagnostic tool corrections#19693
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| CV_Assert(!model.empty()); | ||
| setDiagnosticsRun(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
it's not good to alter DNN behaviour by setting a global variable. It would be better to have an overloaded variant of readNet() that will pass the corresponding flags to the importers w/o affecting global state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I prefer adding global variable instead of exploding of public API.
API parameters should cover regular usage and don't confuse users.
It is some kind of logging utilities. Even in functional world nobody brings logger instance parameter into each function.
This approach allows to keep this patch small.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| //! Unregisters registered layer with specified type name. Thread-safe. | ||
| staticvoidunregisterLayer(const String &type); | ||
| staticconst std::map<String,int>&getRegisteredLayers() {return registeredTypes; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
std::map<String, int>
Why do we needstd::map here?
Can we use simplestd::vector<std::string> here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Removed this map, reused already existingLayerFactory_Impl map (moved it into private header), it has the same content.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| staticvoidunregisterLayer(const String &type); | ||
| //! Get the types of layers which were registered. | ||
| staticconst std::map<String,int>&getRegisteredLayers(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
std::map<String, int>
Why do we needstd::map in public API? Usestd::vector instead.
String
Usestd::string in new API.
If you need to optimize access withO(log(N)) insteadO(N), then buildstd::set / hash_map / etc internally. Do not expose that to public API.
std::set does not work with OpenCV bindings, so it should be avoided in public API.
LupusSanctusMar 23, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@alalek, corrected, reused already existingLayerFactory_Impl.
| private: | ||
| LayerFactory(); | ||
| static std::map<String,int>&_getRegisteredLayers(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Remove that from public headers.
All "private" members should be eliminated from public header, seehttps://github.com/opencv/opencv/wiki/Coding_Style_Guide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Corrected, addedlayer_reg.private.hpp.
d81f111 to4144e70CompareLupusSanctus commentedMar 26, 2021
@alalek, corrected code, required tests passed. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
alalek commentedMar 29, 2021
Please update changelog highlights too:https://github.com/opencv/opencv/wiki/ChangeLog#version452 |
ONNX diagnostic tool* Final* Add forgotten Normalize layer to the set of supported types* ONNX diagnostic tool corrections* Fixed CI test warnings* Added code minor correctionsCo-authored-by: Sergey Slashchinin <sergei.slashchinin@xperience.ai>
Uh oh!
There was an error while loading.Please reload this page.
Relates to: PR#19420
Patch to opencv_extra has the same branch name.