mirror of
https://github.com/opencv/opencv.git
synced 2025-06-16 06:40:49 +08:00
Merge pull request #10061 from Sahloul:dnn_torch_fix
This commit is contained in:
commit
bafdc44d37
@ -1198,6 +1198,16 @@ Mat readTorchBlob(const String &filename, bool isBinary)
|
|||||||
return importer->tensors.begin()->second;
|
return importer->tensors.begin()->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Net readNetFromTorch(const String &model, bool isBinary)
|
||||||
|
{
|
||||||
|
CV_TRACE_FUNCTION();
|
||||||
|
|
||||||
|
TorchImporter importer(model, isBinary);
|
||||||
|
Net net;
|
||||||
|
importer.populateNet(net);
|
||||||
|
return net;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
Ptr<Importer> createTorchImporter(const String&, bool)
|
Ptr<Importer> createTorchImporter(const String&, bool)
|
||||||
@ -1212,17 +1222,13 @@ Mat readTorchBlob(const String&, bool)
|
|||||||
return Mat();
|
return Mat();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
|
|
||||||
|
|
||||||
Net readNetFromTorch(const String &model, bool isBinary)
|
Net readNetFromTorch(const String &model, bool isBinary)
|
||||||
{
|
{
|
||||||
CV_TRACE_FUNCTION();
|
CV_Error(Error::StsNotImplemented, "Torch importer is disabled in current build");
|
||||||
|
return Net();
|
||||||
TorchImporter importer(model, isBinary);
|
|
||||||
Net net;
|
|
||||||
importer.populateNet(net);
|
|
||||||
return net;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif //defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
|
||||||
|
|
||||||
CV__DNN_EXPERIMENTAL_NS_END
|
CV__DNN_EXPERIMENTAL_NS_END
|
||||||
}} // namespace
|
}} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user