compressai.losses#

Image/video losses#

RateDistortionLoss#

class compressai.losses.RateDistortionLoss(lmbda=0.01, metric='mse', return_type='all')[source]#

Custom rate distortion loss with a Lagrangian parameter.

forward(output, target)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Point cloud losses#

ChamferPccRateDistortionLoss#

class compressai.losses.ChamferPccRateDistortionLoss(lmbda=None, rate_key='bpp')[source]#

Simple loss for regular point cloud compression.

For compression models that reconstruct the input point cloud.

forward(output, target)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

RateDistortionLoss_hrtzxf2022#

class compressai.losses.RateDistortionLoss_hrtzxf2022(lmbda=None, compress_normal=False, latent_xyzs_codec_mode='learned')[source]#

Loss introduced in [He2022pcc] for “hrtzxf2022-pcc-rec” model.

References

[He2022pcc]

“Density-preserving Deep Point Cloud Compression”, by Yun He, Xinlin Ren, Danhang Tang, Yinda Zhang, Xiangyang Xue, and Yanwei Fu, CVPR 2022.

forward(output, target)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.