code: def test_get_segments_from_frame_predictions_with_fpn(self):
      class_probs = np.array(
          [
              # FPN level 0
              [0.9, 0.1, 0.2],
              [0.1, 0.1, 0.2],
              [0.6, 0.3, 0.2],
              [0.1, 0.8, 0.2],
              [0.9, 0.1, 0.2],
              [0.1, 0.1, 0.2],
              [0.6, 0.3, 0.2],  # mask out
              [0.1, 0.8, 0.2],  # mask out
              # FPN level 1
              [0.9, 0.1, 0.2],
              [0.1, 0.1, 0.2],
              [0.6, 0.3, 0.2],
              [0.1, 0.8, 0.2],  # mask out
          ]
      )
      displacements = np.array(
          [
              # FPN level 0
              [[0.5, 0.5], [0.1, 0.1], [0.2, 0.2]],
              [[0.1, 0.2], [0.1, 0.2], [0.2, 0.3]],
              [[0.5, 0.5], [0.1, 0.1], [0.2, 0.2]],
              [[0.1, 0.2], [0.1, 0.2], [0.2, 0.3]],
              [[0.5, 0.5], [0.1, 0.1], [0.2, 0.2]],
              [[0.1, 0.2], [0.1, 0.2], [0.2, 0.3]],
              [[0.5, 0.5], [0.1, 0.1], [0.2, 0.2]],  # mask out
              [[0.1, 0.2], [0.1, 0.2], [0.2, 0.3]],  # mask out
              # FPN level 1
              [[0.5, 0.5], [0.1, 0.1], [0.2, 0.2]],
              [[0.1, 0.2], [0.1, 0.2], [0.2, 0.3]],
              [[0.5, 0.5], [0.1, 0.1], [0.2, 0.2]],
              [[0.1, 0.2], [0.1, 0.2], [0.2, 0.3]],  # mask out
          ]
      )
      input_mask = np.array(
          [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0], dtype=np.int32
      )
      total_frames = 16
      (
          actual_class_indices,
          actual_class_probs,
          actual_segments,
      ) = postprocessing_utils.get_segments_from_frame_predictions(
          class_probs,
          displacements,
          input_mask=input_mask,
          total_frames=total_frames,
          stride=1,
          secs_per_timestep=1.0,
          score_threshold=float("-inf"),
          feature_pyramid_config=ml_collections.ConfigDict(
              {
                  "num_features_level0": 8,
                  "feature_pyramid_downsample_stride": 2,
                  "feature_pyramid_levels": [0, 1],
              }
          ),
      )
      self.assertAllEqual(
          actual_class_indices, [0, 1, 2] * np.sum(input_mask)
      )
      self.assertAllClose(
          actual_class_probs,
          class_probs[input_mask.astype(bool)].flatten(),
      )
      expected_segments = [
          [0.0, 12.0],
          [2.4, 5.6],
          [0.8, 7.2],
          [3.4, 8.2],
          [3.4, 8.2],
          [1.8, 9.8],
          [0.0, 14.0],
          [4.4, 7.6],
          [2.8, 9.2],
          [5.4, 10.2],
          [5.4, 10.2],
          [3.8, 11.8],
          [0.0, 16.0],
          [6.4, 9.6],
          [4.8, 11.2],
          [7.4, 12.2],
          [7.4, 12.2],
          [5.8, 13.8],
          [0.0, 12.0],
          [2.4, 5.6],
          [0.8, 7.2],
          [4.4, 9.2],
          [4.4, 9.2],
          [2.8, 10.8],
          [0.0, 16.0],
          [6.4, 9.6],
          [4.8, 11.2],
      ]
      self.assertAllClose(actual_segments, expected_segments)
  
file_path: scenic/scenic/projects/unloc/postprocessing_utils_test.py
imports: from absl.testing import parameterized
  import ml_collections
  import numpy
  from scenic.projects.unloc import metrics
  from scenic.projects.unloc import postprocessing_utils
  import tensorflow
label_desc: Use image node_id 4 for calling the PostprocessingUtilsTest obj's underlying member method code with example usage: obj.test_get_segments_from_frame_predictions_with_fpn() without return types