class_docstr: Base class of hard negative sampler.
  
  Hard negative sampler is used to suppress false positive rate in classification tasks.
  During training, it select negative samples with high prediction scores.
  
  The training workflow is described as the follows:
  1) forward network and get prediction scores (classification prob/logits) for all the samples;
  2) use hard negative sampler to choose negative samples with high prediction scores and some positive samples;
  3) compute classification loss for the selected samples;
  4) do back propagation.
  
  Args:
      pool_size: when we need ``num_neg`` hard negative samples, they will be randomly selected from
          ``num_neg * pool_size`` negative samples with the highest prediction scores.
          Larger ``pool_size`` gives more randomness, yet selects negative samples that are less 'hard',
          i.e., negative samples with lower prediction scores.
class_docstr_tok: ["Base","class","of","hard","negative","sampler",".","Hard","negative","sampler","is","used","to","suppress","false","positive","rate","in","classification","tasks",".","During","training",",","it","select","negative","samples","with","high","prediction","scores",".","The","training","workflow","is","described","as","the","follows",":","1",")","forward","network","and","get","prediction","scores","(","classification","prob\/logits",")","for","all","the","samples",";","2",")","use","hard","negative","sampler","to","choose","negative","samples","with","high","prediction","scores","and","some","positive","samples",";","3",")","compute","classification","loss","for","the","selected","samples",";","4",")","do","back","propagation",".","Args",":","pool_size",":","when","we","need","``","num_neg","``","hard","negative","samples",",","they","will","be","randomly","selected","from","``","num_neg","*","pool_size","``","negative","samples","with","the","highest","prediction","scores",".","Larger","``","pool_size","``","gives","more","randomness",",","yet","selects","negative","samples","that","are","less","'hard","'",",","i.e.",",","negative","samples","with","lower","prediction","scores","."]
code: def __init__(self, pool_size: float = 10) -> None:
      self.pool_size = pool_size
  
file_path: MONAI/monai/apps/detection/utils/hard_negative_sampler.py
imports: from __future__ import annotations
  import logging
  import torch
  from torch import Tensor
label_desc: Use image node_id 1 to create a new HardNegativeSamplerBase object  with example: obj = HardNegativeSamplerBase(pool_size)