def __init__(self, path_key: str = "filepath", probs_key: str = "logits", activation: str = "Softmax", out_file: str = 'infer_pred.txt'): """ Args: metric_names (List[str]): of metrics to print Make sure that they are in the same order that metrics are outputted by the meters in `meter_list` meter_list (list-like): List of meters.meter.Meter instances len(meter_list) == num_classes input_key (str): input key to use for metric calculation specifies our ``y_true``. output_key (str): output key to use for metric calculation; specifies our ``y_pred`` class_names (List[str]): class names to display in the logs. If None, defaults to indices for each class, starting from 0. num_classes (int): Number of classes; must be > 1 activation (str): An torch.nn activation applied to the logits. Must be one of ['none', 'Sigmoid', 'Softmax2d'] """ super().__init__(CallbackOrder.Logging) self.input_key = path_key self.output_key = probs_key self.activation = activation self.activation_fn = get_activation_fn(self.activation) self.preds = [] self.out_file = out_file
def __init__( self, metric_names: List[str], meter_list: List, input_key: str = "targets", output_key: str = "logits", class_names: List[str] = None, num_classes: int = 2, activation: str = "Sigmoid", ): """ Args: metric_names: of metrics to print Make sure that they are in the same order that metrics are outputted by the meters in `meter_list` meter_list: List of meters.meter.Meter instances len(meter_list) == num_classes input_key: input key to use for metric calculation specifies our ``y_true``. output_key: output key to use for metric calculation; specifies our ``y_pred`` class_names: class names to display in the logs. If None, defaults to indices for each class, starting from 0. num_classes: Number of classes; must be > 1 activation: An torch.nn activation applied to the logits. Must be one of ['none', 'Sigmoid', 'Softmax2d'] """ super().__init__(CallbackOrder.metric) self.metric_names = metric_names self.meters = meter_list self.input_key = input_key self.output_key = output_key self.class_names = class_names self.num_classes = num_classes self.activation = activation self.activation_fn = get_activation_fn(self.activation)