Skip to content

Conversation

@lucia-leonie
Copy link

By specifying num_channels = 1 in the experiment file (instead of the default 3), these changes support training with grayscale images:

  • num_channels parameter in COCO and VOC dataset classes with adapted load_img function, which reads grayscale images if num_channels == 1
  • Focus in stem of backbone allows for in_channels to be 1 instead of being hard-coded to 3
  • model_info in model_utils adapts img to fit the in_channels of the stem of the backbone
  • data augmentation / mosaic detection files allow for channel dimension to be absent

Apart from these specific changes to support the main goal of this PR (to allow grayscale images directly), there are two minor modifications:

  • in coco dataset do not remove the info field in the remove_useless_info function. In the pycocotools version 2.0.9 (and subsequent ones) in the loadRes function this line was added
    res.dataset['info'] = copy.deepcopy(self.dataset['info'])
    which leads to a KeyError in the evaluation, if the info field is missing
  • specify the name parameter in the get_dataset and get_eval_dataset in the Experiment class in yolox_base.py to allow classes, which inherit this experiment class, to easily specify a custom image folder (e.g. by overwriting self.test_name in the init function)

… grayscale, add image folder and num channels parameter to get_dataset calls
…ersions; also allow num_channels to be set in voc dataset
@CLAassistant
Copy link

CLAassistant commented Sep 9, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants