Closed Jolan-Dubrulle closed 3 years ago
You may need to check subsequent pipelines, such as Resize,Normalize, etc..
hi have you solved this problem,i currently wanted to read .tif images(RGB,three channels) in mmdetection
So hard, I meet this problem too, have you solved this problem?
I am trying to train the Retinanet model on hyperspectral data (with 30 channels) in tif format. To do this, I first set the number of backbone input channels to 30 in the config file by the following line:
model = dict(pretrained=None, bbox_head=dict(num_classes=1), backbone=dict(depth=18, in_channels=30, norm_eval=False))
However, the 'LoadImageFromFile' class (mmdetection/mmdet/datasets/pipelines/loading.py) does not work on my hyperspectral tif images. The reason is that OpenCV cannot read my 30 channel tif files.
This is the error message I get:
So I decided to create a new class in the mmdetection/mmdet/datasets/pipelines/loading.py file called 'LoadHypImageFromFile' in order to be able to read my hyperspectral tif images. This class is identical to the 'LoadImageFromFile' class except that img = mmcv.imread(filename, backend='tifffile') has been used instead of:
img_bytes = self.file_client.get(filename) img = mmcv.imfrombytes(img_bytes, flag=self.color_type)
Unfortunately, it doesn't work and I get this error message:
Thanks for your help !