【发布时间】:2014-05-15 05:54:36
【问题描述】:
大家!
我正在尝试并行化使用来自 mexopencv(KNearest.m、KNearest_.mexw32)的 mex 文件的算法。
程序是基于vlfeat(vlsift.mex32)+mexopencv(KNearest.m和KNearest_.mexw32)。我对从图片中得到的描述符进行分类。
所有代码都位于文件共享中
\\ LAB-07 \ untitled \ DISTRIB \ (this is the program code)
\\ LAB-07 \ untitled \ + cv (mexopencv)
当我使用 matlabpool close 运行程序时,一切正常。
然后我打开 matlabpool(每台 2 核上的 2 台计算机。最终 4 名工人,但现在我只用于测试计算机上的 2 名工人并运行程序) 来自文件共享的路径依赖 -> \LAB-07\untitled\DISTRIB\ , \LAB-07\untitled+cv
在 parfor 循环之前,我在本地机器上训练分类器
classifiers = cv.KNearest
classifiers.train(Descriptors',Labels','MaxK',1)
然后运行 parfor
descr=vlsift(img);
PredictClasses = classifiers.predict(descr');
错误
Error in ==> KNearest>KNearest.find_nearest at 173
Invalid MEX-file '\\LAB-07\untitled\+cv\private\KNearest_.mexw32':
The specified module could not be found.
即 KNearest.m 找到,但没有 KNearest_.mexw32。因为 KNearest_.mexw32 位于私人文件夹中,所以我将代码 KNearest.m (它呼吁的所有地方 KNearest_ () 更改为 cv.KNearest_ ()。示例:this.id = сv.KNearest_ ())并放置在一个文件夹中KNearest_.mexw32 KNearest.m。结果,得到同样的错误
matlabpool 在worker上打开文件搜索后立即
pctRunOnAll which ('KNearest.m')
'KNearest.m' not found.
'KNearest.m' not found.
'KNearest.m' not found.
pctRunOnAll which ('KNearest_.mexw32')
'KNearest_.mexw32' not found.
'KNearest_.mexw32' not found.
'KNearest_.mexw32' not found.
在 cd \LAB-07\untitled+cv 之后
pctRunOnAll which ('KNearest.m')
\\LAB-07\untitled\+cv\KNearest.m
\\LAB-07\untitled\+cv\KNearest.m % cv.KNearest constructor
\\LAB-07\untitled\+cv\KNearest.m
>> pctRunOnAll which ('KNearest_.mexw32')
\\LAB-07\untitled\+cv\KNearest_.mexw32
\\LAB-07\untitled\+cv\KNearest_.mexw32
\\LAB-07\untitled\+cv\KNearest_.mexw32
我跑了和FileDependecies,但结果一样。
我不知道这是否相关,我在程序执行期间显示分类器 训练之后和parfor之前
classifiers =
cv.KNearest handle
Package: cv
Properties:
id: 5
MaxK: 1
VarCount: 128
SampleCount: 9162
IsRegression: 0
Methods, Events, Superclasses
在parfor 之前的classifiers.predict 内
classifiers =
cv.KNearest handle
Package: cv
Properties:
id: 5
我测试了文件 cvtColor.mexw32。我在一个文件夹中只留下了 2 个文件 cvtColor.mexw32 和 vl_sift
parfor i=1:2
im1=imread('Copy_of_start40.png');
im_vl = im2single(rgb2gray(im1));
desc=vl_sift(im_vl);
im1 = cvtColor(im1,'RGB2GRAY');
end
同样的错误,并且vl_sift工作,cvtColor没有...
【问题讨论】:
标签: matlab opencv parallel-processing private parfor