class_docstr: Seesaw Loss for Long-Tailed Instance Segmentation (CVPR 2021)
  arXiv: https://arxiv.org/abs/2008.10032
  
  Args:
      use_sigmoid (bool, optional): Whether the prediction uses sigmoid
           of softmax. Only False is supported.
      p (float, optional): The ``p`` in the mitigation factor.
           Defaults to 0.8.
      q (float, optional): The ``q`` in the compenstation factor.
           Defaults to 2.0.
      num_classes (int, optional): The number of classes.
           Default to 1203 for LVIS v1 dataset.
      eps (float, optional): The minimal value of divisor to smooth
           the computation of compensation factor
      reduction (str, optional): The method that reduces the loss to a
           scalar. Options are "none", "mean" and "sum".
      loss_weight (float, optional): The weight of the loss. Defaults to 1.0
      return_dict (bool, optional): Whether return the losses as a dict.
           Default to True.
class_docstr_tok: ["Seesaw","Loss","for","Long-Tailed","Instance","Segmentation","(","CVPR","2021",")","arXiv",":","https",":","\/\/arxiv.org\/abs\/2008.10032","Args",":","use_sigmoid","(","bool",",","optional",")",":","Whether","the","prediction","uses","sigmoid","of","softmax",".","Only","False","is","supported",".","p","(","float",",","optional",")",":","The","``","p","``","in","the","mitigation","factor",".","Defaults","to","0.8.","q","(","float",",","optional",")",":","The","``","q","``","in","the","compenstation","factor",".","Defaults","to","2.0.","num_classes","(","int",",","optional",")",":","The","number","of","classes",".","Default","to","1203","for","LVIS","v1","dataset",".","eps","(","float",",","optional",")",":","The","minimal","value","of","divisor","to","smooth","the","computation","of","compensation","factor","reduction","(","str",",","optional",")",":","The","method","that","reduces","the","loss","to","a","scalar",".","Options","are","``","none","''",",","``","mean","''","and","``","sum","''",".","loss_weight","(","float",",","optional",")",":","The","weight","of","the","loss",".","Defaults","to","1.0","return_dict","(","bool",",","optional",")",":","Whether","return","the","losses","as","a","dict",".","Default","to","True","."]
docstr: Get custom activation of cls_score.
  
  Args:
      cls_score (Tensor): The prediction with shape (N, C + 2).
  
  Returns:
      Tensor: The custom activation of cls_score with shape
           (N, C + 1).
docstr_tok: ["Get","custom","activation","of","cls_score",".","Args",":","cls_score","(","Tensor",")",":","The","prediction","with","shape","(","N",",","C","+","2",")",".","Returns",":","Tensor",":","The","custom","activation","of","cls_score","with","shape","(","N",",","C","+","1",")","."]
code: def get_activation(self, cls_score: Tensor) -> Tensor:
      """Get custom activation of cls_score.
  
      Args:
          cls_score (Tensor): The prediction with shape (N, C + 2).
  
      Returns:
          Tensor: The custom activation of cls_score with shape
               (N, C + 1).
      """
      cls_score_classes, cls_score_objectness = self._split_cls_score(
          cls_score
      )
      score_classes = F.softmax(cls_score_classes, dim=-1)
      score_objectness = F.softmax(cls_score_objectness, dim=-1)
      score_pos = score_objectness[..., [0]]
      score_neg = score_objectness[..., [1]]
      score_classes = score_classes * score_pos
      scores = torch.cat([score_classes, score_neg], dim=-1)
      return scores
  
file_path: mmdetection/mmdet/models/losses/seesaw_loss.py
imports: from typing import Dict, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from mmdet.registry import MODELS
  from .accuracy import accuracy
  from .cross_entropy_loss import cross_entropy
  from .utils import weight_reduce_loss
label_desc: Use image node_id 4 for calling the SeesawLoss obj's underlying member method code with example usage: obj.get_activation(cls_score) and returns: scores