Create the criterion. Parameters: num_classes: number of object categories, omitting the special no-object category matcher: module able to compute a matching between targets and proposals weight_dict: dict containing as key the names of the losses and as
(self, num_classes,
matcher,
weight_dict,
losses)
| 37 | |
| 38 | class ClipMatcher(SetCriterion): |
| 39 | def __init__(self, num_classes, |
| 40 | matcher, |
| 41 | weight_dict, |
| 42 | losses): |
| 43 | """ Create the criterion. |
| 44 | Parameters: |
| 45 | num_classes: number of object categories, omitting the special no-object category |
| 46 | matcher: module able to compute a matching between targets and proposals |
| 47 | weight_dict: dict containing as key the names of the losses and as values their relative weight. |
| 48 | eos_coef: relative classification weight applied to the no-object category |
| 49 | losses: list of all the losses to be applied. See get_loss for list of available losses. |
| 50 | """ |
| 51 | super().__init__(num_classes, matcher, weight_dict, losses) |
| 52 | self.num_classes = num_classes |
| 53 | self.matcher = matcher |
| 54 | self.weight_dict = weight_dict |
| 55 | self.losses = losses |
| 56 | self.focal_loss = True |
| 57 | self.losses_dict = {} |
| 58 | self._current_frame_idx = 0 |
| 59 | |
| 60 | def initialize_for_single_clip(self, gt_instances: List[Instances]): |
| 61 | self.gt_instances = gt_instances |