Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using UGM_makeEdgeVEC #8

Open
TJ1451154 opened this issue Apr 4, 2020 · 15 comments
Open

Error using UGM_makeEdgeVEC #8

TJ1451154 opened this issue Apr 4, 2020 · 15 comments

Comments

@TJ1451154
Copy link

TJ1451154 commented Apr 4, 2020

hello, Thank you for sharing your code.
my operating system is ubuntu16.04. I downloaded UGM_2011.zip and compiled it successfully.
when i run benchmark.m:
Error using UGM_makeEdgeVEC
Requested 4296291607x7311422349372966656 (17179869184.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and
cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in UGM_makeEdgeVE (line 11)
[V,E] = UGM_makeEdgeVEC(int32(edgeEnds),int32(nNodes));

Error in UGM_makeEdgeStruct (line 26)
[V,E] = UGM_makeEdgeVE(edgeEnds,nNodes,useMex);

Error in LBP_sum_product (line 21)
edgeStruct = UGM_makeEdgeStruct(adjacency,nClasses,1);

Error in benchmark (line 37)
[p_lpb_sp, T] = LBP_sum_product(initial_classif, graph, .5, 10);

@loicland
Copy link
Owner

loicland commented Apr 4, 2020

Could you show the values of int32(edgeEnds) and int32(nNodes)?

@TJ1451154
Copy link
Author

TJ1451154 commented Apr 4, 2020

Could you show the values of int32(edgeEnds) and int32(nNodes)?
when run LBP sum product method.
input 1324310
[V,E] = UGM_makeEdgeVE(edgeEnds,nNodes,useMex)
edgeEnds=7291304X2 int32 matrix
nNodes=1324310 int32
I changed the input and reduced the number of input points.
input 100000
[V,E] = UGM_makeEdgeVE(edgeEnds,nNodes,useMex)
edgeEnds 544574X2 int32 matrix
nNodes 100000 int32
But the program also reports an error:
Error using UGM_makeEdgeVEC
Requested 4296291607x7903554357059420160 (17179869184.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and
cause MATLAB to become unresponsive. See array size limit or preference panel for more information.

@loicland
Copy link
Owner

loicland commented Apr 4, 2020

Please note that UGM is not my code.

Requested 4296291607x7903554357059420160 array

clearly your inputs are wrong. Set useMex to 0 in the call to UGM_makeEdgeStruct to have a more useful error.

Further questions: are you working on the Oakland dataset? Could you write the size and first values of graph.source and graph.target?

@TJ1451154
Copy link
Author

TJ1451154 commented Apr 5, 2020

Thank you very much for your help.
after running the following code:
graph = build_graph_structure('oakland.ply',10,0,0);
load('oakland_RF', 'initial_classif');
load('oakland_GT', 'ground_truth'); %MUST BE UINT8
the values are as follows:
graph.XYZ= 1324310 _x_3 single graph.source=1458208 _x_1 int32
graph.target=14582608_x_1 int32 graph.edge_weight=14582608_x_1 single
initial_classif'=1324310_x_5 single ground_truth=1324310_x_1 unit8
when running function : edgeStruct = UGM_makeEdgeStruct(adjacency,nClasses,1);
adjacency=1324310_x_1324310 nClasses=5,

can you give me some suggestions? can you tell me which step is wrong?
best wishes

@loicland
Copy link
Owner

loicland commented Apr 5, 2020

Can you repalce
edgeStruct = UGM_makeEdgeStruct(adjacency,nClasses,1)
by
edgeStruct = UGM_makeEdgeStruct(adjacency,nClasses,0)

and add two prints in UGM_makeEdgeStruct:

...
nNodes = int32(length(adj));
fprintf(nNodes )
[i j] = ind2sub([nNodes nNodes],find(adj));
nEdges = length(i)/2;
fprintf(nEdges )
...

@TJ1451154
Copy link
Author

TJ1451154 commented Apr 5, 2020

hello, when running edgeStruct = UGM_makeEdgeStruct(adjacency,nClasses,0)
'''''
nNodes = int32(length(adj))
%fprintf(nNodes )
[i j] = ind2sub([nNodes nNodes],find(adj));
nEdges = length(i)/2
%fprintf(nEdges)
''''
nNodes =
int32
1324310

nEdges =
7291304

Error using UGM_Infer_LBPC
Requested 21474836485x139689523626408x139689042948512 (17179869184.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a
long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.

Error in UGM_Infer_LBP (line 4)
[nodeBel,edgeBel,logZ] = UGM_Infer_LBPC(nodePot,edgePot,int32(edgeStruct.edgeEnds),int32(edgeStruct.nStates),int32(edgeStruct.V),int32(edgeStruct.E),edgeStruct.maxIter);

Error in LBP_sum_product (line 30)
[nodeBelLBP] = UGM_Infer_LBP(unary,binary,edgeStruct);

Error in benchmark (line 37)
[p_lpb_sp, T] = LBP_sum_product(initial_classif, graph, .5, 10);

@TJ1451154
Copy link
Author

Thank you very much for your reply, can you give me some further suggestions?
best wishes

@loicland
Copy link
Owner

loicland commented Apr 6, 2020

Have you tried repalcing

edgeStruct = UGM_makeEdgeStruct(adjacency,nClasses,1)

by

edgeStruct = UGM_makeEdgeStruct(adjacency,nClasses,0)

I hope that the MALAB error would be more explicit than the C error.

@TJ1451154
Copy link
Author

TJ1451154 commented Apr 7, 2020

Thank you very much for your help.
First,I run the following code:
graph = build_graph_structure('oakland.ply',10,0,0);
load('oakland_RF', 'initial_classif');
load('oakland_GT', 'ground_truth'); %MUST BE UINT8
[p_lpb_sp, T] = LBP_sum_product(initial_classif, graph, .5, 10);
the values are as follows:

graph

     initial_classif'=1324310_x_5 single 
     ground_truth=1324310_x_1 unit8

Then, step in function LBP_sum_product, and running following code :
'''
nClasses = size(initial_labeling,2);
%it is necessary to have a symetric structure for this algorithm
adjacency = sparse(double(graph.source)+1,double(graph.target)+1 ...
, double(graph.edge_weight));
edgeStruct = UGM_makeEdgeStruct(adjacency,nClasses,0);
unary = initial_labeling;
transition = single(ones(nClasses));
transition(logical(eye(nClasses))) = single(exp(lambda));
binary = repmat(transition, [1 1 edgeStruct.nEdges]);
edgeStruct.useMex = 1;
edgeStruct.maxIter = int32(maxIte);
tic;
clear('V','adj')
[nodeBelLBP] = UGM_Infer_LBP(unary,binary,edgeStruct);
''''
the values are as follows:
in UGM_makeEdgeStruct: adjacency=1324310_x_1324310 nClasses=5,

   in UGM_Infer_LBP:   unary=1324310_x_5 single martix,
                                      binary=5_x_5_x_7291304
                                  edgeStruct in attachment

  edgeStruct
Finally, when running function UGM_Infer_LBPC
Error using UGM_Infer_LBPC
Requested 21474836485x140149085127080x140149207314848 (17179869184.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a
long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
Error in UGM_Infer_LBP (line 4)
[nodeBel,edgeBel,logZ] = UGM_Infer_LBPC(nodePot,edgePot,int32(edgeStruct.edgeEnds),int32(edgeStruct.nStates),int32(edgeStruct.V),int32(edgeStruct.E),edgeStruct.maxIter);

Error in LBP_sum_product (line 30)
[nodeBelLBP] = UGM_Infer_LBP(unary,binary,edgeStruct);

Error in benchmark (line 37)
[p_lpb_sp, T] = LBP_sum_product(initial_classif, graph, .5, 10);

@loicland
Copy link
Owner

loicland commented Apr 7, 2020

Right, so makeEdgeStruct seems to be working correctly.

Can you replace line 26 of LBP_sum_product:

edgeStruct.useMex  = 1;

by

edgeStruct.useMex  = 0;

to again have more informative errors.

Then in GM/infer/UGM_Infer_LBP, could you add just before
new_msg = UGM_LoopyBP(nodePot,edgePot,edgeStruct,maximize);
the following prints:

fprintf(V);
fprintf(E);
fprintf(nEdges);
fprintf(nStates(0:10));

@TJ1451154
Copy link
Author

Thank you very much for your help.
I replaced line 26 of LBP_sum_product, edgeStruct.useMex = 0;
when running function UGM_Infer_LBPC,
before function new_msg = UGM_LoopyBP(nodePot,edgePot,edgeStruct,maximize)

the values are as follows:
edgepot
nodepot
VE-values
when running function new_msg = UGM_LoopyBP(nodePot,edgePot,edgeStruct,maximize);
The matlab displays busy all the time, and does not display errors.

@loicland
Copy link
Owner

loicland commented Apr 7, 2020

Do you end up with a satisfying results? How long oes it take? I'm guessing a long time.

If the matlab versions woks but the C version not, most likely there is a bug. You could try to add:

mexPrintf(nNodes);
mexPrintf(maxState );
mexPrintf(nEdges);

in /UGM/mex/UGM_infer_LBPC.c and recompile the mex files.

@TJ1451154
Copy link
Author

1.wait about 20minutes and don"t have any results.
2. I add the code and recompile the mex files.
The matlab still displays busy all the time, and does not display errors.

@loicland
Copy link
Owner

loicland commented Apr 7, 2020

interupt the matlab code, it is going to take ages. Set the maxIte to 1 and relaunch it.

edgeStruct.maxIter = int32(maxIte);

It would be interesting to see if the MATLAB code function. Also, monitor your RAM use while doing it.

@TJ1451154
Copy link
Author

Thank you very much for your help.
when set maxIte to 1, matlab doesn't report errors
but matlab display : Loopy did not converge
Loopy did not converge
CLASSE PRECISION RECALL F_SCORE
1 0.1 100.0 0.1
2 NaN 0.0 NaN
3 NaN 0.0 NaN
4 NaN 0.0 NaN
5 NaN 0.0 NaN
MEAN NaN 20.0 0.1
KAPPA = 0.0 ACCURACY = 0.1
moreover, the cpu usage of matlab is 100%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants