nicolasdonati / DUO-FM

Implementation of CVPR2022 paper: "Deep orientation-aware functional maps: Tackling symmetry issues in Shape Matching".
23 stars 5 forks source link

Question about eval.py, plz help me #8

Open SeanSiyang opened 1 year ago

SeanSiyang commented 1 year ago

Hi, after reading the paper and your code implementation, it's really a great work!!!

However, when i use the ''eval.py'', and I enter the command: python eval.py --model_path data/trained_smal/ep_29.pth --config scape_r

Because I want to train the model on the Smal dataset and test it on the Scape dataset.

I encountered an error:

Traceback (most recent call last):
  File "eval.py", line 144, in <module>
    eval_net(cfg, args.model_path, args.predictions_name)
  File "eval.py", line 121, in eval_net
    err = eval_geodist(args, shape1, shape2, T_pred)
  File "eval.py", line 17, in eval_geodist
    MAT_s = sio.loadmat(path_geodist_shape2)
  File "/home/anaconda3/envs/fm2023/lib/python3.8/site-packages/scipy/io/matlab/_mio.py", line 224, in loadmat
    with _open_file_context(file_name, appendmat) as f:
  File "/home/anaconda3/envs/fm2023/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/home/anaconda3/envs/fm2023/lib/python3.8/site-packages/scipy/io/matlab/_mio.py", line 17, in _open_file_context
    f, opened = _open_file(file_like, appendmat, mode)
  File "/home/anaconda3/envs/fm2023/lib/python3.8/site-packages/scipy/io/matlab/_mio.py", line 45, in _open_file
    return open(file_like, mode), True
FileNotFoundError: [Errno 2] No such file or directory: 'geodist/mesh053.mat'

I tried my best to fix this bug, but I still couldn't make it work properly.

Can you give me some suggestions or solutions to fix this bug?

Thank you very much for your help. I hope you can make better research and wish you happiness.

Have a nice day~~

nicolasdonati commented 1 year ago

Hi, thanks for the interest !

You don't seem to have provided the geodesic distance matrices for your test set (here Scape). They are needed to compute the geodesic distance error. Some previous issue mentioned this and I pointed them to where they should look to compute these matrices. It be should also be on the Readme, if not I will take care of it soon :)

SeanSiyang commented 1 year ago

Hi, thanks for the interest !

You don't seem to have provided the geodesic distance matrices for your test set (here Scape). They are needed to compute the geodesic distance error. Some previous issue mentioned this and I pointed them to where they should look to compute these matrices. It be should also be on the Readme, if not I will take care of it soon :)

First of all, thanks for your reply :)

However, I didn't see any description of geodist on the Readme. It would be great if you can describe how to calculate the geometry in detail, or provide a demo. This would be great, as well as helping others use the DUO model more conveniently~

In another issue I found a description of calculating geodesic distance error, in the link below:

https://github.com/nicolasdonati/DUO-FM/issues/6#issuecomment-1321944189

I will try to use the method in this link, if I have a problem, hope to hear from you again, thank you very much for your reply~~ :)

SeanSiyang commented 1 year ago

Hi, thanks for the interest !

You don't seem to have provided the geodesic distance matrices for your test set (here Scape). They are needed to compute the geodesic distance error. Some previous issue mentioned this and I pointed them to where they should look to compute these matrices. It be should also be on the Readme, if not I will take care of it soon :)

I have made some new progress on calculating geodesic distances errors I'm very happy to have found code of matlab for computing geodesic distance errors in other repositories:

clear all
addpath('./Utils/');

sourcepath = '../exp/data/';
dataset = 'SCAPE_r'; %['FAUST_r' 'SCAPE_r' 'SHREC_r']  %name of the dataset
filetype = 'off';

datafolder = [sourcepath dataset '/shapes/'];
files = dir(fullfile([datafolder ''], ['*.' filetype]));
n_files = length(files);

max_spec_dim = 100;

for pts = 1:n_files

    Vname = [datafolder files(pts).name];
    sourcename = split(files(pts).name, '.');
    sourcename = sourcename{1};
    fprintf('%s\n', sourcename);

    S1 = read_off_shape(Vname);
    S1 = MESH.compute_LaplacianBasis(S1, max_spec_dim);
    sqrt_area = S1.sqrt_area;
    geodist = MESH.compute_geodesic_dist_matrix(S1);

    savefolder_geodist = [sourcepath dataset '/geodist/'];
    if ~exist(savefolder_geodist, 'dir')
       mkdir(savefolder_geodist)
    end
    save([savefolder_geodist sourcename '.mat'],'geodist', 'sqrt_area');
end

This code is from this link: https://github.com/LIX-shape-analysis/GeomFmaps/tree/master/MATLAB_Tools

I shared it here, I hope that the people who are interested in the shape correspondence can see this issue to solve the problem.

If I solve this problem using pyFM, I will share the code again. Have a nice day~

zzifer commented 1 year ago

嗨,感谢您的关注! 您似乎没有为您的测试集提供测地线距离矩阵(此处为 Scape)。需要它们来计算测地线距离误差。之前的一些问题提到了这一点,我向他们指出了他们应该在哪里计算这些矩阵。它也应该在自述文件中,如果没有,我会尽快处理它:)

我在计算测地线距离误差方面取得了一些新进展,我很高兴在其他存储库中找到了用于计算测地线距离误差的 matlab 代码:

clear all
addpath('./Utils/');

sourcepath = '../exp/data/';
dataset = 'SCAPE_r'; %['FAUST_r' 'SCAPE_r' 'SHREC_r']  %name of the dataset
filetype = 'off';

datafolder = [sourcepath dataset '/shapes/'];
files = dir(fullfile([datafolder ''], ['*.' filetype]));
n_files = length(files);

max_spec_dim = 100;

for pts = 1:n_files

    Vname = [datafolder files(pts).name];
    sourcename = split(files(pts).name, '.');
    sourcename = sourcename{1};
    fprintf('%s\n', sourcename);

    S1 = read_off_shape(Vname);
    S1 = MESH.compute_LaplacianBasis(S1, max_spec_dim);
    sqrt_area = S1.sqrt_area;
    geodist = MESH.compute_geodesic_dist_matrix(S1);

    savefolder_geodist = [sourcepath dataset '/geodist/'];
    if ~exist(savefolder_geodist, 'dir')
       mkdir(savefolder_geodist)
    end
    save([savefolder_geodist sourcename '.mat'],'geodist', 'sqrt_area');
end

此代码来自以下链接:https://github.com/LIX-shape-analysis/GeomFmaps/tree/master/MATLAB_Tools

我在这里分享了一下,希望对形状对应感兴趣的人能看到这个问题来解决问题。

如果我使用 pyFM 解决此问题,我将再次共享代码。 有好的一天~

Thanks for your help, but I get an error when running the file you provided. One is in the Utils/+MESH/compute_gedesic_dist_matrix.m file, the unrecognized field name "nv", I changed M.n = S.nv; to M.n = S.surface.nv;, then it can run but I don't know Is this correct? Another error is also in the Utils/+MESH/compute_gedesic_dist_matrix.m file. That is, the following line march = fastmarchmex('init', int32(M.TRIV-1), double(M.VERT(:,1)), double(M.VERT(:,2)), double(M. VERT(:,3)));, he told me that the function or variable 'fastmarchmex' cannot be recognized, but fastmarchmex seems to be in the /+MESH/private folder and he cannot be added to the path, so can you tell me How did you solve it? Thanks

zzifer commented 1 year ago

嗨,感谢您的关注! 您似乎没有为您的测试集提供测地线距离矩阵(此处为 Scape)。需要它们来计算测地线距离误差。之前的一些问题提到了这一点,我向他们指出了他们应该在哪里计算这些矩阵。它也应该在自述文件中,如果没有,我会尽快处理它:)

我在计算测地线距离误差方面取得了一些新进展,我很高兴在其他存储库中找到了用于计算测地线距离误差的 matlab 代码:

clear all
addpath('./Utils/');

sourcepath = '../exp/data/';
dataset = 'SCAPE_r'; %['FAUST_r' 'SCAPE_r' 'SHREC_r']  %name of the dataset
filetype = 'off';

datafolder = [sourcepath dataset '/shapes/'];
files = dir(fullfile([datafolder ''], ['*.' filetype]));
n_files = length(files);

max_spec_dim = 100;

for pts = 1:n_files

    Vname = [datafolder files(pts).name];
    sourcename = split(files(pts).name, '.');
    sourcename = sourcename{1};
    fprintf('%s\n', sourcename);

    S1 = read_off_shape(Vname);
    S1 = MESH.compute_LaplacianBasis(S1, max_spec_dim);
    sqrt_area = S1.sqrt_area;
    geodist = MESH.compute_geodesic_dist_matrix(S1);

    savefolder_geodist = [sourcepath dataset '/geodist/'];
    if ~exist(savefolder_geodist, 'dir')
       mkdir(savefolder_geodist)
    end
    save([savefolder_geodist sourcename '.mat'],'geodist', 'sqrt_area');
end

此代码来自以下链接:https://github.com/LIX-shape-analysis/GeomFmaps/tree/master/MATLAB_Tools 我在这里分享了一下,希望对形状对应感兴趣的人能看到这个问题来解决问题。 如果我使用 pyFM 解决此问题,我将再次共享代码。 有好的一天~

Thanks for your help, but I get an error when running the file you provided. One is in the Utils/+MESH/compute_gedesic_dist_matrix.m file, the unrecognized field name "nv", I changed M.n = S.nv; to M.n = S.surface.nv;, then it can run but I don't know Is this correct? Another error is also in the Utils/+MESH/compute_gedesic_dist_matrix.m file. That is, the following line march = fastmarchmex('init', int32(M.TRIV-1), double(M.VERT(:,1)), double(M.VERT(:,2)), double(M. VERT(:,3)));, he told me that the function or variable 'fastmarchmex' cannot be recognized, but fastmarchmex seems to be in the /+MESH/private folder and he cannot be added to the path, so can you tell me How did you solve it? Thanks

I found the cause of the second problem, which was that this file was running on windows and it had to be recompiled on linux

zzifer commented 1 year ago

Hi, thanks for the interest ! You don't seem to have provided the geodesic distance matrices for your test set (here Scape). They are needed to compute the geodesic distance error. Some previous issue mentioned this and I pointed them to where they should look to compute these matrices. It be should also be on the Readme, if not I will take care of it soon :)

I have made some new progress on calculating geodesic distances errors I'm very happy to have found code of matlab for computing geodesic distance errors in other repositories:

clear all
addpath('./Utils/');

sourcepath = '../exp/data/';
dataset = 'SCAPE_r'; %['FAUST_r' 'SCAPE_r' 'SHREC_r']  %name of the dataset
filetype = 'off';

datafolder = [sourcepath dataset '/shapes/'];
files = dir(fullfile([datafolder ''], ['*.' filetype]));
n_files = length(files);

max_spec_dim = 100;

for pts = 1:n_files

    Vname = [datafolder files(pts).name];
    sourcename = split(files(pts).name, '.');
    sourcename = sourcename{1};
    fprintf('%s\n', sourcename);

    S1 = read_off_shape(Vname);
    S1 = MESH.compute_LaplacianBasis(S1, max_spec_dim);
    sqrt_area = S1.sqrt_area;
    geodist = MESH.compute_geodesic_dist_matrix(S1);

    savefolder_geodist = [sourcepath dataset '/geodist/'];
    if ~exist(savefolder_geodist, 'dir')
       mkdir(savefolder_geodist)
    end
    save([savefolder_geodist sourcename '.mat'],'geodist', 'sqrt_area');
end

This code is from this link: https://github.com/LIX-shape-analysis/GeomFmaps/tree/master/MATLAB_Tools

I shared it here, I hope that the people who are interested in the shape correspondence can see this issue to solve the problem.

If I solve this problem using pyFM, I will share the code again. Have a nice day~

I tried to run the code you provided on Windows. But every time I run to Utils/+MESH/compute_geodesic_dist_matrix.m, when I run to d = fastmarchmex('march', march, double(source)); My matlab will crash. I don't know whether you have encountered the same problem, or it has something to do with my change of S.nv to S.surface.nv. I am looking forward to your reply