def processing_statistics( data: DataSet, reconstructions: List[types.Reconstruction]) -> Dict[str, Any]: steps = { "Feature Extraction": "features.json", "Features Matching": "matches.json", "Tracks Merging": "tracks.json", "Reconstruction": "reconstruction.json", } steps_times = {} for step_name, report_file in steps.items(): file_path = os.path.join(data.data_path, "reports", report_file) if os.path.exists(file_path): with io.open_rt(file_path) as fin: obj = io.json_load(fin) else: obj = {} if "wall_time" in obj: steps_times[step_name] = obj["wall_time"] elif "wall_times" in obj: steps_times[step_name] = sum(obj["wall_times"].values()) else: steps_times[step_name] = -1 stats = {} stats["steps_times"] = steps_times stats["steps_times"]["Total Time"] = sum( filter(lambda x: x >= 0, steps_times.values())) try: stats["date"] = datetime.datetime.fromtimestamp( data.io_handler.timestamp(data._reconstruction_file( None))).strftime("%d/%m/%Y at %H:%M:%S") except FileNotFoundError: stats["date"] = "unknown" start_ct, end_ct = start_end_capture_time(reconstructions) if start_ct is not None and end_ct is not None: stats["start_date"] = datetime.datetime.fromtimestamp( start_ct).strftime("%d/%m/%Y at %H:%M:%S") stats["end_date"] = datetime.datetime.fromtimestamp(end_ct).strftime( "%d/%m/%Y at %H:%M:%S") else: stats["start_date"] = "unknown" stats["end_date"] = "unknown" default_max = 1e30 min_x, min_y, max_x, max_y = default_max, default_max, 0, 0 for rec in reconstructions: for shot in rec.shots.values(): o = shot.pose.get_origin() min_x = min(min_x, o[0]) min_y = min(min_y, o[1]) max_x = max(max_x, o[0]) max_y = max(max_y, o[1]) stats["area"] = (max_x - min_x) * (max_y - min_y) if min_x != default_max else -1 return stats
def processing_statistics(data: DataSet, reconstructions): steps = { "Feature Extraction": "features.json", "Features Matching": "matches.json", "Tracks Merging": "tracks.json", "Reconstruction": "reconstruction.json", } steps_times = {} for step_name, report_file in steps.items(): file_path = os.path.join(data.data_path, "reports", report_file) if os.path.exists(file_path): with io.open_rt(file_path) as fin: obj = io.json_load(fin) else: obj = {} if "wall_time" in obj: steps_times[step_name] = obj["wall_time"] elif "wall_times" in obj: steps_times[step_name] = sum(obj["wall_times"].values()) else: steps_times[step_name] = -1 stats = {} stats["steps_times"] = steps_times stats["steps_times"]["Total Time"] = sum( filter(lambda x: x >= 0, steps_times.values())) stats["date"] = datetime.datetime.fromtimestamp( os.path.getmtime( data._reconstruction_file(None))).strftime("%d/%m/%Y at %H:%M:%S") min_x, min_y, max_x, max_y = 1e30, 1e30, 0, 0 for rec in reconstructions: for shot in rec.shots.values(): o = shot.pose.get_origin() min_x = min(min_x, o[0]) min_y = min(min_y, o[1]) max_x = max(max_x, o[0]) max_y = max(max_y, o[1]) stats["area"] = (max_x - min_x) * (max_y - min_y) return stats