pyceres icon indicating copy to clipboard operation
pyceres copied to clipboard

"Unregistered type" error you're encountering when using Ceres Solver with PyCOLMAP

Open vholod opened this issue 1 year ago • 6 comments

Hi, I get the following error when I try to run the test_BA.ipynb notebook in the examples.

TypeError: Unregistered type : ceres::AutoDiffCostFunction<colmap::ReprojErrorConstantPoseCostFunctioncolmap::SimplePinholeCameraModel, 2, 3, 3>

I installed the colmap and pycolmap from source. Thus error I get when I install pyceres with pip install pyceres (version 2.2) or when I install pyceres from source (somehow the version is 2.0).

Please help me to solve the issue. Thanks

vholod avatar Jul 28 '24 10:07 vholod

Likely due to https://github.com/cvg/pyceres/pull/52. This has been fixed now. We may want to make a new release ASAP and add docs somewhere (on pycolmap 3.10 needs the new ceres release) @sarlinpe

B1ueber2y avatar Aug 01 '24 08:08 B1ueber2y

@vholod could you try building pyceres at HEAD? we've also pushed a new release v2.3, does this work too when pulled from pypi?

sarlinpe avatar Aug 02 '24 09:08 sarlinpe

Hi, Thanks for your responses. I now have many problems to install pyceres from source. I will try to progress with it.

However, when I install pyceres with pip (version 2.3), I still get the problem below.


TypeError Traceback (most recent call last) TypeError: Unregistered type : ceres::AutoDiffCostFunction<colmap::ReprojErrorConstantPoseCostFunctioncolmap::SimplePinholeCameraModel, 2, 3, 3>

The above exception was the direct cause of the following exception:

TypeError Traceback (most recent call last) Cell In[6], line 2 1 rec = create_reconstruction() ----> 2 problem = define_problem(rec) 3 solve(problem)

Cell In[5], line 7, in define_problem(rec) 5 cam = rec.cameras[im.camera_id] 6 for p in im.points2D: ----> 7 cost = pycolmap.cost_functions.ReprojErrorCost( 8 cam.model, im.cam_from_world, p.xy 9 ) 10 prob.add_residual_block( 11 cost, loss, [rec.points3D[p.point3D_id].xyz, cam.params] 12 ) 13 for cam in rec.cameras.values():

TypeError: Unable to convert function return value to a Python type! The signature was (camera_model_id: pycolmap.CameraModelId, cam_from_world: pycolmap.Rigid3d, point2D: numpy.ndarray[numpy.float64[2, 1]]) -> ceres::CostFunction

vholod avatar Aug 04 '24 08:08 vholod

pyceres and pycolmap need to be either both installed from source or both installed from pypi.

sarlinpe avatar Aug 10 '24 08:08 sarlinpe

@vholod Hi! I have the same problem, have you solved it?

yyfz avatar Nov 25 '24 11:11 yyfz

Hi , I didn't solve it. However, after some time, the package was updated, so everything worked well for me using Pip install.


From: Yifan Wang @.> Sent: Monday, November 25, 2024 1:28 PM To: cvg/pyceres @.> Cc: Vadim Holodovsky @.>; Mention @.> Subject: Re: [cvg/pyceres] "Unregistered type" error you're encountering when using Ceres Solver with PyCOLMAP (Issue #51)

@vholodhttps://protect.checkpoint.com/v2/r02/___https://github.com/vholod___.YzJlOnRlY2huaW9uOmM6bzphYmM5OWRiNjVkZGY2NWQ4Y2QzZDFjYjIwZjkwZmY4ZTo3OmI5ODI6ZDI3ZTc1MzliZGMwMWQwNThmZTZhZjA4Yjk3Njk4MmJlNDAxMjA0Nzk4NDg3ZDVkOGVjNzM1MTk0ZmVkNWY2NTpoOlQ6Tg Hi! I have the same problem, have you solved it?

— Reply to this email directly, view it on GitHubhttps://protect.checkpoint.com/v2/r02/___https://github.com/cvg/pyceres/issues/51%23issuecomment-2497749890___.YzJlOnRlY2huaW9uOmM6bzphYmM5OWRiNjVkZGY2NWQ4Y2QzZDFjYjIwZjkwZmY4ZTo3OmU5MDM6ZWE5YTFkNjgxOWUxNTVkNmY1MzZjZThlNzg4MWRlMWNhNDY1M2Y4Y2VmMzQzMmQxOWM0MGY2NzQ3NTQ3YTA5NTpoOlQ6Tg, or unsubscribehttps://protect.checkpoint.com/v2/r02/___https://github.com/notifications/unsubscribe-auth/AHXSNH3GUXHMZHAKIDU6XX32CMCVPAVCNFSM6AAAAABLSWFQAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJXG42DSOBZGA___.YzJlOnRlY2huaW9uOmM6bzphYmM5OWRiNjVkZGY2NWQ4Y2QzZDFjYjIwZjkwZmY4ZTo3OjUyMzY6MWMyNjYxMDUyMDEzZDJkZmUxZTJjOTY3OGZjYTEwY2EwMWQ4YjkxYTQ1M2UwNzcxZTAyZmQ1ZDNhZjljMzEwYjpoOlQ6Tg. You are receiving this because you were mentioned.Message ID: @.***>

External e-mail, be judicious when opening attachments or links

vholod avatar Nov 25 '24 15:11 vholod