code: def test_to_evaluation_patches():
      dataset = foz.load_zoo_dataset("quickstart").clone()
      dataset.evaluate_detections("predictions", eval_key="eval")
  
      view = dataset.to_evaluation_patches("eval")
  
      # Eval patches views inherit tags from the dataset
      print(dataset.count_sample_tags())
      print(view.count_sample_tags())
  
      view.tag_samples("test")
  
      # Tagging eval patches has no effect on dataset samples
      print(view.count_sample_tags())
      print(dataset.count_sample_tags())
  
      view.untag_samples("test")
  
      # Untagging eval patches has no effect on dataset samples
      print(view.count_sample_tags())
      print(dataset.count_sample_tags())
  
      view.tag_labels("test")
  
      # Tagging eval labels immediately syncs with dataset labels
      print(view.count_label_tags())
      print(dataset.count_label_tags())
      print(dataset.count_values("ground_truth.detections.tags"))
      print(dataset.count_values("predictions.detections.tags"))
  
      view.untag_labels("test")
  
      # Untagging eval labels immediately syncs with dataset labels
      print(view.count_label_tags())
      print(dataset.count_label_tags())
      print(dataset.count_values("ground_truth.detections.tags"))
      print(dataset.count_values("predictions.detections.tags"))
  
      view2 = view.match(F("crowd") == True)
      view2.tag_labels("crowded", "predictions")
  
      # Tagging a view into an evaluation view only affects the constituent
      # labels, both in the patches view and the source dataset
      print(view2.count("predictions.detections"))
      print(view.count_label_tags())
      print(dataset.count_label_tags())
      print(dataset.count_values("ground_truth.detections.tags"))
      print(dataset.count_values("predictions.detections.tags"))
  
      view2.set_field("ground_truth.detections.hello", "world").save()
  
      # Saving an eval view syncs modifications and deletions with the source
      # dataset
      print(view.count("ground_truth.detections"))
      print(dataset.count("ground_truth.detections"))
      print(view.count("predictions.detections"))
      print(dataset.count("predictions.detections"))
      print(dataset.count_values("ground_truth.detections.hello"))
  
      sample = view.first()
  
      for det in sample.predictions.detections:
          det.hello = "world"
  
      sample.save()
  
      # Directly editing and saving a single eval patch syncs any label changes
      # with the dataset's labels
      print(view.count_values("predictions.detections.hello"))
      print(dataset.count_values("predictions.detections.hello"))
  
      dataset.untag_samples("validation")
      view.reload()
  
      # Reloading an eval view syncs it with the source dataset's contents
      print(dataset.count_sample_tags())
      print(view.count_sample_tags())
  
imports: import unittest
  import fiftyone
  import fiftyone.zoo
  from fiftyone import ViewField
label_desc: Use image node_id 2 for calling a global function with example usage: test_to_evaluation_patches() without return types