code: def load_class_freq(
      path="datasets/metadata/lvis_v1_train_cat_info.json",
      freq_weight=0.5,
  ):
      cat_info = json.load(open(path, "r"))
      cat_info = torch.tensor(
          [
              c["image_count"]
              for c in sorted(cat_info, key=lambda x: x["id"])
          ]
      )
      freq_weight = cat_info.float() ** freq_weight
      return freq_weight
  
imports: import json
  from typing import List, Optional
  import torch
  from mmengine.config import ConfigDict
  from mmengine.structures import InstanceData
  from torch import Tensor
  from torch.nn import functional
  from mmdet.models.layers import multiclass_nms
  from mmdet.models.losses import accuracy
  from mmdet.models.roi_heads.bbox_heads import Shared2FCBBoxHead
  from mmdet.models.utils import empty_instances
  from mmdet.registry import MODELS
  from mmdet.structures.bbox import get_box_tensor, scale_boxes
  from mmdet.utils import ConfigType, InstanceList
label_desc: Use image node_id 1 for calling a global function with example usage: load_class_freq(path, freq_weight) and returns: freq_weight