class_docstr: The F-score (Dice coefficient) can be interpreted as a weighted average of the precision and recall,
  where an F-score reaches its best value at 1 and worst score at 0.
  The relative contribution of ``precision`` and ``recall`` to the F1-score are equal.
  The formula for the F score is:
  
  .. math:: F_\beta(precision, recall) = (1 + \beta^2) \frac{precision \cdot recall}
      {\beta^2 \cdot precision + recall}
  
  The formula in terms of *Type I* and *Type II* errors:
  
  .. math:: L(tp, fp, fn) = \frac{(1 + \beta^2) \cdot tp} {(1 + \beta^2) \cdot fp + \beta^2 \cdot fn + fp}
  
  where:
       - tp - true positives;
       - fp - false positives;
       - fn - false negatives;
  
  Args:
      beta: Integer of float f-score coefficient to balance precision and recall.
      class_weights: 1. or ``np.array`` of class weights (``len(weights) = num_classes``)
      class_indexes: Optional integer or list of integers, classes to consider, if ``None`` all classes are used.
      smooth: Float value to avoid division by zero.
      per_image: If ``True``, metric is calculated as mean over images in batch (B),
          else over whole batch.
      threshold: Float value to round predictions (use ``>`` comparison), if ``None`` prediction will not be round.
      name: Optional string, if ``None`` default ``f{beta}-score`` name is used.
  
  Returns:
      A callable ``f_score`` instance. Can be used in ``model.compile(...)`` function.
  
  Example:
  
  .. code:: python
  
      metric = FScore()
      model.compile('SGD', loss=loss, metrics=[metric])
class_docstr_tok: ["The","F-score","(","Dice","coefficient",")","can","be","interpreted","as","a","weighted","average","of","the","precision","and","recall",",","where","an","F-score","reaches","its","best","value","at","1","and","worst","score","at","0",".","The","relative","contribution","of","``","precision","``","and","``","recall","``","to","the","F1-score","are","equal",".","The","formula","for","the","F","score","is",":","..","math",":",":","F_\\beta","(","precision",",","recall",")","=","(","1","+","\\beta^2",")","\\frac","{","precision","\\cdot","recall","}","{","\\beta^2","\\cdot","precision","+","recall","}","The","formula","in","terms","of","*","Type","I","*","and","*","Type","II","*","errors",":","..","math",":",":","L","(","tp",",","fp",",","fn",")","=","\\frac","{","(","1","+","\\beta^2",")","\\cdot","tp","}","{","(","1","+","\\beta^2",")","\\cdot","fp","+","\\beta^2","\\cdot","fn","+","fp","}","where",":","-","tp","-","true","positives",";","-","fp","-","false","positives",";","-","fn","-","false","negatives",";","Args",":","beta",":","Integer","of","float","f-score","coefficient","to","balance","precision","and","recall",".","class_weights",":","1.","or","``","np.array","``","of","class","weights","(","``","len","(","weights",")","=","num_classes","``",")","class_indexes",":","Optional","integer","or","list","of","integers",",","classes","to","consider",",","if","``","None","``","all","classes","are","used",".","smooth",":","Float","value","to","avoid","division","by","zero",".","per_image",":","If","``","True","``",",","metric","is","calculated","as","mean","over","images","in","batch","(","B",")",",","else","over","whole","batch",".","threshold",":","Float","value","to","round","predictions","(","use","``",">","``","comparison",")",",","if","``","None","``","prediction","will","not","be","round",".","name",":","Optional","string",",","if","``","None","``","default","``","f","{","beta","}","-score","``","name","is","used",".","Returns",":","A","callable","``","f_score","``","instance",".","Can","be","used","in","``","model.compile","(","...",")","``","function",".","Example",":","..","code",":",":","python","metric","=","FScore","(",")","model.compile","(","'SGD","'",",","loss=loss",",","metrics=","[","metric","]",")"]
code: def __call__(self, gt, pr):
      return F.f_score(
          gt,
          pr,
          beta=self.beta,
          class_weights=self.class_weights,
          class_indexes=self.class_indexes,
          smooth=self.smooth,
          per_image=self.per_image,
          threshold=self.threshold,
          **self.submodules,
      )
  
file_path: segmentation_models/segmentation_models/metrics.py
imports: from .base import Metric
  from .base import functional
label_desc: Use image node_id 2 for calling the FScore obj's underlying member method code with example usage: obj.__call__(gt, pr) and returns: F