Speed Up Reconstruction Process

Hello Everyone,

I have been using GPU lately and it has certainly decreased the processing time.

But I have noticed one thing. The reconstruction process takes a hell lot of time.

First of all, I have noticed that the reconstruction takes place in 2 step. I guess it is because of the rolling shutter correction, what I can read from the code. Correct me if I am wrong.

Secondly, the reconstruction process itself takes a lot of time. I am wondering whether this process can be shifted to GPU or not. I am using cloud service and when the reconstruction takes this much of time, it defeats the purpose of using GPU as for that time period, GPU is not at all used and I am being charged for it.

PS: Perhaps, I am just the user and not the developer, and hence it would be little difficult to understand the technicalities of the software.

1 Like

We’re always looking into ways to improve reconstruction time, for sure.

Please ensure you’re always on the latest build as recent fixes/changes have landed that help speed up a few things (especially orthophoto generation).

3 Likes

It’s been quite a time when I heard from you. Welcome back!

Yesterday, I was processing a dataset and I saw little more time being taken to process. Then, I saw this: Docker Hub . So, I can see there are some changes pushed to opendronemap/nodeodm:gpu 3 days ago.

Anything related to reconstruction? :crossed_fingers:

1 Like

Sorry! I’ve had quite a not fun summer, so I was taking a bit of time to get things back under control.

Mmm… I’ve not picked through the GPU commits too thoroughly recently, but I recall us getting a patch from the Community to make WSL2 GPU detection way more robust.

2 Likes

Hi,

Noticed today that with my current settings (cut down log attached) after rolling shutter correction the re-construction pipeline has to be run again. As someone not too versed in the technicalities of this, if rolling shutter is a fixed value, why not apply it right at the start and only run the reconstruction once?

Given my velocites are very low, just some small residual movement, I’m thinking it’s probably worth turning off rolling shutter as it’s almost doubling my processing time (lots of ram but slow CPU’s on a server make matching quick but adding to reconstruction slow)

Appreciate the insight

