1

私はコードセグメントを持っています

display('Descriptor Extraction...');

DESCRIPTORS = {};
descriptor_for_each_class = {};
num_classes = length(imgs_dir);
IMAGES = {};
for i = 1:num_classes
    class_name = classes{i};
    fprintf('Feature Extraction for CLASS %s\n',class_name);
    full_path = fullfile(imgs_path,class_name);

    class_dir = dir(full_path);
    image_names = {class_dir(3:length(class_dir)).name};
    num_imgs = length(image_names);

    descriptors = {};
    parfor j = 1:num_imgs
        image_name = image_names{j};
        %fprintf('Feature Extraction for IMAGE %d/%d\n',j,num_imgs);
        img_path = fullfile(full_path,image_name);
        I = imread(img_path(:,:));
        I = standarizeImage(I);
        I = rgb2gray(I) ;
        IMAGES{i,j}.I = I;
        IMAGES{i,j}.class_name = class_name;
        IMAGES{i,j}.name = image_name;
        [f, d] = vl_dsift(I, 'size', binSize) ;
        descriptors{j}=d;
    end
    DESCRIPTORS = [DESCRIPTORS descriptors];
end

そして、parfor セクションが 1 つのエポックを完了すると、2 番目のエポックの開始時に、Matlab は次のエラーを返します。

Error using parallel_function (line 589)
Assertion failed.

Error in feat_extraction (line 34)
    parfor j = 1:num_imgs  

コードにバグは見つかりませんでした。アイデアはありますか?

4

1 に答える 1

2

以下のように parfor セクションを変更することで問題を解決します

descriptors = {};
    images = {};
    parfor j = 1:num_imgs
        image_name = image_names{j};
        %fprintf('Feature Extraction for IMAGE %d/%d\n',j,num_imgs);
        img_path = fullfile(full_path,image_name);
        I = imread(img_path(:,:));
        images{j}.I = I;
        images{j}.class_name = class_name;
        images{j}.image_name = image_name;
        I = standarizeImage(I);
        I = rgb2gray(I) ;
        %IMAGES{i,j}.name = image_name;
        [f, d] = vl_dsift(I, 'size', binSize) ;
        descriptors{j}=d;
    end
    ALL_DATA{i}=images;
    DESCRIPTORS = [DESCRIPTORS descriptors];
end
于 2013-03-05T14:44:07.913 に答える