MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / __init__

Method __init__

PATH/core/models/decoders/losses/criterion.py:175–200  ·  view source on GitHub ↗

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, eos_coef, losses,
                 num_points, oversample_ratio, importance_sample_ratio, ginfo, sample_weight=None)

Source from the content-addressed store, hash-verified

173 """
174
175 def __init__(self, num_classes, matcher, weight_dict, eos_coef, losses,
176 num_points, oversample_ratio, importance_sample_ratio, ginfo, sample_weight=None):
177 """Create the criterion.
178 Parameters:
179 num_classes: number of object categories, omitting the special no-object category
180 matcher: module able to compute a matching between targets and proposals
181 weight_dict: dict containing as key the names of the losses and as values their relative weight.
182 eos_coef: relative classification weight applied to the no-object category
183 losses: list of all the losses to be applied. See get_loss for list of available losses.
184 """
185 super().__init__()
186 self.num_classes = num_classes
187 self.matcher = matcher
188 self.weight_dict = weight_dict
189 self.eos_coef = eos_coef
190 self.losses = losses
191 empty_weight = torch.ones(self.num_classes + 1)
192 empty_weight[-1] = self.eos_coef
193 self.register_buffer("empty_weight", empty_weight)
194 self.sample_weight = sample_weight
195
196 # pointwise mask loss parameters
197 self.num_points = num_points
198 self.oversample_ratio = oversample_ratio
199 self.importance_sample_ratio = importance_sample_ratio
200 self.ginfo = ginfo # distributed info
201
202 def loss_labels(self, outputs, targets, indices, num_masks):
203 """Classification loss (NLL)

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected