OpenDroneMap / ODM

A command line toolkit to generate maps, point clouds, 3D models and DEMs from drone, balloon or kite images. 📷
https://opendronemap.org
GNU Affero General Public License v3.0
4.86k stars 1.1k forks source link

ValueError: Unknown feature type (must be SURF, SIFT, AKAZE, HAHOG or ORB) #1252

Closed Saijin-Naib closed 3 years ago

Saijin-Naib commented 3 years ago

How did you install OpenDroneMap? (Docker, natively, ...)?

WSL2, latest ../code directory, latest libraries (apt update), and python3-pyopencl installed. Running under Windows 10 Dev Fast host with CUDA WSL2 NVIDIA Drivers.

What's your browser and operating system? (Copy/paste the output of https://www.whatismybrowser.com/)

N/A

What is the problem?

ValueError: Unknown feature type (must be SURF, SIFT, AKAZE, HAHOG or ORB)

What should be the expected behavior? If this is a feature request, please describe in detail the changes you think should be made to the code, citing files and lines where changes should be made, if possible.

Features passed to opensfm are accepted properly.

How can we reproduce this? (What steps did you do to trigger the problem? What parameters are you using for processing? If possible please include a copy of your dataset uploaded on Google Drive or Dropbox. Be detailed)

Private "livingroom" dataset, which normally processes just fine. Removing python3-pyopencl stops this error from being raised, and the dataset processes fully.

root@GreenMachine:/code# ./run.sh --rerun-all --crop 0 --use-hybrid-bundle-adjustment
[INFO]    Initializing ODM - Mon Mar 29 16:25:02  2021
[INFO]    ==============
[INFO]    build_overviews: False
[INFO]    camera_lens: auto
[INFO]    cameras: {}
[INFO]    crop: 0.0
[INFO]    debug: False
[INFO]    dem_decimation: 1
[INFO]    dem_euclidean_map: False
[INFO]    dem_gapfill_steps: 3
[INFO]    dem_resolution: 5
[INFO]    depthmap_resolution: 640
[INFO]    dsm: False
[INFO]    dtm: False
[INFO]    end_with: odm_report
[INFO]    fast_orthophoto: False
[INFO]    feature_quality: high
[INFO]    feature_type: sift
[INFO]    force_gps: False
[INFO]    gcp: None
[INFO]    geo: None
[INFO]    gps_accuracy: 10
[INFO]    ignore_gsd: False
[INFO]    matcher_distance: 0
[INFO]    matcher_neighbors: 8
[INFO]    matcher_type: flann
[INFO]    max_concurrency: 8
[INFO]    merge: all
[INFO]    mesh_octree_depth: 11
[INFO]    mesh_size: 200000
[INFO]    min_num_features: 8000
[INFO]    name: code
[INFO]    optimize_disk_space: False
[INFO]    orthophoto_compression: DEFLATE
[INFO]    orthophoto_cutline: False
[INFO]    orthophoto_no_tiled: False
[INFO]    orthophoto_png: False
[INFO]    orthophoto_resolution: 5
[INFO]    pc_classify: False
[INFO]    pc_csv: False
[INFO]    pc_ept: False
[INFO]    pc_filter: 2.5
[INFO]    pc_las: False
[INFO]    pc_quality: medium
[INFO]    pc_rectify: False
[INFO]    pc_sample: 0
[INFO]    pc_tile: False
[INFO]    primary_band: auto
[INFO]    project_path: /
[INFO]    radiometric_calibration: none
[INFO]    rerun: None
[INFO]    rerun_all: True
[INFO]    rerun_from: None
[INFO]    resize_to: 2048
[INFO]    skip_3dmodel: False
[INFO]    skip_band_alignment: False
[INFO]    skip_report: False
[INFO]    sm_cluster: None
[INFO]    smrf_scalar: 1.25
[INFO]    smrf_slope: 0.15
[INFO]    smrf_threshold: 0.5
[INFO]    smrf_window: 18.0
[INFO]    split: 999999
[INFO]    split_image_groups: None
[INFO]    split_overlap: 150
[INFO]    texturing_data_term: gmi
[INFO]    texturing_keep_unseen_faces: False
[INFO]    texturing_outlier_removal_type: gauss_clamping
[INFO]    texturing_skip_global_seam_leveling: False
[INFO]    texturing_skip_local_seam_leveling: False
[INFO]    texturing_tone_mapping: none
[INFO]    tiles: False
[INFO]    time: False
[INFO]    use_3dmesh: False
[INFO]    use_exif: False
[INFO]    use_fixed_camera_params: False
[INFO]    use_hybrid_bundle_adjustment: True
[INFO]    verbose: False
[INFO]    ==============
[INFO]    Rerun all -- Removing old data
[INFO]    Running dataset stage
[INFO]    Loading dataset from: /code/images
[INFO]    Loading 19 images
[INFO]    Wrote images database: /code/images.json
[INFO]    Found 19 usable images
[INFO]    Parsing SRS header: WGS84 UTM 18N
[INFO]    Finished dataset stage
[INFO]    Running split stage
[INFO]    Normal dataset, will process all at once.
[INFO]    Finished split stage
[INFO]    Running merge stage
[INFO]    Normal dataset, nothing to merge.
[INFO]    Finished merge stage
[INFO]    Running opensfm stage
[INFO]    Writing exif overrides
[INFO]    Maximum photo dimensions: 4032px
[INFO]    Found GPU device: Portable Computing Language
[INFO]    Using GPU for extracting SIFT features
[INFO]    --min-num-features will be ignored
[INFO]    Altitude data detected, enabling it for GPS alignment
[INFO]    Enabling hybrid bundle adjustment
[INFO]    ['use_exif_size: no', 'flann_algorithm: KDTREE', 'feature_process_size: 2016', 'feature_min_frames: 8000', 'processes: 8', 'matching_gps_neighbors: 8', 'matching_gps_distance: 0', 'optimize_camera_parameters: yes', 'undistorted_image_format: tif', 'bundle_outlier_filtering_type: AUTO', 'align_orientation_prior: vertical', 'triangulation_type: ROBUST', 'retriangulation_ratio: 2', 'feature_type: SIFT_GPU', 'use_altitude_tag: yes', 'align_method: auto', 'bundle_interval: 100', 'bundle_new_points_ratio: 1.2', 'local_bundle_radius: 1']
[INFO]    running /code/SuperBuild/src/opensfm/bin/opensfm extract_metadata "/code/opensfm"
2021-03-29 16:25:04,434 INFO: Extracting EXIF for 20210224_164948_DRO.jpg
2021-03-29 16:25:04,590 INFO: Extracting EXIF for 20210224_164944_DRO.jpg
2021-03-29 16:25:04,800 INFO: Extracting EXIF for 20210224_164939_DRO.jpg
2021-03-29 16:25:05,056 INFO: Extracting EXIF for 20210224_164959_DRO.jpg
2021-03-29 16:25:05,255 INFO: Extracting EXIF for 20210224_164952_DRO.jpg
2021-03-29 16:25:05,393 INFO: Extracting EXIF for 20210224_164958_DRO.jpg
2021-03-29 16:25:05,536 INFO: Extracting EXIF for 20210224_165002_DRO.jpg
2021-03-29 16:25:05,699 INFO: Extracting EXIF for 20210224_164936_DRO.jpg
2021-03-29 16:25:05,873 INFO: Extracting EXIF for 20210224_164938_DRO.jpg
2021-03-29 16:25:05,999 INFO: Extracting EXIF for 20210224_165004_DRO.jpg
2021-03-29 16:25:06,133 INFO: Extracting EXIF for 20210224_164947_DRO.jpg
2021-03-29 16:25:06,255 INFO: Extracting EXIF for 20210224_164956_DRO.jpg
2021-03-29 16:25:06,386 INFO: Extracting EXIF for 20210224_164953_DRO.jpg
2021-03-29 16:25:06,502 INFO: Extracting EXIF for 20210224_164950_DRO.jpg
2021-03-29 16:25:06,618 INFO: Extracting EXIF for 20210224_164941_DRO.jpg
2021-03-29 16:25:06,724 INFO: Extracting EXIF for 20210224_164945_DRO.jpg
2021-03-29 16:25:06,846 INFO: Extracting EXIF for 20210224_165001_DRO.jpg
2021-03-29 16:25:06,991 INFO: Extracting EXIF for 20210224_164955_DRO.jpg
2021-03-29 16:25:07,131 INFO: Extracting EXIF for 20210224_164942_DRO.jpg
[INFO]    running /code/SuperBuild/src/opensfm/bin/opensfm detect_features "/code/opensfm"
2021-03-29 16:25:08,538 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164948_DRO.jpg
2021-03-29 16:25:08,539 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164944_DRO.jpg
2021-03-29 16:25:08,539 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164939_DRO.jpg
2021-03-29 16:25:08,539 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164959_DRO.jpg
2021-03-29 16:25:08,540 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164958_DRO.jpg
2021-03-29 16:25:08,540 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_165002_DRO.jpg
2021-03-29 16:25:08,540 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164952_DRO.jpg
2021-03-29 16:25:08,541 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164936_DRO.jpg
2021-03-29 16:25:09,638 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164938_DRO.jpg
2021-03-29 16:25:09,644 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_165004_DRO.jpg
2021-03-29 16:25:09,644 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164956_DRO.jpg
Traceback (most recent call last):
2021-03-29 16:25:09,644 INFO: Extracting ROOT_SIFT_GPU features for image 20210224_164947_DRO.jpg
  File "/code/SuperBuild/src/opensfm/bin/opensfm_main.py", line 15, in <module>
    commands.command_runner(commands.opensfm_commands, default_dataset_type)
  File "/code/SuperBuild/src/opensfm/opensfm/commands/command_runner.py", line 31, in command_runner
    command.run(data, args)
  File "/code/SuperBuild/src/opensfm/opensfm/commands/command.py", line 12, in run
    self.run_impl(data, args)
  File "/code/SuperBuild/src/opensfm/opensfm/commands/detect_features.py", line 11, in run_impl
    detect_features.run_dataset(dataset)
  File "/code/SuperBuild/src/opensfm/opensfm/actions/detect_features.py", line 21, in run_dataset
    parallel_map(detect, arguments, processes, 1)
  File "/code/SuperBuild/src/opensfm/opensfm/context.py", line 51, in parallel_map
    res = Parallel(batch_size=batch_size)(delayed(func)(arg) for arg in args)
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 1061, in __call__
    self.retrieve()
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 940, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
  File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/lib/python3.8/dist-packages/joblib/_parallel_backends.py", line 595, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 262, in __call__
    return [func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 262, in <listcomp>
    return [func(*args, **kwargs)
  File "/code/SuperBuild/src/opensfm/opensfm/actions/detect_features.py", line 81, in detect
    p_unmasked, f_unmasked, c_unmasked = features.extract_features(
  File "/code/SuperBuild/src/opensfm/opensfm/features.py", line 328, in extract_features
    raise ValueError(
ValueError: Unknown feature type (must be SURF, SIFT, AKAZE, HAHOG or ORB)
Traceback (most recent call last):
  File "/code/run.py", line 68, in <module>
    app.execute()
  File "/code/stages/odm_app.py", line 82, in execute
    self.first_stage.run()
  File "/code/opendm/types.py", line 338, in run
    self.next_stage.run(outputs)
  File "/code/opendm/types.py", line 338, in run
    self.next_stage.run(outputs)
  File "/code/opendm/types.py", line 338, in run
    self.next_stage.run(outputs)
  File "/code/opendm/types.py", line 319, in run
    self.process(self.args, outputs)
  File "/code/stages/run_opensfm.py", line 36, in process
    octx.feature_matching(self.rerun())
  File "/code/opendm/osfm.py", line 285, in feature_matching
    self.run('detect_features')
  File "/code/opendm/osfm.py", line 27, in run
    system.run('%s/bin/opensfm %s "%s"' %
  File "/code/opendm/system.py", line 79, in run
    raise Exception("Child returned {}".format(retcode))
Exception: Child returned 1
pierotofy commented 3 years ago

ODM detects python3-pyopencl and assumes you have GPU support. Is this a native install? Make sure you have the latest OpenSfM.

Saijin-Naib commented 3 years ago

ODM detects python3-pyopencl and assumes you have GPU support. Is this a native install? Make sure you have the latest OpenSfM.

WSL2 install, updated via git pull and apt update && apt upgrade, and manual install of python3-pyopenCL. W10 Insider Dev host with experimental NVIDIA CUDA WSL2-enabled drivers. https://developer.nvidia.com/cuda/wsl/download

So in theory, I should have properly working OpenCL via GPU, but it looks like clinfo only picks up my i7-6700k. And even if I can't get GPU passthrough working, shouldn't the CPU-based OpenCL still work properly?

Output of clinfo:

root@GreenMachine:/code# clinfo
Number of platforms                               1
  Platform Name                                   Portable Computing Language
  Platform Vendor                                 The pocl project
  Platform Version                                OpenCL 1.2 pocl 1.4, None+Asserts, LLVM 9.0.1, RELOC, SLEEF, DISTRO, POCL_DEBUG
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             POCL

  Platform Name                                   Portable Computing Language
Number of devices                                 1
  Device Name                                     pthread-Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  Device Vendor                                   GenuineIntel
  Device Vendor ID                                0x6c636f70
  Device Version                                  OpenCL 1.2 pocl HSTR: pthread-x86_64-pc-linux-gnu-skylake
  Driver Version                                  1.4
  Device OpenCL C Version                         OpenCL C 1.2 pocl
  Device Type                                     CPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               8
  Max clock frequency                             4008MHz
  Device Partition                                (core)
    Max number of sub-devices                     8
    Supported partition types                     equally, by counts
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             4096x4096x4096
  Max work group size                             4096
  Preferred work group size multiple              8
  Preferred / native vector sizes
    char                                                16 / 16
    short                                               16 / 16
    int                                                  8 / 8
    long                                                 4 / 4
    half                                                 0 / 0        (n/a)
    float                                                8 / 8
    double                                               4 / 4        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  Yes
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              23069630464 (21.49GiB)
  Error Correction support                        No
  Max memory allocation                           8589934592 (8GiB)
  Unified memory for Host and Device              Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        8388608 (8MiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            536870912 pixels
    Max 1D or 2D image array size                 2048 images
    Max 2D image size                             16384x16384 pixels
    Max 3D image size                             2048x2048x2048 pixels
    Max number of read image args                 128
    Max number of write image args                128
  Local memory type                               Global
  Local memory size                               4194304 (4MiB)
  Max number of constant args                     8
  Max constant buffer size                        4194304 (4MiB)
  Max size of kernel argument                     1024
  Queue properties
    Out-of-order execution                        Yes
    Profiling                                     Yes
  Prefer user sync for interop                    Yes
  Profiling timer resolution                      1ns
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            Yes
  printf() buffer size                            16777216 (16MiB)
  Built-in kernels                                (n/a)
  Device Extensions                               cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_3d_image_writes cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Portable Computing Language
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [POCL]
  clCreateContext(NULL, ...) [default]            Success [POCL]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Portable Computing Language
    Device Name                                   pthread-Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  Success (1)
    Platform Name                                 Portable Computing Language
    Device Name                                   pthread-Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Portable Computing Language
    Device Name                                   pthread-Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.11
  ICD loader Profile                              OpenCL 2.1
pierotofy commented 3 years ago

So it's a native install? (Did you build from source?)

Make sure you have rebuilt the SuperBuild directory; you need the latest OpenSfM patches to get GPU to work.

Edit: if it's not a native install, this might be a bug in the build process for WSL2 images.

Saijin-Naib commented 3 years ago

Yeah, not native. WSL2 generated by the github actions, but updated code directory by using git pull and updated libs in the install by using apt update/upgrade.

How would I trigger the rebuild of the SuperBuild directory?

pierotofy commented 3 years ago

Natively you would do:

bash configure.sh reinstall

Saijin-Naib commented 3 years ago

Natively you would do:

bash configure.sh reinstall

Ran that successfully, still failed when python3-pyopencl is present... Maybe I'm missing an OpenCL driver?

pierotofy commented 3 years ago

Mm, not sure. But if you set ODM_NO_GPU=YES as an environment variable, you can make sure that ODM does not attempt to use the GPU driver and should fix the issue. I'm going to close this as it looks like it might be a configuration / build issue. :pray: