open-mmlab/mmdetection · error · RuntimeError
The `file_client_args` is deprecated, please use `backend_ar
Error message
The `file_client_args` is deprecated, please use `backend_args` instead, please refer tohttps://github.com/open-mmlab/mmdetection/blob/main/configs/_base_/datasets/coco_detection.py
What it means
CrowdHumanMetric.__init__ raises RuntimeError if the legacy `file_client_args` parameter is passed — the same 3.x deprecation enforcement as CocoMetric. File I/O must be configured via `backend_args`. The message points at the canonical config showing the new backend_args style.
Source
Thrown at mmdet/evaluation/metrics/crowdhuman_metric.py:100
self.ann_file = ann_file
# crowdhuman evaluation metrics
self.metrics = metric if isinstance(metric, list) else [metric]
allowed_metrics = ['MR', 'AP', 'JI']
for metric in self.metrics:
if metric not in allowed_metrics:
raise KeyError(f"metric should be one of 'MR', 'AP', 'JI',"
f'but got {metric}.')
self.format_only = format_only
if self.format_only:
assert outfile_prefix is not None, 'outfile_prefix must be not'
'None when format_only is True, otherwise the result files will'
'be saved to a temp directory which will be cleaned up at the end.'
self.outfile_prefix = outfile_prefix
self.backend_args = backend_args
if file_client_args is not None:
raise RuntimeError(
'The `file_client_args` is deprecated, '
'please use `backend_args` instead, please refer to'
'https://github.com/open-mmlab/mmdetection/blob/main/configs/_base_/datasets/coco_detection.py' # noqa: E501
)
assert eval_mode in [0, 1, 2], \
"Unknown eval mode. mr_ref should be one of '0', '1', '2'."
assert compare_matching_method is None or \
compare_matching_method == 'VOC', \
'The alternative compare_matching_method is VOC.' \
'This parameter defaults to CALTECH(None)'
assert mr_ref == 'CALTECH_-2' or mr_ref == 'CALTECH_-4', \
"mr_ref should be one of 'CALTECH_-2', 'CALTECH_-4'."
self.eval_mode = eval_mode
self.iou_thres = iou_thres
self.compare_matching_method = compare_matching_method
self.mr_ref = mr_ref
self.num_ji_process = num_ji_processView on GitHub (pinned to cfd5d3a985)
Solutions
- Replace file_client_args with backend_args=dict(backend='local') (or 'petrel' with path_mapping for remote)
- Strip file_client_args keys from all configs in the repo (grep for it)
- Use the config referenced in the message as the migration template
Example fix
# before val_evaluator = dict(type='CrowdHumanMetric', metric='AP', file_client_args=dict(backend='disk')) # after val_evaluator = dict(type='CrowdHumanMetric', metric='AP', backend_args=dict(backend='local'))
Defensive patterns
Strategy: validation
Validate before calling
ev = cfg.get('val_evaluator', cfg.get('test_evaluator', {}))
assert 'file_client_args' not in ev, 'CrowdHumanMetric: use backend_args, not file_client_args' Type guard
def config_is_mmdet3_compatible(eval_cfg: dict) -> bool:
return 'file_client_args' not in eval_cfg Prevention
- Migrate all project configs in one sweep (grep file_client_args)
- Wrap evaluator construction in a helper that injects backend_args
- Track mmdetection release notes for API migrations
When it happens
Trigger: CrowdHumanMetric(..., file_client_args={'backend':'disk'}) or a CrowdHuman val/test config that still carries file_client_args after upgrading mmdetection to 3.x.
Common situations: Porting old CrowdHuman project configs (projects/CrowdHuman) to 3.x; keeping legacy kwargs in a custom subclass or a wrapper script.
Related errors
- The `file_client_args` is deprecated, please use `backend_ar
- The `file_client_args` is deprecated, please use `backend_ar
- The `file_client_args` is deprecated, please use `backend_ar
- config is now expected to have a `runner` section, please se
- "imgs_per_gpu" is deprecated in MMDet V2.0. Please use "samp
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/43290ac5aae1f714.
Report an issue: GitHub.