Skip to content

Commit

Permalink
openvino: Make checkNet to verify multiple layers
Browse files Browse the repository at this point in the history
  • Loading branch information
deradiri committed Jul 21, 2022
1 parent ed54000 commit f776143
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Dockerfile.opencv-openvino
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ 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"

ENV OPENCV_VERSION $OPENCV_VERSION

RUN curl -Lo opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
Expand Down Expand Up @@ -39,7 +41,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 && \
Expand Down
1 change: 0 additions & 1 deletion dnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 21 additions & 2 deletions dnn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down

0 comments on commit f776143

Please sign in to comment.