Git Product home page Git Product logo

pyceres's People

Contributors

ducha-aiki avatar joshuaoreilly avatar nnop avatar pablospe avatar phil26at avatar sarlinpe avatar skydes avatar tobias-fischer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyceres's Issues

colmap is changed

now colmap updated so need modification in bundle.cc

for example,
colmap/camera/models.h isn't in that directory but in colmap/sensor/models.h

because of that pyceres build error i currently can't build pixel-perfect-sfm :(

Pyceres install fails in Nerfstudio Dockerfile

Describe the bug
Pyceres build fails in dockerfile

To Reproduce
Steps to reproduce the behavior:

  1. Clone Nerfstudio git repository
  2. Run docker build --no-cache
    --build-arg CUDA_VERSION=11.8.0
    --build-arg CUDA_ARCHITECTURES=86
    --build-arg OS_VERSION=22.04
    --tag nerfstudio-86
    --file Dockerfile .
  3. Error occurs

Expected behavior
Pyceres successfully builds.

Screenshots
image

Additional context
Running on Ubuntu 22.04 Server with RTX 3060. NVCTK is installed along with appropriate CUDA toolkit and NVIDIA drivers.
See Log for full error here
Dockerfile_log.txt

add_library cannot create imported target "glog::glog" because another target with the same name already exists.

Hi, i've installed Ceres,Colmap,and met this error:

pip install -e .
× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [145 lines of output]
    running develop
    /home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    /home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running egg_info
    writing pyceres.egg-info/PKG-INFO
    writing dependency_links to pyceres.egg-info/dependency_links.txt
    writing requirements to pyceres.egg-info/requires.txt
    writing top-level names to pyceres.egg-info/top_level.txt
    reading manifest file 'pyceres.egg-info/SOURCES.txt'
    writing manifest file 'pyceres.egg-info/SOURCES.txt'
    running build_ext
    -- Found METIS: /usr/include (found suitable version "5.1.0", minimum required is "5.1.0")
    -- Found AMD headers in: /usr/include/suitesparse
    -- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
    -- Found CAMD headers in: /usr/include/suitesparse
    -- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
    -- Found CCOLAMD headers in: /usr/include/suitesparse
    -- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
    -- Found CHOLMOD headers in: /usr/include/suitesparse
    -- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
    -- Found COLAMD headers in: /usr/include/suitesparse
    -- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
    -- Found SPQR headers in: /usr/include/suitesparse
    -- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
    -- Found Config headers in: /usr/include/suitesparse
    -- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
    -- Found Intel Thread Building Blocks (TBB) library (2020.1 / 11101) include location: . Assuming SuiteSparseQR was compiled with TBB.
    -- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
    -- Found METIS: /usr/include (found version "5.1.0")
    -- Found required Ceres dependency: Eigen version 3.4.0 in /usr/local/share/eigen3/cmake
    -- Found required Ceres dependency: glog
    -- Found required Ceres dependency: gflags
    -- Found Ceres version: 2.2.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, SchurSpecializations, Multithreading]
    -- Found METIS: /usr/include (found suitable version "5.1.0", minimum required is "5.1.0")
    -- Found AMD headers in: /usr/include/suitesparse
    -- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
    -- Found CAMD headers in: /usr/include/suitesparse
    -- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
    -- Found CCOLAMD headers in: /usr/include/suitesparse
    -- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
    -- Found CHOLMOD headers in: /usr/include/suitesparse
    -- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
    -- Found COLAMD headers in: /usr/include/suitesparse
    -- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
    -- Found SPQR headers in: /usr/include/suitesparse
    -- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
    -- Found Config headers in: /usr/include/suitesparse
    -- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
    -- Found Intel Thread Building Blocks (TBB) library (2020.1 / 11101) include location: . Assuming SuiteSparseQR was compiled with TBB.
    -- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
    -- Found METIS: /usr/include (found version "5.1.0")
    -- Found required Ceres dependency: Eigen version 3.4.0 in /usr/local/share/eigen3/cmake
    CMake Error at /usr/local/lib/cmake/Ceres/FindGlog.cmake:349 (add_library):
      add_library cannot create imported target "glog::glog" because another
      target with the same name already exists.
    Call Stack (most recent call first):
      /usr/local/lib/cmake/Ceres/CeresConfig.cmake:248 (find_package)
      /usr/local/share/colmap/COLMAPConfig.cmake:92 (find_package)
      CMakeLists.txt:14 (find_package)
    
    
    -- Found required Ceres dependency: glog
    -- Found required Ceres dependency: gflags
    -- Found Ceres version: 2.2.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, SchurSpecializations, Multithreading]
    -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: program_options filesystem system unit_test_framework
    -- Found Eigen
    --   Includes : /usr/local/include/eigen3
    -- Found FreeImage
    --   Includes : /usr/include
    --   Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
    -- Found Glog
    --   Includes : /usr/include
    --   Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
    CMake Warning (dev) at /usr/local/share/cmake-3.21/Modules/FindOpenGL.cmake:315 (message):
      Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
      available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
      cmake_policy command to set the policy and suppress this warning.
    
      FindOpenGL found both a legacy GL library:
    
        OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
    
      and GLVND libraries for OpenGL and GLX:
    
        OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
        OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
    
      OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
      compatibility with CMake 3.10 and below the legacy GL library will be used.
    Call Stack (most recent call first):
      /usr/local/share/colmap/COLMAPConfig.cmake:109 (find_package)
      CMakeLists.txt:14 (find_package)
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Found Glew
    --   Includes : /usr/include
    --   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
    -- Using header-only CGAL
    -- Targetting Unix Makefiles
    -- Using /usr/bin/c++ compiler.
    -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.48")
    -- Boost include dirs: /usr/include
    -- Boost libraries:
    -- Using gcc version 4 or later. Adding -frounding-math
    -- pybind11 v2.8.1
    -- Configuring incomplete, errors occurred!
    See also "/home/xxx/pyceres/build/temp.linux-x86_64-cpython-39/CMakeFiles/CMakeOutput.log".
    See also "/home/xxx/pyceres/build/temp.linux-x86_64-cpython-39/CMakeFiles/CMakeError.log".
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "/home/xxx/pyceres/setup.py", line 80, in <module>
        setup(
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
        return distutils.core.setup(**attrs)
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
        return run_commands(dist)
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
        dist.run_commands()
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
        self.run_command(cmd)
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
        super().run_command(command)
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
        cmd_obj.run()
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/command/develop.py", line 114, in install_for_development
        self.run_command('build_ext')
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
        self.distribution.run_command(command)
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
        super().run_command(command)
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
        cmd_obj.run()
      File "/home/xxx/pyceres/setup.py", line 34, in run
        self.build_extension(ext)
      File "/home/xxx/pyceres/setup.py", line 76, in build_extension
        subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
      File "/home/xxx/anaconda3/envs/torch/lib/python3.9/subprocess.py", line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '/home/xxx/pyceres', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/xxx/pyceres', '-DPYTHON_EXECUTABLE=/home/xxx/anaconda3/envs/torch/bin/python', '-DVERSION_INFO=0.0.0', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
    ['cmake', '/home/xxx/pyceres', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/xxx/pyceres', '-DPYTHON_EXECUTABLE=/home/xxx/anaconda3/envs/torch/bin/python', '-DVERSION_INFO=0.0.0', '-DCMAKE_BUILD_TYPE=Release']
    [end of output]

Enviroment:
Ubuntu20.04
cmake 3.21.6
gcc 9.4.0(out of conda)
gcc 12.2.0(conda)

error when install

CMake Error at CMakeLists.txt:7 (find_package):
Found package configuration file:

    /usr/local/share/colmap/COLMAPConfig.cmake

  but it set COLMAP_FOUND to FALSE so package "COLMAP" is considered to be
  NOT FOUND.

writing own costFunction

Hi,
Is there a way to create own class of costFunction? I tried but it seems there is no set_num_residuals member function.
May I know if it is possible?

Cost functions from pycolmap is not available

Thanks for the nice project! I am trying to follow examples/test_BA.ipynb, but it seems that cost_functions is not pycolmap attribute anymore (I install pycolmap through pip install pycolmap directly, in a clean python 3.10 conda environment).
I tried to look around in the pycolmap repo, and I didn't see cost_functions in it. I'd appreciate it if you could help me to find those pre-defined cost functions. Thanks in advance!

Writing cost function in Python

Thanks for this awesome wrapping library for ceres.
In #20, you said:

We don't provide any way to write cost functions in Python.

However, I have noticed that PyCostFunction already provides the corresponding trampoline functionality. The only thing that needs to be added is the encapsulation of set_num_residuals(). Which is done as follows:

      .def("set_num_residuals", &PyCostFunction::set_num_residuals)

After adding it, I tested the helloworld CostFunction in Python. It seems ok.

class HelloworldCost(pyceres.CostFunction):
    def __init__(self):
        pyceres.CostFunction.__init__(self)
        self.set_num_residuals(1)
        self.set_parameter_block_sizes([1])

    def Evaluate(self, parameters, residuals, jacobians):
        # ref: examples/helloworld_analytic_diff.cc
        x = parameters[0][0]
        residuals[0] = 10. - x
        if jacobians is not None:
            jacobians[0][0] = -1.
        return True


def test_python_cost():
    x = np.array(5.0)
    prob = pyceres.Problem()
    cost = HelloworldCost()
    loss = pyceres.TrivialLoss()
    prob.add_residual_block(cost, loss, [x])

    opts = pyceres.SolverOptions()
    opts.minimizer_progress_to_stdout = True
    summary = pyceres.SolverSummary()
    pyceres.solve(opts, prob, summary)
    print(summary.BriefReport())
    print(x)

The output is:

iter      cost      cost_change  |gradient|   |step|    tr_ratio  tr_radius  ls_iter  iter_time  total_time
   0  1.250000e+01    0.00e+00    5.00e+00   0.00e+00   0.00e+00  1.00e+04        0    4.41e-05    1.08e-04
   1  1.249750e-07    1.25e+01    5.00e-04   5.00e+00   1.00e+00  3.00e+04        1    6.51e-05    2.06e-04
   2  1.388518e-16    1.25e-07    1.67e-08   5.00e-04   1.00e+00  9.00e+04        1    2.88e-05    2.45e-04
Ceres Solver Report: Iterations: 3, Initial cost: 1.250000e+01, Final cost: 1.388518e-16, Termination: CONVERGENCE
9.999999983335556

I am not sure if this approach has any issues or if it can be scaled to larger problems.
Looking forward to your comments.

Failure for glog 0.7

Hi @sarlinpe,

I run into this compile issue when trying to compile for glog 0.7 (I saw #36 and we use pyceres 2.1.0):

2024-02-18T23:39:35.0878726Z   [ 50%] Building CXX object CMakeFiles/pyceres.dir/_pyceres/bindings.cc.o
2024-02-18T23:39:39.6546867Z   In file included from /home/conda/feedstock_root/build_artifacts/pyceres_1708299340532/work/_pyceres/helpers.h:3,
2024-02-18T23:39:39.6548492Z                    from /home/conda/feedstock_root/build_artifacts/pyceres_1708299340532/work/_pyceres/core/cost_functions.h:3,
2024-02-18T23:39:39.6549613Z                    from /home/conda/feedstock_root/build_artifacts/pyceres_1708299340532/work/_pyceres/core/bindings.h:4,
2024-02-18T23:39:39.6551543Z                    from /home/conda/feedstock_root/build_artifacts/pyceres_1708299340532/work/_pyceres/bindings.cc:1:
2024-02-18T23:39:39.6552850Z   /home/conda/feedstock_root/build_artifacts/pyceres_1708299340532/work/_pyceres/logging.h: In instantiation of 'LogMessageFatalThrow<T>::LogMessageFatalThrow(const char*, int, const google::logging::internal::CheckOpString&) [with T = std::invalid_argument]':
2024-02-18T23:39:39.6553874Z   /home/conda/feedstock_root/build_artifacts/pyceres_1708299340532/work/_pyceres/core/cost_functions.h:116:13:   required from here
2024-02-18T23:39:39.6554416Z   /home/conda/feedstock_root/build_artifacts/pyceres_1708299340532/work/_pyceres/logging.h:119:19: error: type 'const class std::unique_ptr<std::__cxx11::basic_string<char> >' argument given to 'delete', expected pointer
2024-02-18T23:39:39.6554750Z     119 |     delete result.str_;
2024-02-18T23:39:39.6554890Z         |            ~~~~~~~^~~~

Do you have any idea how to resolve this?

Error when installing

Hello, thanks for sharing your code.

I've tried to install pyceres but got next output

Obtaining file:///home/daddywesker/3rdPrtyLibs/pyceres
Requirement already satisfied: numpy in /home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages (from pyceres==0.0.0) (1.21.5)
Installing collected packages: pyceres
  Running setup.py develop for pyceres
    ERROR: Command errored out with exit status 1:
     command: /home/daddywesker/anaconda3/envs/AvatarCLIP/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/daddywesker/3rdPrtyLibs/pyceres/setup.py'"'"'; __file__='"'"'/home/daddywesker/3rdPrtyLibs/pyceres/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /home/daddywesker/3rdPrtyLibs/pyceres/
    Complete output (181 lines):
    running develop
    running egg_info
    creating pyceres.egg-info
    writing pyceres.egg-info/PKG-INFO
    writing dependency_links to pyceres.egg-info/dependency_links.txt
    writing requirements to pyceres.egg-info/requires.txt
    writing top-level names to pyceres.egg-info/top_level.txt
    writing manifest file 'pyceres.egg-info/SOURCES.txt'
    reading manifest file 'pyceres.egg-info/SOURCES.txt'
    writing manifest file 'pyceres.egg-info/SOURCES.txt'
    running build_ext
    -- The C compiler identification is GNU 9.4.0
    -- The CXX compiler identification is GNU 9.4.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found METIS: /usr/include (found suitable version "5.1.0", minimum required is "5.1.0")
    -- Looking for pthread.h
    -- Looking for pthread.h - found
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - found
    -- Found Threads: TRUE
    -- Found AMD headers in: /usr/include/suitesparse
    -- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
    -- Found CAMD headers in: /usr/include/suitesparse
    -- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
    -- Found CCOLAMD headers in: /usr/include/suitesparse
    -- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
    -- Found CHOLMOD headers in: /usr/include/suitesparse
    -- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
    -- Found COLAMD headers in: /usr/include/suitesparse
    -- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
    -- Found SPQR headers in: /usr/include/suitesparse
    -- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
    -- Found Config headers in: /usr/include/suitesparse
    -- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
    -- Found Intel Thread Building Blocks (TBB) library (2020.1 / 11101) include location: . Assuming SuiteSparseQR was compiled with TBB.
    -- Looking for shm_open in rt
    -- Looking for shm_open in rt - found
    -- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
    -- Found METIS: /usr/include (found version "5.1.0")
    -- Looking for cholmod_metis
    -- Looking for cholmod_metis - found
    -- Found SuiteSparse: /usr/include/suitesparse (found suitable version "5.7.1", minimum required is "5.7.1") found components: AMD CAMD CCOLAMD CHOLMOD COLAMD SPQR Config
    -- Found CUDAToolkit: /usr/local/cuda-11.3/include (found suitable version "11.3.58", minimum required is "11.3.58")
    -- Found required Ceres dependency: Eigen version 3.3.7 in /usr/lib/cmake/eigen3
    -- Found required Ceres dependency: glog
    -- Found required Ceres dependency: gflags
    -- Found Ceres version: 2.2.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, SchurSpecializations, Multithreading]
    -- Found METIS: /usr/include (found suitable version "5.1.0", minimum required is "5.1.0")
    -- Found AMD headers in: /usr/include/suitesparse
    -- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
    -- Found CAMD headers in: /usr/include/suitesparse
    -- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
    -- Found CCOLAMD headers in: /usr/include/suitesparse
    -- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
    -- Found CHOLMOD headers in: /usr/include/suitesparse
    -- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
    -- Found COLAMD headers in: /usr/include/suitesparse
    -- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
    -- Found SPQR headers in: /usr/include/suitesparse
    -- Found SPQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
    -- Found Config headers in: /usr/include/suitesparse
    -- Found Config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
    -- Found Intel Thread Building Blocks (TBB) library (2020.1 / 11101) include location: . Assuming SuiteSparseQR was compiled with TBB.
    -- Adding librt to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
    -- Found METIS: /usr/include (found version "5.1.0")
    -- Found required Ceres dependency: Eigen version 3.3.7 in /usr/lib/cmake/eigen3
    CMake Error at /usr/local/lib/cmake/Ceres/FindGlog.cmake:349 (add_library):
      add_library cannot create imported target "glog::glog" because another
      target with the same name already exists.
    Call Stack (most recent call first):
      /usr/local/lib/cmake/Ceres/CeresConfig.cmake:248 (find_package)
      /usr/local/share/colmap/COLMAPConfig.cmake:92 (find_package)
      CMakeLists.txt:14 (find_package)
    
    
    -- Found required Ceres dependency: glog
    -- Found required Ceres dependency: gflags
    -- Found Ceres version: 2.2.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, SchurSpecializations, Multithreading]
    -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: program_options filesystem system unit_test_framework
    -- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0")
    -- Found Eigen
    --   Includes : /usr/include/eigen3
    -- Found FreeImage
    --   Includes : /usr/include
    --   Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
    -- Found Glog
    --   Includes : /usr/include
    --   Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
    CMake Warning (dev) at /opt/cmake-3.22.0-linux-x86_64/share/cmake-3.22/Modules/FindOpenGL.cmake:315 (message):
      Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
      available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
      cmake_policy command to set the policy and suppress this warning.
    
      FindOpenGL found both a legacy GL library:
    
        OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
    
      and GLVND libraries for OpenGL and GLX:
    
        OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
        OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
    
      OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
      compatibility with CMake 3.10 and below the legacy GL library will be used.
    Call Stack (most recent call first):
      /usr/local/share/colmap/COLMAPConfig.cmake:109 (find_package)
      CMakeLists.txt:14 (find_package)
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
    -- Found Glew
    --   Includes : /usr/include
    --   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
    -- Using header-only CGAL
    -- Targetting Unix Makefiles
    -- Using /usr/bin/c++ compiler.
    -- Found GMP: /usr/local/lib/libgmp.so
    -- Found MPFR: /usr/local/lib/libmpfr.so
    -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.48")
    -- Boost include dirs: /usr/include
    -- Boost libraries:
    -- Using gcc version 4 or later. Adding -frounding-math
    -- pybind11 v2.8.1
    -- Found PythonInterp: /home/daddywesker/anaconda3/envs/AvatarCLIP/bin/python (found version "3.7.13")
    -- Found PythonLibs: /home/daddywesker/anaconda3/envs/AvatarCLIP/lib/libpython3.7m.so
    -- Performing Test HAS_FLTO
    -- Performing Test HAS_FLTO - Success
    -- Configuring incomplete, errors occurred!
    See also "/home/daddywesker/3rdPrtyLibs/pyceres/build/temp.linux-x86_64-3.7/CMakeFiles/CMakeOutput.log".
    See also "/home/daddywesker/3rdPrtyLibs/pyceres/build/temp.linux-x86_64-3.7/CMakeFiles/CMakeError.log".
    ['cmake', '/home/daddywesker/3rdPrtyLibs/pyceres', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/daddywesker/3rdPrtyLibs/pyceres', '-DPYTHON_EXECUTABLE=/home/daddywesker/anaconda3/envs/AvatarCLIP/bin/python', '-DVERSION_INFO=0.0.0', '-DCMAKE_BUILD_TYPE=Release']
    /home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/command/easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      EasyInstallDeprecationWarning,
    /home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      setuptools.SetuptoolsDeprecationWarning,
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/daddywesker/3rdPrtyLibs/pyceres/setup.py", line 91, in <module>
        install_requires=['numpy'],
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/__init__.py", line 87, in setup
        return distutils.core.setup(**attrs)
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 148, in setup
        return run_commands(dist)
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
        dist.run_commands()
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
        self.run_command(cmd)
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/dist.py", line 1214, in run_command
        super().run_command(command)
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
        cmd_obj.run()
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/command/develop.py", line 114, in install_for_development
        self.run_command('build_ext')
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/dist.py", line 1214, in run_command
        super().run_command(command)
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
        cmd_obj.run()
      File "/home/daddywesker/3rdPrtyLibs/pyceres/setup.py", line 34, in run
        self.build_extension(ext)
      File "/home/daddywesker/3rdPrtyLibs/pyceres/setup.py", line 76, in build_extension
        subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
      File "/home/daddywesker/anaconda3/envs/AvatarCLIP/lib/python3.7/subprocess.py", line 363, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '/home/daddywesker/3rdPrtyLibs/pyceres', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/daddywesker/3rdPrtyLibs/pyceres', '-DPYTHON_EXECUTABLE=/home/daddywesker/anaconda3/envs/AvatarCLIP/bin/python', '-DVERSION_INFO=0.0.0', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/daddywesker/anaconda3/envs/AvatarCLIP/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/daddywesker/3rdPrtyLibs/pyceres/setup.py'"'"'; __file__='"'"'/home/daddywesker/3rdPrtyLibs/pyceres/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

In one of the logs error mentioned

/usr/bin/ld: CMakeFiles/cmTC_29694.dir/CheckFunctionExists.c.o: in function `main':
CheckFunctionExists.c:(.text+0x14): undefined reference to `sgemm_'

I've tried to add

find_package(LAPACK REQUIRED)
find_package(BLAS REQUIRED)
target_link_libraries(pyceres PRIVATE ${PYCERES_LIBRARIES} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})

in CMakeLists.txt as it suggested on some sites for this problem but it doesn't help. Any suggestions?

I'm on Linux Mint 20, forgot to say.

Question about some pybind usage

pyceres/_pyceres/glog.cc

Lines 57 to 59 in 08ab2e7

.def_property_static(
"minloglevel", [](py::object) { return FLAGS_minloglevel; },
[](py::object, int a) { FLAGS_minloglevel = a; })

I saw there are many properties were bound with setters and getters. However, it seems these setters and getters were just get and set value without doing other thing. In this way, why not using def_readwrite or def_readwrite_static?

a werid optimization result of pyceres

Hello, thanks for sharing your code.
I tried to use this project to optimize some parameters, the cost function is the distance from the point to the line.However, some werid phenomena were found. After adding log output to the cost function, the iteration speed slowed down. But the optimized result is far better than no logging.Any suggestions on this werid phenomena .
My environment is ubuntu 18,python 3.8 .Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.