open-mmlab/mmdetection · warning

Cache files can not be saved automatically! To speed uploadi

Error message

Cache files can not be saved automatically! To speed uploading the dataset, please manually generate the cache file by file tools/misc/get_crowdhuman_id_hw.py

What it means

Warning from CrowdHuman dataset load_data_list: the intermediate extra annotation cache (id->h/w for full-set computation) could not be dumped to self.extra_ann_file, usually because the path is read-only/unsupported, so it will be recomputed every run.

Source

Thrown at mmdet/datasets/crowdhuman.py:84

        Returns:
            List[dict]: A list of annotation.
        """  # noqa: E501
        anno_strs = get_text(
            self.ann_file, backend_args=self.backend_args).strip().split('\n')
        print_log('loading CrowdHuman annotation...', level=logging.INFO)
        data_list = []
        prog_bar = ProgressBar(len(anno_strs))
        for i, anno_str in enumerate(anno_strs):
            anno_dict = json.loads(anno_str)
            parsed_data_info = self.parse_data_info(anno_dict)
            data_list.append(parsed_data_info)
            prog_bar.update()
        if not self.extra_ann_exist and get_rank() == 0:
            #  TODO: support file client
            try:
                dump(self.extra_anns, self.extra_ann_file, file_format='json')
            except:  # noqa
                warnings.warn(
                    'Cache files can not be saved automatically! To speed up'
                    'loading the dataset, please manually generate the cache'
                    ' file by file tools/misc/get_crowdhuman_id_hw.py')

            print_log(
                f'\nsave extra_ann_file in {self.data_root}',
                level=logging.INFO)

        del self.extra_anns
        print_log('\nDone', level=logging.INFO)
        return data_list

    def parse_data_info(self, raw_data_info: dict) -> Union[dict, List[dict]]:
        """Parse raw annotation to target format.

        Args:
            raw_data_info (dict): Raw data information load from ``ann_file``

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Make data_root writable so the cache json can be saved
  2. Pre-generate the cache with tools/misc/get_crowdhuman_id_hw.py and place it at the expected extra_ann_file path
  3. If read-only is mandatory, accept the recompute cost

Example fix

# before: read-only /data
chmod: not possible
# after
python tools/misc/get_crowdhuman_id_hw.py /data/crowdhuman --out /data/crowdhuman/annotation_train.odGT.cache # then ensure it is used as extra_ann_file
Defensive patterns

Strategy: fallback

Validate before calling

import os
if not os.access(data_root, os.W_OK):
    print('CrowdHuman cache cannot be written; pre-generate with tools/misc/get_crowdhuman_id_hw.py')

Prevention

When it happens

Trigger: Loading CrowdHumanDataset where self.extra_ann_exist is False and dump(self.extra_anns, ...) fails (bare except) — e.g. data_root not writable, or non-local file system where the TODO notes file client isn't supported.

Common situations: Read-only dataset mounts (NFS/shared clusters), containers where /data is ro; dataset still works but loading is slower each time.

Related errors


AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27). Data as JSON: /api/errors/7815697bb9fe22a0. Report an issue: GitHub.