proteus1991 / GridDehazeNet

This repo contains the official training and testing codes for our paper: GridDehazeNet: Attention-Based Multi-Scale Network for Image Dehazing.
https://jhc.sjtu.edu.cn/~xiaohongliu/
246 stars 53 forks source link

Exception: Bad image channel: 8328 #22

Closed Guizhandao closed 2 years ago

Guizhandao commented 3 years ago

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

proteus1991 commented 3 years ago

Hi, please provide more information about this issue.

Thanks,

Xiaohong

Guizhandao commented 3 years ago

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))
Guizhandao commented 3 years ago

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))

randomNNN commented 3 years ago

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.

proteus1991 commented 2 years ago

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.