From b55ebc172a6cd7198de14521f2ba9629fef45fda Mon Sep 17 00:00:00 2001 From: Doupamo Eradiri Date: Thu, 21 Jul 2022 16:51:40 +0900 Subject: [PATCH] openvino: Make checkNet verify multiple layers --- Dockerfile.opencv-openvino | 6 +++--- dnn.cpp | 1 - dnn_test.go | 23 +++++++++++++++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Dockerfile.opencv-openvino b/Dockerfile.opencv-openvino index c16e8d2e..0f34278c 100644 --- a/Dockerfile.opencv-openvino +++ b/Dockerfile.opencv-openvino @@ -5,10 +5,11 @@ LABEL maintainer="hybridgroup" ENV DEBIAN_FRONTEND=noninteractive USER root RUN apt-get update && apt-get install -y --no-install-recommends \ - git build-essential cmake pkg-config unzip libgtk2.0-dev \ + git build-essential cmake pkg-config unzip libgtk2.0-dev libgtk-3-0 \ wget curl ca-certificates libcurl4-openssl-dev libssl-dev \ libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev \ - libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev && \ + libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev libcanberra-gtk-module \ + libcanberra-gtk3-module && \ rm -rf /var/lib/apt/lists/* ARG OPENCV_VERSION="4.6.0" @@ -39,7 +40,6 @@ RUN curl -Lo opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_VERSIO -D BUILD_opencv_python3=NO \ -D WITH_TBB=ON \ -D WITH_OPENVINO=1 \ - -D ENABLE_FAST_MATH=1 \ -D OPENCV_GENERATE_PKGCONFIG=ON .. && \ make -j $(nproc --all) && \ make preinstall && make install && ldconfig && \ diff --git a/dnn.cpp b/dnn.cpp index 9c9f931f..6cca38bb 100644 --- a/dnn.cpp +++ b/dnn.cpp @@ -143,7 +143,6 @@ void Net_GetLayerNames(Net net, CStrings* names) { names->length = cstrs.size(); names->strs = strs; - return; } Mat Net_BlobFromImage(Mat image, double scalefactor, Size size, Scalar mean, bool swapRB, diff --git a/dnn_test.go b/dnn_test.go index e4474bf7..1d690976 100644 --- a/dnn_test.go +++ b/dnn_test.go @@ -56,8 +56,27 @@ func checkNet(t *testing.T, net Net) { t.Errorf("Invalid len layer names in ReadNet test: %d\n", len(lnames)) } - if len(lnames) == 142 && lnames[1] != "conv1/relu_7x7" { - t.Errorf("Invalid layer name in ReadNet test: %s\n", lnames[1]) + m := map[int]string{ + 0: "conv1/7x7_s2", + 10: "inception_3a/1x1", + 20: "inception_3a/pool", + 30: "inception_3b/5x5_reduce", + 40: "inception_4a/relu_1x1", + 50: "inception_4a/pool_proj", + 60: "inception_4b/relu_5x5_reduce", + 70: "inception_4c/relu_3x3_reduce", + 80: "inception_4c/output", + 90: "inception_4d/relu_5x5", + 100: "inception_4e/relu_3x3", + 110: "inception_5a/1x1", + 120: "inception_5a/pool", + 130: "inception_5b/5x5_reduce", + 140: "loss3/classifier"} + + for k, v := range m { + if lnames[k] != v { + t.Errorf("Invalid layer name in ReadNet test: \"%s\" (expected=\"%s\")\n", lnames[k], v) + } } prob := net.ForwardLayers([]string{"prob"})