def register_samples(self, samples, eval_key, dynamic=True):
        """Registers the collection on which evaluation will be performed.

        This method will be called before the first call to :meth:`evaluate`.
        Subclasses can extend this method to perform any setup required for an
        evaluation run.

        Args:
            samples: a :class:`fiftyone.core.collections.SampleCollection`
            eval_key: the evaluation key for this evaluation
            dynamic (True): whether to declare the dynamic object-level
                attributes that are populated on the dataset's schema
        """
        _gt_field = self.config.gt_field
        _pred_field = self.config.pred_field

        self.gt_field, _ = samples._handle_frame_field(_gt_field)
        self.pred_field, _ = samples._handle_frame_field(_pred_field)

        if eval_key is None:
            return

        processing_frames = samples._is_frame_field(_pred_field)
        dataset = samples._dataset

        tp_field = "%s_tp" % eval_key
        fp_field = "%s_fp" % eval_key
        fn_field = "%s_fn" % eval_key

        dataset.add_sample_field(tp_field, fof.IntField)
        dataset.add_sample_field(fp_field, fof.IntField)
        dataset.add_sample_field(fn_field, fof.IntField)

        if processing_frames:
            dataset.add_frame_field(tp_field, fof.IntField)
            dataset.add_frame_field(fp_field, fof.IntField)
            dataset.add_frame_field(fn_field, fof.IntField)

        if not dynamic:
            return

        id_key = "%s_id" % eval_key
        iou_key = "%s_iou" % eval_key

        _, gt_prefix = samples._get_label_field_path(_gt_field)
        gt_prefix, _ = samples._handle_frame_field(gt_prefix)

        gt_eval = gt_prefix + "." + eval_key
        gt_id = gt_prefix + "." + id_key
        gt_iou = gt_prefix + "." + iou_key

        _, pred_prefix = samples._get_label_field_path(_pred_field)
        pred_prefix, _ = samples._handle_frame_field(pred_prefix)

        pred_eval = pred_prefix + "." + eval_key
        pred_id = pred_prefix + "." + id_key
        pred_iou = pred_prefix + "." + iou_key

        if processing_frames:
            dataset.add_frame_field(gt_eval, fof.StringField)
            dataset.add_frame_field(gt_id, fof.StringField)
            dataset.add_frame_field(gt_iou, fof.FloatField)
            dataset.add_frame_field(pred_eval, fof.StringField)
            dataset.add_frame_field(pred_id, fof.StringField)
            dataset.add_frame_field(pred_iou, fof.FloatField)
        else:
            dataset.add_sample_field(gt_eval, fof.StringField)
            dataset.add_sample_field(gt_id, fof.StringField)
            dataset.add_sample_field(gt_iou, fof.FloatField)
            dataset.add_sample_field(pred_eval, fof.StringField)
            dataset.add_sample_field(pred_id, fof.StringField)
            dataset.add_sample_field(pred_iou, fof.FloatField)
Registers the collection on which evaluation will be performed.

        This method will be called before the first call to :meth:`evaluate`.
        Subclasses can extend this method to perform any setup required for an
        evaluation run.

        Args:
            samples: a :class:`fiftyone.core.collections.SampleCollection`
            eval_key: the evaluation key for this evaluation
            dynamic (True): whether to declare the dynamic object-level
                attributes that are populated on the dataset's schema
        
fiftyone/utils/eval/detection.py