MCPcopy Create free account
hub / github.com/apple/ml-pointersect / compute_metrics_for_rgbd_images

Function compute_metrics_for_rgbd_images

pointersect/inference/infer.py:794–1420  ·  view source on GitHub ↗

Compare a list of rgbd_images, create gif, compute difference from ref_rgbd_image if given. Note we assume the camera used to capture the rgbd images are the same. Args: rgbd_images: list of rgbd_image to compare. ref_rgbd_image: reference rgbd i

(
        rgbd_images: T.List[RGBDImage],
        ref_rgbd_image: RGBDImage,
        ref_mesh: Mesh = None,
        names: T.List[str] = None,
        rgb_metric: T.List[str] = 'psnr',
        depth_metric: T.List[str] = 'rmse',
        normal_metric: T.List[str] = 'avg_angle',
        hit_metric: T.List[str] = 'accuracy',
        pcd_metric: T.List[str] = [],
        filtered_pcd_metric: T.List[str] = [],
        th_dot_product: float = 0.5,  # (less than 60 degree)
        output_filename: str = None,
)

Source from the content-addressed store, hash-verified

792
793
794def compute_metrics_for_rgbd_images(
795 rgbd_images: T.List[RGBDImage],
796 ref_rgbd_image: RGBDImage,
797 ref_mesh: Mesh = None,
798 names: T.List[str] = None,
799 rgb_metric: T.List[str] = 'psnr',
800 depth_metric: T.List[str] = 'rmse',
801 normal_metric: T.List[str] = 'avg_angle',
802 hit_metric: T.List[str] = 'accuracy',
803 pcd_metric: T.List[str] = [],
804 filtered_pcd_metric: T.List[str] = [],
805 th_dot_product: float = 0.5, # (less than 60 degree)
806 output_filename: str = None,
807) -> T.Dict[str, T.Any]:
808 """
809 Compare a list of rgbd_images, create gif, compute difference from ref_rgbd_image if given.
810 Note we assume the camera used to capture the rgbd images are the same.
811
812 Args:
813 rgbd_images:
814 list of rgbd_image to compare.
815 ref_rgbd_image:
816 reference rgbd image to compute the error against
817 names:
818 name of the rgbd_images. If None, it will become their indexes.
819 rgb_metric:
820 'psnr'
821 depth_metric:
822 'rmse',
823 normal_metric:
824 'avg_angle'
825 hit_metric:
826 'accuracy'
827 pcd_metric:
828 'rmse_signed_distance' (need ref_mesh to be given)
829 'max_signed_distance' (need ref_mesh to be given)
830 'rmse_distance' (need ref_mesh to be given)
831 'max_distance' (need ref_mesh to be given)
832
833 Returns:
834 rgb_err_dicts:
835 name -> error dict for rgb (metric_name -> val (b,q)). err_dict will be None if input/gt not presented
836 depth_err_dicts:
837 name -> error dict for deoth (metric_name -> val (b,q)). err_dict will be None if input/gt not presented
838 normal_err_dicts:
839 name -> error dict for normal (metric_name -> val (b,q)). err_dict will be None if input/gt not presented
840 hit_err_dicts:
841 name -> error dict for hit (metric_name -> val (b,q)). err_dict will be None if input/gt not presented
842 pcd_err_dicts:
843 name -> error dict for pcd (metric_name -> val (b,q)). err_dict will be None if input/gt not presented
844
845 Procedure:
846 - before adding the name to the image, compute the error to the reference
847 - create tmp rgb, depth, normal_w, hit_map if not None. If one content is None, skip the image
848 """
849 assert ref_rgbd_image is not None
850
851 if isinstance(rgb_metric, str):

Callers

nothing calls this directly

Calls 11

get_lpips_modelFunction · 0.90
deviceMethod · 0.80
generate_camera_raysMethod · 0.80
sizeMethod · 0.80
get_pcdMethod · 0.80
get_o3d_pcdsMethod · 0.80
reshapeMethod · 0.45
detachMethod · 0.45
toMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected