text: from mmcv import Config
  from mmcv import mkdir_or_exist
  from mmdet.datasets import build_dataset
  from mmdet.models import build_detector
  from mmdet.apis import train_detector, set_random_seed
  
  
  def train(cfg):
      """
      Train faster-rcnn with backbone of resnet-50 and neck of fpn.
  
      Args:
          cfg: Config files
  
      Returns:
          None
  
      """
  
      # Set seed thus the results are more reproducible
      cfg.seed = 0
      set_random_seed(0, deterministic=False)
      cfg.gpu_ids = range(1)
  
      # Build the data set
      datasets = [build_dataset(cfg.data.train)]
      # Build the detector
      model = build_detector(
          cfg.model, train_cfg=cfg.get('train_cfg'), test_cfg=cfg.get('test_cfg')
      )
      print(f'configs \n{cfg.pretty_text}')
  
      # Add and attribute for visualization convenience
      model.CLASSES = datasets[0].CLASSES
  
      # Create work dir
      mkdir_or_exist(cfg.work_dir)
  
      # Train the detector
      train_detector(model, datasets, cfg, distributed=False, validate=True)
  
  
  if __name__ == '__main__':
      config = Config.fromfile('../configs/faster_rcnn/faster_rcnn_r50_fpn_2x_rockets.py')
      train(config)
  