code: def compute_visibility(
      segmentation: np.ndarray, assets: Sequence[core.Asset]
  ):
      """Compute how many pixels are visible for each instance at each frame.
  
      Args:
        segmentation: An integer array that contains segmentation indices.
        assets: The list of assets in the scene (whose ordering corresponds to the segmentation indices)
  
      """
      for i, asset in enumerate(assets, start=1):
          asset.metadata["visibility"] = [
              int(np.sum(segmentation[t] == i))
              for t in range(segmentation.shape[0])
          ]
  
imports: import numpy
  from typing import Sequence
  from kubric import core
  from kubric.kubric_typing import ArrayLike
label_desc: Use image node_id 1 for calling a global function with example usage: compute_visibility(segmentation, assets) without return types