Skip to content

Commit 672db1d

Browse files
paulinusfacebook-github-bot
authored andcommitted
Fixes for docker tests to build and pass (#1092)
Summary: Revert some changes from bots and humans that were not compatible with non-meta-internal tools. * Require C++17 * Avoid using python 3.10 features * Avoid using ceres 2 features (ceres::isfinite) * Avoid using meta internal global paths Pull Request resolved: #1092 Reviewed By: DodgySpaniard Differential Revision: D73259083 Pulled By: paulinus fbshipit-source-id: 40af597bb2e2750f826f051166a15ec84553b9aa
1 parent a37c683 commit 672db1d

10 files changed

Lines changed: 18 additions & 16 deletions

opensfm/features.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class FeaturesData:
5151
descriptors: Optional[np.ndarray]
5252
colors: np.ndarray
5353
semantic: Optional[SemanticData]
54-
depths: np.ndarray | None # New field. This field is not serialized yet
54+
depths: Optional[np.ndarray] # New field. This field is not serialized yet
5555

5656
FEATURES_VERSION: int = 3
5757
FEATURES_HEADER: str = "OPENSFM_FEATURES_VERSION"
@@ -62,7 +62,7 @@ def __init__(
6262
descriptors: Optional[np.ndarray],
6363
colors: np.ndarray,
6464
semantic: Optional[SemanticData],
65-
depths: np.ndarray | None = None,
65+
depths: Optional[np.ndarray] = None,
6666
):
6767
self.points = points
6868
self.descriptors = descriptors

opensfm/reconstruction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""Incremental reconstruction pipeline"""
33

44
import datetime
5+
import enum
56
import logging
67
import math
78
from abc import ABC, abstractmethod
@@ -28,13 +29,12 @@
2829
from opensfm.align import align_reconstruction, apply_similarity
2930
from opensfm.context import current_memory_usage, parallel_map
3031
from opensfm.dataset_base import DataSetBase
31-
from python.migrations.py310 import StrEnum310
3232

3333

3434
logger: logging.Logger = logging.getLogger(__name__)
3535

3636

37-
class ReconstructionAlgorithm(StrEnum310):
37+
class ReconstructionAlgorithm(str, enum.Enum):
3838
INCREMENTAL = "incremental"
3939
TRIANGULATION = "triangulation"
4040

opensfm/src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ set(CMAKE_CXX_VISIBILITY_INLINES ON)
2424
# fPIC
2525
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
2626

27-
# C++14
28-
set(CMAKE_CXX_STANDARD 14)
27+
# C++17
28+
set(CMAKE_CXX_STANDARD 17)
2929
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3030

3131
# Enable all warnings

opensfm/src/bundle/src/bundle_adjuster.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ struct AddRelativeDepthError {
505505
return;
506506
}
507507
const auto &depth = obs.depth_prior.value();
508-
if (!ceres::isfinite(depth.value)) {
508+
if (!std::isfinite(depth.value)) {
509509
throw std::runtime_error(obs.shot->GetID() +
510510
" has non-finite depth prior");
511511
}

opensfm/test/test_commands.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
import argparse
33
from os.path import join
44

5-
from mapillary.opensfm.opensfm.test import data_generation, utils
6-
75
from opensfm import commands, dataset
6+
from opensfm.test import data_generation, utils
87

98

109
def run_command(command, args) -> None:

opensfm/test/test_dataset.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# pyre-unsafe
22
import numpy as np
3-
from mapillary.opensfm.opensfm.test import data_generation
3+
44
from opensfm import features
5+
from opensfm.test import data_generation
56

67

78
def test_dataset_load_features_sift(tmpdir) -> None:

opensfm/test/test_datastructures.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
import numpy as np
88
import pytest
9-
from mapillary.opensfm.opensfm.test.utils import (
9+
from opensfm import pygeometry, pymap, types
10+
from opensfm.pymap import RigCamera, RigInstance, Shot
11+
from opensfm.test.utils import (
1012
assert_cameras_equal,
1113
assert_maps_equal,
1214
assert_metadata_equal,
1315
assert_shots_equal,
1416
)
15-
from opensfm import pygeometry, pymap, types
16-
from opensfm.pymap import RigCamera, RigInstance, Shot
1717
from opensfm.types import Reconstruction
1818

1919

opensfm/test/test_io.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
from io import StringIO
55

66
import numpy as np
7-
from mapillary.opensfm.opensfm.test import data_generation, utils
7+
88
from opensfm import io, pygeometry, types
9+
from opensfm.test import data_generation, utils
910

1011

1112
filename = os.path.join(

opensfm/test/test_pairs_selection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
import numpy as np
77
import pytest
8-
from mapillary.opensfm.opensfm.test import data_generation
8+
99
from opensfm import commands, dataset, feature_loader, geo, pairs_selection
1010
from opensfm.dataset_base import DataSetBase
11+
from opensfm.test import data_generation
1112

1213

1314
NEIGHBORS = 6

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Pillow>=8.1.1
1010
pyproj>=1.9.5.1
1111
pytest==3.0.7
1212
python-dateutil>=2.7
13-
pyyaml==5.4
13+
pyyaml>=5.4
1414
scipy>=1.10.0
1515
Sphinx==4.2.0
1616
six

0 commit comments

Comments
 (0)