[INFO]    Ground rectify is turned on, automatically turning on point cloud classification
[INFO]    Initializing ODM 2.9.1 - Sun Sep 25 16:16:49  2022
[INFO]    ==============
[INFO]    3d_tiles: False
[INFO]    auto_boundary: True
[INFO]    auto_boundary_distance: 0
[INFO]    bg_removal: False
[INFO]    boundary: {}
[INFO]    build_overviews: False
[INFO]    camera_lens: auto
[INFO]    cameras: {}
[INFO]    cog: True
[INFO]    copy_to: None
[INFO]    crop: 3
[INFO]    debug: False
[INFO]    dem_decimation: 1
[INFO]    dem_euclidean_map: False
[INFO]    dem_gapfill_steps: 3
[INFO]    dem_resolution: 5
[INFO]    depthmap_resolution: 700.0
[INFO]    dsm: True
[INFO]    dtm: False
[INFO]    end_with: odm_postprocess
[INFO]    fast_orthophoto: False
[INFO]    feature_quality: high
[INFO]    feature_type: sift
[INFO]    force_gps: True
[INFO]    gcp: None
[INFO]    geo: None
[INFO]    gps_accuracy: 10.0
[INFO]    ignore_gsd: False
[INFO]    matcher_neighbors: 12
[INFO]    matcher_type: flann
[INFO]    max_concurrency: 32
[INFO]    merge: all
[INFO]    mesh_octree_depth: 12
[INFO]    mesh_size: 600000
[INFO]    min_num_features: 10000
[INFO]    name: 1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be
[INFO]    no_gpu: False
[INFO]    optimize_disk_space: False
[INFO]    orthophoto_compression: DEFLATE
[INFO]    orthophoto_cutline: False
[INFO]    orthophoto_kmz: False
[INFO]    orthophoto_no_tiled: False
[INFO]    orthophoto_png: False
[INFO]    orthophoto_resolution: 2.0
[INFO]    pc_classify: True
[INFO]    pc_copc: False
[INFO]    pc_csv: False
[INFO]    pc_ept: True
[INFO]    pc_filter: 2.5
[INFO]    pc_geometric: True
[INFO]    pc_las: False
[INFO]    pc_quality: high
[INFO]    pc_rectify: True
[INFO]    pc_sample: 0
[INFO]    pc_tile: False
[INFO]    primary_band: auto
[INFO]    project_path: /var/www/data
[INFO]    radiometric_calibration: none
[INFO]    rerun: None
[INFO]    rerun_all: False
[INFO]    rerun_from: None
[INFO]    resize_to: 2048
[INFO]    rolling_shutter: True
[INFO]    rolling_shutter_readout: 60.0
[INFO]    sfm_algorithm: incremental
[INFO]    skip_3dmodel: False
[INFO]    skip_band_alignment: False
[INFO]    skip_orthophoto: False
[INFO]    skip_report: False
[INFO]    sky_removal: 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: False
[INFO]    verbose: True
[INFO]    ==============
[INFO]    Running dataset stage
[INFO]    Loading dataset from: /var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/images
[INFO]    Loading 231 images
[WARNING] Cannot read extended EXIF tags for DJI_0152.JPG: 'str' object has no attribute 'den'
[INFO]    Forcing GPS DOP to 10.0 for all images
[INFO]    Wrote images database: /var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/images.json
[INFO]    Found 231 usable images
[INFO]    Parsing SRS header: WGS84 UTM 30N
[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]    Maximum photo dimensions: 8064px
[INFO]    Photo dimensions for feature extraction: 4032px
[INFO]    nvidia-smi not found in PATH, using CPU
[INFO]    Altitude data detected, enabling it for GPS alignment
[INFO]    ['use_exif_size: no', 'flann_algorithm: KDTREE', 'feature_process_size: 4032', 'feature_min_frames: 10000', 'processes: 32', 'matching_gps_neighbors: 12', 'matching_gps_distance: 0', 'matching_graph_rounds: 0', 'optimize_camera_parameters: yes', 'reconstruction_algorithm: incremental', 'undistorted_image_format: tif', 'bundle_outlier_filtering_type: AUTO', 'sift_peak_threshold: 0.066', 'align_orientation_prior: vertical', 'triangulation_type: ROBUST', 'retriangulation_ratio: 2', 'matcher_type: FLANN', 'feature_type: SIFT', 'use_altitude_tag: yes', 'align_method: auto', 'local_bundle_radius: 0']
[INFO]    Wrote reference_lla.json
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" detect_features "/var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/opensfm"
2022-09-25 16:17:32,506 INFO: Planning to use 149543.511328125 MB of RAM for both processing queue and parallel processing.
2022-09-25 16:17:32,506 INFO: Scale-space expected size of a single image : 370.6402587890625 MB
2022-09-25 16:17:32,506 INFO: Expecting to queue at most 200 images while parallel processing of 32 images.
2022-09-25 16:17:32,522 INFO: Reading data for image DJI_0999.JPG (queue-size=0
2022-09-25 16:17:32,522 INFO: Reading data for image DJI_0173.JPG (queue-size=0

2022-09-25 16:21:23,013 DEBUG: Found 104724 points in 7.487073183059692s
2022-09-25 16:21:23,013 DEBUG: done
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" match_features "/var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/opensfm"
2022-09-25 16:21:37,222 INFO: Altitude is negative (-34.73510920795176) : viewing directions are probably divergent. Using default altitude of 1.0
2022-09-25 16:21:37,222 INFO: Altitude for orientation based matching 1.0
2022-09-25 16:21:37,249 INFO: Matching 1667 image pairs
2022-09-25 16:21:37,265 INFO: Computing pair matching with 32 processes
2022-09-25 16:21:44,733 DEBUG: Matching DJI_0136.JPG and DJI_0186.JPG.  Matcher: FLANN (symmetric) T-desc: 7.444 T-robust: 0.006 T-total: 7.452 Matches: 889 Robust: 799 Success: True
2022-09-25 16:29:39,221 DEBUG: Matching DJI_0122.JPG and DJI_0155.JPG.  Matcher: FLANN (symmetric) T-desc: 5.865 T-robust: 0.007 T-total: 5.876 Matches: 3296 Robust: 3124 Success: True
2022-09-25 16:29:39,230 INFO: Matched 1667 pairs (brown-brown: 1667) in 481.98112515099956 seconds (0.2891308500623875 seconds/pair).
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" create_tracks "/var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/opensfm"
2022-09-25 16:31:57,869 INFO: reading features
2022-09-25 16:33:29,852 DEBUG: Merging features onto tracks
2022-09-25 16:35:03,725 DEBUG: Good tracks: 2647662
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" reconstruct "/var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/opensfm"
2022-09-25 16:37:14,296 INFO: Starting incremental reconstruction
2022-09-25 16:39:34,404 INFO: Starting reconstruction with DJI_0991.JPG and DJI_0992.JPG
2022-09-25 16:39:34,782 INFO: Two-view 5-points reconstruction inliers (transposed=False): 44374 / 44376
2022-09-25 16:39:54,047 INFO: Triangulated: 44374
2022-09-25 16:40:37,716 DEBUG: Ceres Solver Report: Iterations: 101, Initial cost: 4.281418e+03, Final cost: 6.429670e+02, Termination: NO_CONVERGENCE
2022-09-25 16:40:38,489 INFO: Removed outliers: 202
2022-09-25 16:40:41,055 INFO: -------------------------------------------------------
2022-09-25 16:40:41,587 INFO: DJI_0990.JPG resection inliers: 23502 / 23502
2022-09-25 16:40:41,908 INFO: Adding DJI_0990.JPG to the reconstruction
2022-09-25 16:40:53,830 INFO: Shots and/or GCPs are well-conditioned. Using naive 3D-3D alignment.
2022-09-25 16:41:03,516 DEBUG: Ceres Solver Report: Iterations: 14, Initial cost: 7.828706e+03, Final cost: 1.632922e+03, Termination: CONVERGENCE
2022-09-25 16:41:05,143 INFO: Removed outliers: 171
2022-09-25 18:16:51,759 INFO: Shots and/or GCPs are well-conditioned. Using naive 3D-3D alignment.
2022-09-25 18:21:54,716 DEBUG: Ceres Solver Report: Iterations: 7, Initial cost: 2.015353e+05, Final cost: 1.266606e+05, Termination: CONVERGENCE
2022-09-25 18:22:54,690 INFO: Removed outliers: 3378
2022-09-25 18:23:45,779 INFO: Reconstruction 0: 231 images, 2537447 points
2022-09-25 18:23:45,779 INFO: 1 partial reconstructions in total.
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" rs_correct "/var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/opensfm"
2022-09-25 18:27:07,369 INFO: Starting rolling shutter correction
2022-09-25 18:28:01,904 INFO: Estimating camera velocities
2022-09-25 18:28:01,923 INFO: Using EXIF data
2022-09-25 18:28:01,923 INFO: DJI_0968.JPG (+0.00,+0.10,+0.10) m/s
2022-09-25 18:28:01,924 INFO: DJI_0969.JPG (+0.10,+0.00,+0.00) m/s
2022-09-25 18:28:01,936 INFO: Correcting observations...
2022-09-25 18:41:02,968 INFO: Writing corrected and trimmed features for DJI_0180.JPG
2022-09-25 18:41:04,131 INFO: Writing corrected and trimmed features for DJI_0186.JPG
[INFO]    Re-running the reconstruction pipeline
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" match_features "/var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/opensfm"
2022-09-25 18:45:10,108 INFO: Altitude is negative (-34.73510920795176) : viewing directions are probably divergent. Using default altitude of 1.0
2022-09-25 18:45:10,108 INFO: Altitude for orientation based matching 1.0
2022-09-25 18:45:10,134 INFO: Matching 1667 image pairs
2022-09-25 18:45:10,150 INFO: Computing pair matching with 32 processes
2022-09-25 18:45:13,057 DEBUG: Matching DJI_0132.JPG and DJI_0145.JPG.  Matcher: FLANN (symmetric) T-desc: 2.852 T-robust: 0.008 T-total: 2.863 Matches: 1577 Robust: 1522 Success: True
2022-09-25 18:45:13,273 DEBUG: Matching DJI_0055.JPG and DJI_0011.JPG.  Matcher: FLANN (symmetric) T-desc: 3.101 T-robust: 0.005 T-total: 3.109 Matches: 979 Robust: 927 Success: True
2022-09-25 18:48:05,579 INFO: Matched 1667 pairs (brown-brown: 1667) in 175.4444122950008 seconds (0.10524559890281963 seconds/pair).
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" create_tracks "/var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/opensfm"
2022-09-25 18:50:37,167 INFO: reading features
2022-09-25 18:51:11,871 DEBUG: Merging features onto tracks
2022-09-25 18:52:36,919 DEBUG: Good tracks: 2122605
[INFO]    running "/code/SuperBuild/install/bin/opensfm/bin/opensfm" reconstruct "/var/www/data/1b6ea0c4-5fa1-4617-82ec-6bfae8dde4be/opensfm"
2022-09-25 18:54:29,647 INFO: Starting incremental reconstruction
2022-09-25 18:56:36,755 INFO: Starting reconstruction with DJI_0991.JPG and DJI_0992.JPG
2022-09-25 18:56:37,137 INFO: Two-view 5-points reconstruction inliers (transposed=False): 41148 / 41151
2022-09-25 18:56:55,209 INFO: Triangulated: 41148
2022-09-25 18:57:36,800 DEBUG: Ceres Solver Report: Iterations: 101, Initial cost: 4.070229e+03, Final cost: 5.903571e+02, Termination: NO_CONVERGENCE
2022-09-25 18:57:37,504 INFO: Removed outliers: 170
1 Like

Just seen someone else mention this so feel free to move this into that topic:

1 Like

How fast was your drone travelling?

I’m not sure it’s worth the extra processing time unless you need very accurate absolute geolocation.

2 Likes

By the way, what should be the minimum drone speed to avoid rolling shutter effects if I set the shutter speed to 1/2000?

Shutter speed is not really relevant, its drone speed that is important.
With 50ms readout time, 1/2000 is still 1/20th of a second of drone movement

1 Like