mapillary / mapillary/OpenSfM

Impossible to interact with OpenSfM from Jupyter notebook

Open
#661 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
3.8k
Forks
899
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm having issues in accessing the OpenSfM functionality from a jupyter notebook. When accessing the functionality from a shell, everything is behaving as expected, so I assume that everything is installed correctly.
More specifically, when I invoke the following script from a command line:

from opensfm import dataset

datdir='/dataset/Photogrammetry/Lund'

data = dataset.DataSet(datdir)
tracks_manager = data.load_tracks_manager()
TT=tracks_manager.get_all_common_observations("03.jpg","04.jpg")
nr,obs1,obs2=TT[0]

print(obs1.id,obs1.point, obs1.scale, obs1.color)
print(obs2.id,obs2.point, obs2.scale, obs2.color)

I get as output on the command line:
936 [-0.279906 -0.305756] 0.00185086 [146 165 198]
2172 [-0.255517 -0.34403 ] 0.00197027 [166 188 227]

However, when copy-pasting this exact same code into a jupyter cell, I get as output:
936 [-0. -0.] 0.0 [146 165 198]
2172 [-0. -0.] 0.0 [166 188 227]

So, somehow, feature points and scalings are NOT loaded properly, whereas color and id are.

Somehow, I got the impression that it has to be connected to the C-extensions and the environment variables, but I can't be sure. In any case, if I run the above script in a jupyter cell with:
!python3 mytest.py => it gives the right output.
Running in a cell:
%run mytest.py => gives the bad output..

So, if somebody could shed any light on what I am missing, I would be very happy. It's been driving me nuts for some time now..
Cheers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the provided OpenSfM script from a shell, with !python3 mytest.py, and with %run mytest.py in a Jupyter cell. Compare the get_all_common_observations outputs, especially feature points and scales; done means the notebook execution produces the same values as the command-line execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
computer-vision, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.