Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed pickle error, deprecation warning #645

Closed
wants to merge 1 commit into from

Conversation

pierotofy
Copy link
Contributor

Hey ✋,

When running OpenSfM I noticed that an update to numpy started throwing an error and a deprecation warning while running the create_submodels command:

/usr/bin/env python3 /code/SuperBuild/src/opensfm/bin/opensfm create_submodels "/datasets/code/opensfm"
/usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py:136: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  return array(a, dtype, copy=False, order=order, subok=True)
Traceback (most recent call last):
  File "/code/SuperBuild/src/opensfm/bin/opensfm", line 34, in <module>
    command.run(args)
  File "/code/SuperBuild/src/opensfm/opensfm/commands/create_submodels.py", line 34, in run
    self._save_cluster_neighbors_geojson(meta_data)
  File "/code/SuperBuild/src/opensfm/opensfm/commands/create_submodels.py", line 124, in _save_cluster_neighbors_geojson
    clusters = meta_data.load_clusters_with_neighbors()
  File "/code/SuperBuild/src/opensfm/opensfm/large/metadataset.py", line 119, in load_clusters_with_neighbors
    return c['clusters']
  File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 255, in __getitem__
    pickle_kwargs=self.pickle_kwargs)
  File "/usr/local/lib/python3.6/dist-packages/numpy/lib/format.py", line 727, in read_array
    raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False

This PR fixes both. It's safe to use allow_pickle here because OpenSfM is the program generating the file (we don't download it from an external source).

Please let me know if changes are needed 🙏

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YanNoun has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@YanNoun merged this pull request in f78ae82.

mlopezantequera pushed a commit that referenced this pull request Oct 9, 2020
* master:
  fix: do not init glog (#653)
  chore: remove Python 2/3 doc
  chore: remove six
  chore: remove future imports
  feat: prepare for overload GCP loading
  feat: add manifold IO
  fix: fix division by zero bug
  feat: fix command line
  chore: fix typo in TopoCentriConverter
  Re-sync with internal repository
  Small fixes with big impact
  Fixed pickle error, deprecation warning (#645)
  Regression fix: allow build without tests (#640)
  refactor: seperate action from commands
  refactor: unify OpenSfM and mapillary_sfm commands under a common umbrella
  Feat: bundle and bundle_local in C++ (#628)
  fix: make test green !
  fix camera test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants