proteus1991/GridDehazeNet

Exception: Bad image channel: 8328

Closed this issue · 5 comments

OTS train ————》Exception: Bad image channel: 8328

Hi, please provide more information about this issue.

Thanks,

Xiaohong

D:\APP\Anaconda3\envs\pytorch\python.exe D:/GHF/GridDehazeNet-master/train.py
--- Hyper-parameters for training ---
learning_rate: 0.001
crop_size: [240, 240]
train_batch_size: 2
val_batch_size: 1
network_height: 3
network_width: 6
num_dense_layer: 4
growth_rate: 16
lambda_loss: 0.04
category: outdoor
--- weight loaded ---
Total_params: 958051
D:\GHF\GridDehazeNet-master\utils.py:34: UserWarning: DEPRECATED: skimage.measure.compare_ssim has been moved to skimage.metrics.structural_similarity. It will be removed from skimage.measure in version 0.18.
ssim_list = [measure.compare_ssim(dehaze_list_np[ind], gt_list_np[ind], data_range=1, multichannel=True) for ind in range(len(dehaze_list))]
old_val_psnr: 30.76, old_val_ssim: 0.9814
Learning rate sets to 0.001.
Traceback (most recent call last):
File "D:/GHF/GridDehazeNet-master/train.py", line 124, in
for batch_id, train_data in enumerate(train_data_loader):
File "D:\APP\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "D:\APP\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\APP\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\APP\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\GHF\GridDehazeNet-master\train_data.py", line 64, in getitem
res = self.get_images(index)
File "D:\GHF\GridDehazeNet-master\train_data.py", line 59, in get_images
raise Exception('Bad image channel: {}'.format(gt_name))
Exception: Bad image channel: 7946

当我使用OTS数据集的时候 代码中自带的抛出异常代码会抛出这个问题,不知道如何解决?

--- Check the channel is 3 or not ---

    if list(haze.shape)[0] is not 3 or list(gt.shape)[0] is not 3:
        raise Exception('Bad image channel: {}'.format(gt_name))

Hi, please provide more information about this issue.

Thanks,

Xiaohong

D:\APP\Anaconda3\envs\pytorch\python.exe D:/GHF/GridDehazeNet-master/train.py
--- Hyper-parameters for training ---
learning_rate: 0.001
crop_size: [240, 240]
train_batch_size: 2
val_batch_size: 1
network_height: 3
network_width: 6
num_dense_layer: 4
growth_rate: 16
lambda_loss: 0.04
category: outdoor
--- weight loaded ---
Total_params: 958051
D:\GHF\GridDehazeNet-master\utils.py:34: UserWarning: DEPRECATED: skimage.measure.compare_ssim has been moved to skimage.metrics.structural_similarity. It will be removed from skimage.measure in version 0.18.
ssim_list = [measure.compare_ssim(dehaze_list_np[ind], gt_list_np[ind], data_range=1, multichannel=True) for ind in range(len(dehaze_list))]
old_val_psnr: 30.76, old_val_ssim: 0.9814
Learning rate sets to 0.001.
Traceback (most recent call last):
File "D:/GHF/GridDehazeNet-master/train.py", line 124, in
for batch_id, train_data in enumerate(train_data_loader):
File "D:\APP\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "D:\APP\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\APP\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\APP\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\GHF\GridDehazeNet-master\train_data.py", line 64, in getitem
res = self.get_images(index)
File "D:\GHF\GridDehazeNet-master\train_data.py", line 59, in get_images
raise Exception('Bad image channel: {}'.format(gt_name))
Exception: Bad image channel: 7946

当我使用OTS数据集的时候 代码中自带的抛出异常代码会抛出这个问题,不知道如何解决?

--- Check the channel is 3 or not ---
if list(haze.shape)[0] is not 3 or list(gt.shape)[0] is not 3:
raise Exception('Bad image channel: {}'.format(gt_name))

OTS train ————》Exception: Bad image channel: 8328

Because the RESIDE hazy dataset has some four channel images,they are RGB-D images, not RGB images.

OTS train ————》Exception: Bad image channel: 8328

Because the RESIDE hazy dataset has some four channel images,they are RGB-D images, not RGB images.

That's correct. @Guizhandao you can use Pillow to convert RGB-D to RGB.