Skip to content

Commit ee54baf

Browse files
committed
dnn: fix dnn python test files
1 parent e03569f commit ee54baf

File tree

5 files changed

+14
-27
lines changed

5 files changed

+14
-27
lines changed

modules/dnn/test/cityscapes_semsegm_test_enet.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
import fnmatch
55
import argparse
66

7-
# sys.path.append('<path to opencv_build_dir/lib>')
8-
sys.path.append('/home/arrybn/build/opencv_w_contrib/lib')
97
try:
108
import cv2 as cv
119
except ImportError:
12-
raise ImportError('Can\'t find opencv. If you\'ve built it from sources without installation, '
13-
'uncomment the line before and insert there path to opencv_build_dir/lib dir')
10+
raise ImportError('Can\'t find OpenCV Python module. If you\'ve built it from sources without installation, '
11+
'configure environemnt variable PYTHONPATH to "opencv_build_dir/lib" directory (with "python3" subdirectory if required)')
1412
try:
1513
import torch
1614
except ImportError:

modules/dnn/test/imagenet_cls_test_alexnet.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,16 @@
55
import argparse
66
import time
77

8-
# sys.path.append('<path to git/caffe/python dir>')
9-
sys.path.append('/home/arrybn/git/caffe/python')
108
try:
119
import caffe
1210
except ImportError:
13-
raise ImportError('Can\'t find caffe. If you\'ve built it from sources without installation, '
14-
'uncomment the line before and insert there path to git/caffe/python dir')
15-
# sys.path.append('<path to opencv_build_dir/lib>')
16-
sys.path.append('/home/arrybn/build/opencv_w_contrib/lib')
11+
raise ImportError('Can\'t find Caffe Python module. If you\'ve built it from sources without installation, '
12+
'configure environemnt variable PYTHONPATH to "git/caffe/python" directory')
1713
try:
1814
import cv2 as cv
1915
except ImportError:
20-
raise ImportError('Can\'t find opencv. If you\'ve built it from sources without installation, '
21-
'uncomment the line before and insert there path to opencv_build_dir/lib dir')
16+
raise ImportError('Can\'t find OpenCV Python module. If you\'ve built it from sources without installation, '
17+
'configure environemnt variable PYTHONPATH to "opencv_build_dir/lib" directory (with "python3" subdirectory if required)')
2218

2319

2420
class DataFetch(object):

modules/dnn/test/imagenet_cls_test_googlenet.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@
33
import os
44
import argparse
55
from imagenet_cls_test_alexnet import MeanChannelsFetch, CaffeModel, DnnCaffeModel, ClsAccEvaluation
6-
# sys.path.append('<path to git/caffe/python dir>')
7-
sys.path.append('/home/arrybn/git/caffe/python')
86
try:
97
import caffe
108
except ImportError:
11-
raise ImportError('Can\'t find caffe. If you\'ve built it from sources without installation, '
12-
'uncomment the line before and insert there path to git/caffe/python dir')
13-
# sys.path.append('<path to opencv_build_dir/lib>')
14-
sys.path.append('/home/arrybn/build/opencv_w_contrib/lib')
9+
raise ImportError('Can\'t find Caffe Python module. If you\'ve built it from sources without installation, '
10+
'configure environemnt variable PYTHONPATH to "git/caffe/python" directory')
1511
try:
1612
import cv2 as cv
1713
except ImportError:
18-
raise ImportError('Can\'t find opencv. If you\'ve built it from sources without installation, '
19-
'uncomment the line before and insert there path to opencv_build_dir/lib dir')
14+
raise ImportError('Can\'t find OpenCV Python module. If you\'ve built it from sources without installation, '
15+
'configure environemnt variable PYTHONPATH to "opencv_build_dir/lib" directory (with "python3" subdirectory if required)')
2016

2117
if __name__ == "__main__":
2218
parser = argparse.ArgumentParser()

modules/dnn/test/imagenet_cls_test_inception.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
import tensorflow as tf
66
from tensorflow.python.platform import gfile
77
from imagenet_cls_test_alexnet import MeanValueFetch, DnnCaffeModel, Framework, ClsAccEvaluation
8-
# sys.path.append('<path to opencv_build_dir/lib>')
9-
sys.path.append('/home/arrybn/build/opencv_w_contrib/lib')
108
try:
119
import cv2 as cv
1210
except ImportError:
13-
raise ImportError('Can\'t find opencv. If you\'ve built it from sources without installation, '
14-
'uncomment the line before and insert there path to opencv_build_dir/lib dir')
11+
raise ImportError('Can\'t find OpenCV Python module. If you\'ve built it from sources without installation, '
12+
'configure environemnt variable PYTHONPATH to "opencv_build_dir/lib" directory (with "python3" subdirectory if required)')
1513

1614
# If you've got an exception "Cannot load libmkl_avx.so or libmkl_def.so" or similar, try to export next variable
1715
# before runnigng the script:

modules/dnn/test/pascal_semsegm_test_fcn.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
import time
66

77
from imagenet_cls_test_alexnet import CaffeModel, DnnCaffeModel
8-
sys.path.append('/home/arrybn/build/opencv_w_contrib/lib')
98
try:
109
import cv2 as cv
1110
except ImportError:
12-
raise ImportError('Can\'t find opencv. If you\'ve built it from sources without installation, '
13-
'uncomment the line before and insert there path to opencv_build_dir/lib dir')
11+
raise ImportError('Can\'t find OpenCV Python module. If you\'ve built it from sources without installation, '
12+
'configure environemnt variable PYTHONPATH to "opencv_build_dir/lib" directory (with "python3" subdirectory if required)')
1413

1514

1615
def get_metrics(conf_mat):

0 commit comments

Comments
 (0)