code: def test_predict_by_feat(self):
      s = 256
      img_metas = [
          {
              "img_shape": (s, s, 3),
              "scale_factor": (1.0, 1.0),
          }
      ]
      test_cfg = Config(
          dict(score_thr=0.01, nms=dict(type="nms", iou_threshold=0.65))
      )
      head = YOLOXHead(
          num_classes=4,
          in_channels=1,
          stacked_convs=1,
          use_depthwise=False,
          test_cfg=test_cfg,
      )
      feat = [
          torch.rand(1, 1, s // feat_size, s // feat_size)
          for feat_size in [4, 8, 16]
      ]
      cls_scores, bbox_preds, objectnesses = head.forward(feat)
      head.predict_by_feat(
          cls_scores,
          bbox_preds,
          objectnesses,
          img_metas,
          cfg=test_cfg,
          rescale=True,
          with_nms=True,
      )
      head.predict_by_feat(
          cls_scores,
          bbox_preds,
          objectnesses,
          img_metas,
          cfg=test_cfg,
          rescale=False,
          with_nms=False,
      )
  
file_path: mmdetection/tests/test_models/test_dense_heads/test_yolox_head.py
imports: from unittest import TestCase
  import torch
  from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
  from mmengine.config import Config
  from mmengine.model import bias_init_with_prob
  from mmengine.structures import InstanceData
  from mmengine.testing import assert_allclose
  from mmdet.models.dense_heads import YOLOXHead
label_desc: Use image node_id 2 for calling the TestYOLOXHead obj's underlying member method code with example usage: obj.test_predict_by_feat() without return types