code: def test_init(self, cfg_file):
      model = get_detector_cfg(cfg_file)
      # backbone convert to ResNet18
      model.backbone.depth = 18
      model.neck.in_channels = [64, 128, 256, 512]
      model.backbone.init_cfg = None
  
      from mmdet.registry import MODELS
  
      detector = MODELS.build(model)
      self.assertTrue(detector.backbone)
      self.assertTrue(detector.neck)
      self.assertTrue(detector.bbox_head)
  
      # if rpn.num_classes > 1, force set rpn.num_classes = 1
      model.rpn_head.num_classes = 2
      detector = MODELS.build(model)
      self.assertEqual(detector.bbox_head.num_classes, 1)
  
file_path: mmdetection/tests/test_models/test_detectors/test_rpn.py
imports: import unittest
  from unittest import TestCase
  import torch
  from parameterized import parameterized
  from mmdet.structures import DetDataSample
  from mmdet.testing import demo_mm_inputs, get_detector_cfg
  from mmdet.utils import register_all_modules
label_desc: Use image node_id 2 for calling the TestRPN obj's underlying member method code with example usage: obj.test_init(cfg_file) without return types