mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #25312 from dkurt:dnn_hotfix_tflite
Ownership check in TFLite importer #25312 ### Pull Request Readiness Checklist resolves https://github.com/opencv/opencv/issues/25310 See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
99cacaaad6
commit
13c95efa74
@ -300,6 +300,10 @@ void TFLiteImporter::addLayer(LayerParams& layerParams, const Operator& op) {
|
||||
Mat blob = allTensors[idx];
|
||||
layerParams.blobs.push_back(blob.u ? blob : blob.clone()); // some tensors are owned by OpenCV
|
||||
}
|
||||
} else {
|
||||
for (auto& blob : layerParams.blobs) {
|
||||
CV_Assert(blob.u);
|
||||
}
|
||||
}
|
||||
|
||||
int dtype = CV_32F;
|
||||
@ -830,9 +834,6 @@ void TFLiteImporter::parseFullyConnected(const Operator& op, const std::string&
|
||||
auto options = op.builtin_options_as_FullyConnectedOptions();
|
||||
CV_Assert(options);
|
||||
|
||||
int idx = op.inputs()->Get(1);
|
||||
Mat weights = allTensors[idx];
|
||||
layerParams.blobs.resize(1, weights);
|
||||
layerParams.set("transB", true);
|
||||
layerParams.set("constB", true);
|
||||
addLayer(layerParams, op);
|
||||
|
@ -240,8 +240,6 @@ TEST_P(Test_TFLite, split) {
|
||||
}
|
||||
|
||||
TEST_P(Test_TFLite, fully_connected) {
|
||||
if (backend == DNN_BACKEND_CUDA)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_CUDA, CV_TEST_TAG_DNN_SKIP_CUDA_FP16);
|
||||
if (backend == DNN_BACKEND_VKCOM)
|
||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_VULKAN);
|
||||
testLayer("fully_connected");
|
||||
|
Loading…
Reference in New Issue
Block a user