MCPcopy Create free account
hub / github.com/colmap/colmap / process_scenes

Function process_scenes

benchmark/reconstruction/evaluation/utils.py:831–929  ·  view source on GitHub ↗
(
    args: argparse.Namespace,
    scene_infos: list[SceneInfo],
    prepare_scene: Callable[[SceneInfo], None],
    position_accuracy_gt: float,
)

Source from the content-addressed store, hash-verified

829
830
831def process_scenes(
832 args: argparse.Namespace,
833 scene_infos: list[SceneInfo],
834 prepare_scene: Callable[[SceneInfo], None],
835 position_accuracy_gt: float,
836) -> MetricsByCatByScene:
837 error_thresholds = get_error_thresholds(args)
838
839 gpu_index = _parse_gpu_index(args)
840 scene_gpu_pairs = [
841 (scene_info, str(gpu_index[i % len(gpu_index)]))
842 for i, scene_info in enumerate(scene_infos)
843 ]
844
845 num_parallel_scenes = min(args.num_parallel_scenes, len(scene_infos))
846 num_threads_per_scene = max(1, args.num_threads // num_parallel_scenes)
847
848 manager = None
849 progress_status = None
850 monitor_thread = None
851 stop_event = threading.Event()
852 if args.progress:
853 manager = multiprocessing.Manager()
854 progress_status = manager.dict()
855 monitor_thread = threading.Thread(
856 target=_run_progress_monitor,
857 args=(progress_status, len(scene_infos), stop_event),
858 daemon=True,
859 )
860 monitor_thread.start()
861
862 try:
863 p = multiprocessing.Pool(
864 processes=num_parallel_scenes, initializer=_init_pool_worker
865 )
866 try:
867 results = list(
868 p.imap_unordered(
869 functools.partial(
870 _process_scene_with_gpu,
871 args=args,
872 prepare_scene=prepare_scene,
873 position_accuracy_gt=position_accuracy_gt,
874 num_threads=num_threads_per_scene,
875 progress_status=progress_status,
876 ),
877 scene_gpu_pairs,
878 chunksize=1,
879 )
880 )
881 except KeyboardInterrupt:
882 pycolmap.logging.warning(
883 "Interrupted, terminating workers and child processes..."
884 )
885 p.terminate()
886 raise
887 except BaseException:
888 p.terminate()

Callers 1

mainFunction · 0.90

Calls 8

get_error_thresholdsFunction · 0.85
_parse_gpu_indexFunction · 0.85
MetricsClass · 0.85
compute_aucFunction · 0.85
compute_recallFunction · 0.85
aggregate_scene_metricsFunction · 0.85
ThreadMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected