Open MisEty opened 1 year ago
你好,我想问一下我在执行setup.py这个文件时出现
`FAILED: /home/benben/code/SC-wLS/dsacstar/build/temp.linux-x86_64-cpython-38/dsacstar.o
c++ -MMD -MF /home/benben/code/SC-wLS/dsacstar/build/temp.linux-x86_64-cpython-38/dsacstar.o.d -pthread -B /home/benben/anaconda3/envs/SCwLS/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/opencv3.4/include -I/home/benben/anaconda3/envs/SCwLS/lib/python3.8/site-packages/torch/include -I/home/benben/anaconda3/envs/SCwLS/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/benben/anaconda3/envs/SCwLS/lib/python3.8/site-packages/torch/include/TH -I/home/benben/anaconda3/envs/SCwLS/lib/python3.8/site-packages/torch/include/THC -I/home/benben/anaconda3/envs/SCwLS/include/python3.8 -c -c /home/benben/code/SC-wLS/dsacstar/dsacstar.cpp -o /home/benben/code/SC-wLS/dsacstar/build/temp.linux-x86_64-cpython-38/dsacstar.o -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=dsacstar -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/benben/code/SC-wLS/dsacstar/dsacstar_util.h:37:0,
from /home/benben/code/SC-wLS/dsacstar/dsacstar.cpp:42:
/home/benben/code/SC-wLS/dsacstar/dsacstar_util_rgbd.h: In function ‘void matMulDerivWrapper(cv::InputArray, cv::InputArray, cv::OutputArray, cv::OutputArray)’:
/home/benben/code/SC-wLS/dsacstar/dsacstar_util_rgbd.h:222:22: error: cannot convert ‘cv::Mat’ to ‘int’ for argument ‘1’ to ‘CvMat cvMat(int, int, int, void*)’
CvMat matA = cvMat(A), matB = cvMat(B), c_dABdA = cvMat(_dABdA.getMat()), c_dABdB = cvMat(_dABdB.getMat());
^
/home/benben/code/SC-wLS/dsacstar/dsacstar_util_rgbd.h:223:28: error: ‘matB’ was not declared in this scope
cvCalcMatMulDeriv(&matA, &matB, _dABdA.needed() ? &c_dABdA : 0, _dABdB.needed() ? &c_dABdB : 0);
^~~~
/home/benben/code/SC-wLS/dsacstar/dsacstar_util_rgbd.h:223:28: note: suggested alternative: ‘matA’
cvCalcMatMulDeriv(&matA, &matB, _dABdA.needed() ? &c_dABdA : 0, _dABdB.needed() ? &c_dABdB : 0);
^~~~
matA
/home/benben/code/SC-wLS/dsacstar/dsacstar_util_rgbd.h:223:53: error: ‘c_dABdA’ was not declared in this scope
cvCalcMatMulDeriv(&matA, &matB, _dABdA.needed() ? &c_dABdA : 0, _dABdB.needed() ? &c_dABdB : 0);
^~~
/home/benben/code/SC-wLS/dsacstar/dsacstar_util_rgbd.h:223:53: note: suggested alternative: ‘_dABdA’
cvCalcMatMulDeriv(&matA, &matB, _dABdA.needed() ? &c_dABdA : 0, _dABdB.needed() ? &c_dABdB : 0);
^~~
_dABdA
/home/benben/code/SC-wLS/dsacstar/dsacstar_util_rgbd.h:223:85: error: ‘c_dABdB’ was not declared in this scope
cvCalcMatMulDeriv(&matA, &matB, _dABdA.needed() ? &c_dABdA : 0, _dABdB.needed() ? &c_dABdB : 0);
^~~
/home/benben/code/SC-wLS/dsacstar/dsacstar_util_rgbd.h:223:85: note: suggested alternative: ‘_dABdB’
cvCalcMatMulDeriv(&matA, &matB, _dABdA.needed() ? &c_dABdA : 0, _dABdB.needed() ? &c_dABdB : 0);
^~~
_dABdB
In file included from /home/benben/code/SC-wLS/dsacstar/dsacstar.cpp:42:0:
/home/benben/code/SC-wLS/dsacstar/dsacstarutil.h: In function ‘std::vector<cv::Point^
/home/benben/code/SC-wLS/dsacstar/dsacstar_util.h: In function ‘std::vector^~~~~~~
/home/benben/code/SC-wLS/dsacstar/dsacstar_util.h: In function ‘std::vector<float, std::allocator^~~~~~~
/home/benben/code/SC-wLS/dsacstar/dsacstar_util.h: In function ‘void dsacstar::refineHyp_seq(dsacstar::coordts&, const std::vector<float, std::allocator^~~~~~~
/home/benben/code/SC-wLS/dsacstar/dsacstar.cpp: In function ‘void dsacstar_rgb_forward(at::Tensor, at::Tensor, int, float, float, float, float, float, float, int)’:
/home/benben/code/SC-wLS/dsacstar/dsacstar.cpp:302:9: warning: unused variable ‘hypEntropy’ [-Wunused-variable]
double hypEntropy = dsacstar::entropy(hypProbs); // measure distribution entropy
^~~~~~
/home/benben/code/SC-wLS/dsacstar/dsacstar.cpp: In function ‘double dsacstar_rgb_backward(at::Tensor, at::Tensor, at::Tensor, int, float, float, float, float, float, float, float, float, float, int, int)’:
/home/benben/code/SC-wLS/dsacstar/dsacstar.cpp:456:9: warning: unused variable ‘hypEntropy’ [-Wunused-variable]
double hypEntropy = dsacstar::entropy(hypProbs); // measure distribution entropy
^~~~~~
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/benben/anaconda3/envs/SCwLS/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1666, in _run_ninja_build
subprocess.run(
File "/home/benben/anaconda3/envs/SCwLS/lib/python3.8/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "setup.py", line 36, in
应该是opencv版本的问题,按照readme所说,您应该先安装opencv=3.4.15版本并且在setup.py中设置对应的路径,再进行编译
I want to reproduce the results and test the released code with the following command:
python test_e2e_DLT.py <dataset path> --dataset 7Scenes --scene chess --config_file configs/single_frame.ini --model DenseSC_GNN --pretrained-model checkpoints/7scenes_unsup_model/chess/model.pkl
The code run successfuly, and the output is:val loader: 2000 median t,r error for DLT: 0.021533024 0.6407075225990593 ptc5 for DLT: 0.886
I noticed that the result in the paper is "Ours (dlt) 0.029/0.78". The results are differen. Can you show the right command of the paper's results?
Update: I also test another command and it seems that the results of end-to-end model is OK:
python test_e2e_DLT.py /home/pengzhexi/camera_relocalization/dataset/7scenes --dataset 7Scenes --scene pumpkin -b 1 --config_file configs/single_frame.ini --model DenseSC_GNN --pretrained-model checkpoints/7scenes_e2e_model/pumpkin/model.pkl
The outputs are equal to paperUpdate 4.18: I try to run SC-wLS on my dataset and I have processed my data in 7Scene format. I want to use the 7Scene dataloader but the code need
coords_mean.txt
file. Can you tell me the influence if I use zero instead, and how can I compute this file?Update 4.19: I try to use 7Scene dataloader to run my data and I have done the following steps: first, resize my rgb images to 640*480; second, change the camera K to my resized camera (
[[373.3, 0, 308.67], [0, 497.7, 249.2], [0, 0, 1]]
); third, compute the mean of gt camera pose translation asscene_mean
. I only use 50 reference images as a simple test but the result is not good. Here scene coordinate initialization network best output:t_median q_median lr 3.5635636 1.4805614300851522 0.0001
I also test 50 reference in 7scene chess dataset:t_median q_median lr 0.05904792 0.815205435638383 0.0001
Are there other important parameters that I should change?Sincerely, thank you.
Hi, thanks for your attention! To be clear, I would answer the questions in order:
The commands for test
We provide two types of models for --pretrained-model
here . One is *_e2e_model
, which is the model for Ours (dlt+e2e)
(The command you need). The other is *_unsup_model
for Ours (dlt+e2e+self)
, which is finetuned using test set (after self-supervised test-time adaptation).
coords_mean.txt We follow Dsac* to use the mean value of scene coordinates for training scene coordinate regression network. It's used here, and then the network could learn the residual of scene coordinate instead. The motivation of using the mean value is illustrated in this issue.
To calculate the mean coordinate value of your scenes, you could refer to these code.
Firstly, you could change the pose solver to RANSAC to see whether the problem happens on the training step of scene coordinate network initialization. If the views are too sparse, or the scene is too chanllenge, the training of scene coordinate network could fail.
Secondly, if the RANSAC results are good, you could turn to train our OANet-like weight network for each scene, and calculate dlt results finally.
Thanks for your reply. The test demo of my dataset is an outdoor scene of 50 images for reference and 1 image for query. The images are captured from continue scan so the views are quite close and the pose is computed by BundleFusion. I will debug my code as you suggest and update the results!
Update 4.30
I have checked my camera K, it is right. But the results of Scene coordinate initialization are still wrong. I run the training process by command:
python train_init.py ./datasets/OurScan --dataset OurScan --scene demo -b1 --epochs 150 --config_file configs/single_frame.ini --lr 1e-4 --cal_training_pose --model DenseSC
The best outputs are:
t_median q_median lr
5.743898 2.7037772337783856 0.0001
Then, I train the weight network with --useRANSAC
, the best outputs are:
t_median q_median t_med_ransac q_med_ransac lr
0.7095688 83.66632369089574 7.291292 1.9391857944064714 0.0001
I noticed that the avg loss of Scene coordinate initialization seems OK(my data: 19.232, chess: 16.431) but the output poses are wrong. The poses are computed by compute_pose_lm_pnp
so can you tell me the possible reason
Update 5.1: I find that the DenseSC network use SCNet/DROID in 7 scene/Other scene. Previously I used DROID and the predicted 3d points got a lot of deviation. I have changed it to SCNet and the results are much better. Can you tell me the difference between the two network?
Update 5.3: SC-wLS works well when I only use 500 images for reference. However, although I have changed the model to SCNet, SC-wLS still cannot work on my full scene which is much bigger than 7scenes dataset (7000 reference images of indoor scene, about 100m2). I wonder that can SC-wLS handle such a big indoor scene?
I want to reproduce the results and test the released code with the following command:
python test_e2e_DLT.py <dataset path> --dataset 7Scenes --scene chess --config_file configs/single_frame.ini --model DenseSC_GNN --pretrained-model checkpoints/7scenes_unsup_model/chess/model.pkl
The code run successfuly, and the output is:val loader: 2000 median t,r error for DLT: 0.021533024 0.6407075225990593 ptc5 for DLT: 0.886
I noticed that the result in the paper is "Ours (dlt) 0.029/0.78". The results are differen. Can you show the right command of the paper's results?
Update: I also test another command and it seems that the results of end-to-end model is OK:
python test_e2e_DLT.py /home/pengzhexi/camera_relocalization/dataset/7scenes --dataset 7Scenes --scene pumpkin -b 1 --config_file configs/single_frame.ini --model DenseSC_GNN --pretrained-model checkpoints/7scenes_e2e_model/pumpkin/model.pkl
The outputs are equal to paperUpdate 4.18: I try to run SC-wLS on my dataset and I have processed my data in 7Scene format. I want to use the 7Scene dataloader but the code need
coords_mean.txt
file. Can you tell me the influence if I use zero instead, and how can I compute this file?Update 4.19: I try to use 7Scene dataloader to run my data and I have done the following steps: first, resize my rgb images to 640*480; second, change the camera K to my resized camera (
[[373.3, 0, 308.67], [0, 497.7, 249.2], [0, 0, 1]]
); third, compute the mean of gt camera pose translation asscene_mean
. I only use 50 reference images as a simple test but the result is not good. Here scene coordinate initialization network best output:t_median q_median lr 3.5635636 1.4805614300851522 0.0001
I also test 50 reference in 7scene chess dataset:t_median q_median lr 0.05904792 0.815205435638383 0.0001
Are there other important parameters that I should change?Sincerely, thank you.