open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
28.61k stars 9.31k forks source link

Training dataset of single-channel infrared images #10295

Open wwjwy opened 1 year ago

wwjwy commented 1 year ago

The original images of the dataset I used are single-channel infrared images and have been annotated manually. Now, I am ready to use the retinanet_swin-t-p4-w7_fpn_1x_coco.py for training. However, the retinanet_swin model is designed for the detection of RGB images in mmdet. I only found that there is an in_channel parameter in the backbone (https://github.com/open-mmlab/mmdetection/blob/ecac3a77becc63f23d9f6980b2a36f86acd00a8a/mmdet/models/backbones/swin.py#L527) that needs to be modified from 3 to 1. Is there anything else that needs to be modified to realize single-channel infrared image detection? Thank you for your help!

tojimahammatov commented 1 year ago

hi, for backbone and the rest of model yes it is the only param I believe. Because the rest is only about channels of features where channels, width and height do not play role as long as you provide correct input/outputs. But, there is one thing you should pay attention: data. I guess you are using custom dataset, and when you write a script to load and pre-process it you must normalize it correctly. Have a look at retinanet model, where you can see mean and std for RGB channels to normalize. If you adjusted them already, you are ready to go. And make sure your data is of shape [1, width, height] before passing to a model and not [width, height] although there is one channel.