code: def test_to_frames():
      dataset = foz.load_zoo_dataset("quickstart-video").clone()
  
      dataset.tag_samples("test")
  
      frames = dataset.to_frames(sample_frames=True)
  
      # Frames inherit sample tags
      print(dataset.count_sample_tags())
      print(frames.count_sample_tags())
  
      frames.tag_samples("frames")
  
      # Tagging frames has no effect on the source dataset
      print(frames.count_sample_tags())
      print(dataset.count_sample_tags())
  
      frames.untag_samples("frames")
  
      # Untagging frames has no effect on the source dataset
      print(frames.count_sample_tags())
      print(dataset.count_sample_tags())
  
      frames.tag_labels("test")
  
      # Tagging labels applies to the source dataset
      print(frames.count_label_tags())
      print(dataset.count_label_tags())
      print(dataset.count_values("frames.detections.detections.tags"))
  
      frames.untag_labels("test")
  
      # Untagging labels applies to the source dataset
      print(frames.count_label_tags())
      print(dataset.count_label_tags())
      print(dataset.count_values("frames.detections.detections.tags"))
  
      view = frames.limit(100).set_field(
          "detections.detections.label", F("label").upper()
      )
  
      # Views can be created, but don't affect source dataset until saved
      print(frames.count("detections.detections"))
      print(view.count("detections.detections"))
      print(dataset.count("frames.detections.detections"))
      print(frames.count_values("detections.detections.label"))
      print(view.count_values("detections.detections.label"))
      print(dataset.count_values("frames.detections.detections.label"))
  
      view.save()
  
      # Changes and deletions are synced with source dataset
      print(frames.count("detections.detections"))
      print(view.count("detections.detections"))
      print(dataset.count("frames.detections.detections"))
      print(frames.count_values("detections.detections.label"))
      print(view.count_values("detections.detections.label"))
      print(dataset.count_values("frames.detections.detections.label"))
  
      # Ensure that data is correctly formed
      print(frames.first().sample_id)
      print(dataset.first().frames.first().id)
  
      sample = frames.first()
  
      sample["hello"] = "world"
      sample.save()
  
      # Fields can be added by direct sample modification, and are saved
      print(frames)
      print(dataset)
      print(frames.count_values("hello"))
      print(dataset.count_values("frames.hello"))
  
      sample = frames.exclude_fields("detections").first()
      sample["hello2"] = "world2"
      sample.save()
  
      # Excluded fields are not removed when saving frame samples
      print(frames)
      print(dataset)
      print(frames.count_values("detections.detections.label"))
      print(frames.count_values("hello2"))
      print(dataset.count_values("frames.hello2"))
      print(dataset.count_values("frames.detections.detections.label"))
  
      dataset.untag_samples("test")
      frames.reload()
  
      # Reloading a view syncs it with the source dataset
      print(dataset.count_sample_tags())
      print(frames.count_sample_tags())
  
file_path: fiftyone/tests/intensive/video_tests.py
imports: import random
  import unittest
  import fiftyone
  import fiftyone.zoo
  from fiftyone import ViewField
  import fiftyone.utils.video
label_desc: Use image node_id 2 for calling a global function with example usage: test_to_frames() without return types