Repository navigation
Deep networks visualization - #14255
Conversation
| * @param path path to output file with .dot extension | ||
| * To see correct backend, target and fusion run after forward(). | ||
| */ | ||
| void dumpNet(String path); |
There was a problem hiding this comment.
For testing purposes it is better to dump into string as primary functionality.
Storing into files can be an additional method.
String
Should be const String& for input parameters.
| void Net::dumpNet(String path) { | ||
| CV_Assert(!empty()); | ||
|
|
||
| std::ofstream file(path); |
There was a problem hiding this comment.
To dump into string use:
std::ostringstream out;
| * @returns String with structure, hyperparameters, backend, target and fusion | ||
| * To see correct backend, target and fusion run after forward(). | ||
| */ | ||
| CV_WRAP String dumpNet(); |
There was a problem hiding this comment.
Method dump is a cv::Net's method. So cv::Net::dumpNet. I think that we can name them just dump() and dumpToFile.
| } | ||
| if (lp.has("pad")) { | ||
| DictValue pad = lp.get("pad"); | ||
| out << "pad (HxW): " << pad << "x" << pad << "x" << pad << "x" << pad << "\\l"; |
dkurt
left a comment
There was a problem hiding this comment.
@l-bat, The graphs looks fascinating, thank you!
I wanted to ask you to experiment with adding layer's output shapes. Just numbers delimited by "x" right before backend/target line. In this way we can emit num_output entry for convolutions.
| } | ||
| } | ||
| if (!it->second.outputBlobs.empty()) | ||
| out << "output shapes: " << it->second.outputBlobs[0].size << "\\l"; |
There was a problem hiding this comment.
I think that's it's better to name it just output:.
Please also iterate by it->second.outputBlobs[0].size and print dimensions delimited by "x". For now it adds extra whitespaces.
There was a problem hiding this comment.
Fix name, added whitespaces everywhere " x ".
| out << (!it->second.backendNodes[prefBackend].empty() ? backend : "OCV/"); | ||
| int colorId = 0; | ||
| switch (it->second.layerInstance->preferableTarget) { | ||
| case DNN_TARGET_CPU: out << "CPU\\n"; colorId = (backend == "OCV/") ? 0 : 5; break; |
| int colorId = 0; | ||
| switch (it->second.layerInstance->preferableTarget) { | ||
| case DNN_TARGET_CPU: out << "CPU\\n"; colorId = (layerBackend.empty() || | ||
| layerBackend->backendId == DNN_BACKEND_OPENCV) ? 0 : 5; break; |
There was a problem hiding this comment.
I think we can check just layerBackend.empty() because OpenCV's implementation is not wrapped as a BackendNode.
3bd5259 to
c50de63
Compare
|
It would be nice to add some test case for that.
|
* Add networks visualization * Disable CXX11 * Fixed multy inputs support * Added output shapes * Added color for DLIE/CPU * Fixed graph colors

Fixes #9452