code: def test_to_frames_sparse(self):
      dataset = fo.Dataset()
  
      sample1 = fo.Sample(
          filepath="video1.mp4",
          metadata=fo.VideoMetadata(total_frame_count=4),
      )
      sample1.frames[1] = fo.Frame(filepath="image11.jpg")
      sample1.frames[2] = fo.Frame(
          filepath="image12.jpg",
          ground_truth=fo.Detections(
              detections=[
                  fo.Detection(label="cat"),
                  fo.Detection(label="dog"),
              ]
          ),
      )
      sample1.frames[3] = fo.Frame(
          filepath="image13.jpg", hello="goodbye"
      )
  
      sample2 = fo.Sample(
          filepath="video2.mp4",
          metadata=fo.VideoMetadata(total_frame_count=5),
      )
      sample2.frames[1] = fo.Frame(
          filepath="image21.jpg",
          ground_truth=fo.Detections(
              detections=[fo.Detection(label="rabbit")]
          ),
      )
      sample2.frames[3] = fo.Frame(filepath="image23.jpg")
      sample2.frames[5] = fo.Frame(
          filepath="image25.jpg", hello="there"
      )
  
      dataset.add_samples([sample1, sample2])
  
      # `sparse=True` would only be needed here if `sample_frames=True`
      frames = dataset.to_frames()
      self.assertEqual(len(frames), 6)
  
      # `sparse=True` would only be needed here if `sample_frames=True`
      view = dataset.match_frames(
          F("ground_truth.detections").length() > 1
      )
      frames = view.to_frames()
      self.assertEqual(len(frames), 1)
  
imports: from copy import deepcopy
  from datetime import date, datetime
  from bson import ObjectId
  import numpy
  import unittest
  import fiftyone
  import fiftyone.core.odm
  from fiftyone import ViewField
  from decorators import drop_datasets
label_desc: Use image node_id 28 for calling the VideoTests obj's underlying member method code with example usage: obj.test_to_frames_sparse() without return types