Giter Club home page Giter Club logo

hsir's Introduction

HSIR

PyPI Documentation Status

Out-of-box Hyperspectral Image Restoration Toolbox

Denoising for remotely sensed images from QRNN3D

Install

pip install hsir

Usage

Here are some runable examples, please refer to the code for more options.

python hsirun.train -a hsir.model.qrnn3d.qrnn3d
python hsirun.test -a hsir.model.qrnn3d.qrnn3d -r qrnn3d.pth -t icvl_512_50

Benchmark

Pretrained Models | Training Log | Datasets
Baidu Drive's Share Code=HSIR

Supported Models
Gaussian Denoising on ICVL
Sigma=30 Sigma=50 Sigma=70 Sigma=Blind
Params(M) Runtime(s) FLOPs PSNR SSIM SAM PSNR SSIM SAM PSNR SSIM SAM PSNR SSIM SAM
Noisy 18.59 0.110 .0807 14.15 0.046 0.991 11.23 0.025 1.105 17.34 0.114 0.859
BM4D 154 38.45 0.934 0.126 35.60 0.889 0.169 33.70 0.845 0.207 37.66 0.914 0.143
TDL 18 40.58 0.957 0.062 38.01 0.932 0.085 36.36 0.909 0.105 39.91 0.946 0.072
ITSReg 907 41.48 0.961 0.088 38.88 0.941 0.098 36.71 0.923 0.112 40.62 0.953 0.087
LLRT 627 41.99 0.967 0.056 38.99 0.945 0.075 37.36 0.930 0.087 40.97 0.956 0.064
KBR 1755 41.48 0.984 0.088 39.16 0.974 0.100 36.71 0.961 0.113 40.68 0.979 0.080
WLRTR 1600 42.62 0.988 0.056 39.72 0.978 0.073 37.52 0.967 0.095 41.66 0.983 0.064
NGmeet 166 42.99 0.989 0.050 40.26 0.980 0.059 38.66 0.974 0.067 42.23 0.985 0.053
HSID 0.40 3 38.70 0.949 0.103 36.17 0.919 0.134 34.31 0.886 0.161 37.80 0.935 0.116
QRNN3D 0.86 0.73 42.22 0.988 0.062 40.15 0.982 0.074 38.30 0.974 0.094 41.37 0.985 0.068
TS3C 0.83 0.95 42.36 0.986 0.079 40.47 0.980 0.087 39.05 0.974 0.096 41.52 0.983 0.085
GRUNet 14.2 0.87 42.84 0.989 0.052 40.75 0.983 0.062 39.02 0.977 0.080 42.03 0.987 0.057
Complex Denoising on ICVL
non-iid g+stripe g+deadline g+impulse mixture
Params(M) Runtime(s) FLOPs PSNR SSIM SAM PSNR SSIM SAM PSNR SSIM SAM PSNR SSIM SAM PSNR SSIM SAM
Noisy 18.25 0.168 0.898 17.80 0.159 0.910 17.61 0.155 0.917 14.80 0.114 0.926 14.08 0.099 0.944
LRMR 32.80 0.719 0.185 32.62 0.717 0.187 31.83 0.709 0.227 29.70 0.623 0.311 28.68 0.608 0.353
LRTV 33.62 0.905 0.077 33.49 0.905 0.078 32.37 0.895 0.115 31.56 0.871 0.242 30.47 0.858 0.287
NMoG 34.51 0.812 0.187 33.87 0.799 0.265 32.87 0.797 0.276 28.60 0.652 0.486 27.31 0.632 0.513
TDTV 38.14 0.944 0.075 37.67 0.940 0.081 36.15 0.930 0.099 36.67 0.935 0.094 34.77 0.919 0.113
HSID 0.40 3 38.40 0.947 0.095 37.77 0.942 0.104 37.65 0.940 0.102 35.00 0.899 0.174 34.05 0.888 0.181
TS3C 0.83 0.95 41.12 0.986 0.069 40.66 0.985 0.077 39.38 0.982 0.100 35.92 0.951 0.205 34.36 0.945 0.230
QRNN3D 0.86 0.73 42.79 0.978 0.052 42.35 0.976 0.055 42.23 0.976 0.056 39.23 0.945 0.109 38.25 0.938 0.107
GRUNet 14.2 0.87 42.89 0.992 0.047 42.39 0.991 0.050 42.11 0.991 0.050 40.70 0.985 0.067 38.51 0.981 0.081

Citation

If you find this repo helpful, please considering citing us.

@misc{hsir,
	author={Zeqiang Lai, Miaoyu Li, Ying Fu},
	title={HSIR: Out-of-box Hyperspectral Image Restoration Toolbox},
	year={2022},
	url={https://github.com/bit-isp/HSIR},
}

Visitors

hsir's People

Contributors

zeqiang-lai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hsir's Issues

_pickle.UnpicklingError: invalid load key, '\x08' when load ICVL dataset you provided in BaiduDisk

The dataset you provided is arranged as follow
Snipaste_2023-07-03_17-08-13
Snipaste_2023-07-03_17-07-55

but when run your script to retrain will raise this kind of error.

File "/htrainer. Trainng/Desktop/Project/HSIR/hsirun/train.py", line 78, in main if trainer.epoch < 30: trainer.train(train_loader1) File "/home/tanxiaodong/Desktop/Project/HSIR/hsir/trainer.py", line 175, in train for batch_idx, data in enumerate(train_loader): File "/home/tanxiaodong/miniconda3/envs/hsir/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 633, in __next__ data = self._next_data() File "/home/tanxiaodong/miniconda3/envs/hsir/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1345, in _next_data return self._process_data(data) File "/home/tanxiaodong/miniconda3/envs/hsir/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1371, in _process_data data.reraise() File "/home/tanxiaodong/miniconda3/envs/hsir/lib/python3.10/site-packages/torch/_utils.py", line 644, in reraise raise exception _pickle.UnpicklingError: Caught UnpicklingError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/tanxiaodong/miniconda3/envs/hsir/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop data = fetcher.fetch(index) File "/home/tanxiaodong/miniconda3/envs/hsir/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/tanxiaodong/miniconda3/envs/hsir/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 51, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/tanxiaodong/Desktop/Project/HSIR/hsir/data/dataset.py", line 74, in __getitem__ img = self.dataset[index] File "/home/tanxiaodong/Desktop/Project/HSIR/hsir/data/dataset.py", line 162, in __getitem__ x = pickle.loads(raw_datum) _pickle.UnpicklingError: invalid load key, '\x08'.

Could you kindly provide a list of the environment configurations?

Such as an environment.yaml file for Conda, if possible.
It seems that there are some issues with my environment, preventing me from starting the training properly.

my environment(2080ti x 8):

python                    3.8.16
cudatoolkit               11.8.0
cudnn                     8.4.1.50
pytorch                   1.12.1
pytorch-gpu               1.12.1
torchlight                0.0.1
torchlights               0.4.0
torchvision               0.14.1

I can train normally on my other codes and testing process runs fine, but there seem to be some bugs on training:

RuntimeError: Caught RuntimeError in replica 1 on device 1.
Original Traceback (most recent call last):
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker
    output = module(*input, **kwargs)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/arch.py", line 111, in forward
    out = self.encoder(out, xs)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/arch.py", line 56, in forward
    x = self.layers[i](x)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/container.py", line 139, in forward
    input = module(input)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/attention.py", line 244, in forward
    r, _ = self.attn(inputs)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/attention.py", line 85, in forward
    q = torch.matmul(attn, v)
RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cublasSgemmStridedBatched( handle, opa, opb, m, n, k, &alpha, a, lda, stridea, b, ldb, strideb, &beta, c, ldc, stridec, num_batches)`

or

packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/attention.py", line 246, in forward
    r = self.ffn(r)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/attention.py", line 183, in forward
    x2 = x * torch.sigmoid(w)
RuntimeError: CUDA error: misaligned address
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.

or

RuntimeError: Caught RuntimeError in replica 1 on device 1.
Original Traceback (most recent call last):
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker
    output = module(*input, **kwargs)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/arch.py", line 111, in forward
    out = self.encoder(out, xs)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/arch.py", line 56, in forward
    x = self.layers[i](x)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/container.py", line 139, in forward
    input = module(input)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/attention.py", line 246, in forward
    r = self.ffn(r)
  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/leo/Code/Denoiser/HSIR/hsir/model/hsdt/attention.py", line 178, in forward
    x = F.gelu(x)
RuntimeError: CUDA error: misaligned address
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.

or

  File "/home/leo/.conda/envs/leo_Denoiser/lib/python3.8/site-packages/torch/nn/functional.py", line 2438, in batch_norm
    return torch.batch_norm(
RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED

This should be unrelated to memory and batch size since I still encounter the issue even with the smallest model.

Could you kindly update your environment configuration? It also might be related to the versions of torch and cudnn.

Or may stem from the use of this:sync_batchnorm

Roadmap

HSI Board

  • robustness for results structures

    • it should work without log.json
    • ignore non results subdirectories
  • adjust box size

TypeError: 'NoneType' object is not callable

(cyq) ubuntu18@ubuntu18:~/cyq/Model-Guided-Deep-Hyperspectral-Image-Super-resolution-main/HSIR-main$ python hsirun/test.py -a qrnn3d.qrnn3d -r qrnn3d.pth -t icvl_512_50
It seems that you have evaluated qrnn3d.qrnn3d before.

Are you sure you want to continue? (y) continue (n) exit
y
Traceback (most recent call last):
File "hsirun/test.py", line 162, in
main(args, logdir)
File "hsirun/test.py", line 112, in main
net = tl.utils.instantiate(args.arch)
File "/home/ubuntu18/.conda/envs/cyq/lib/python3.8/site-packages/torchlight/utils/helper.py", line 53, in instantiate
return obj(*args, **kwargs)
TypeError: 'NoneType' object is not callable
(cyq) ubuntu18@ubuntu18:~/cyq/Model-Guided-Deep-Hyperspectral-Image-Super-resolution-main/HSIR-main$

Hello, I encountered this issue while using this tool. I hope you can give me some advice。
您好,我在使用这个工具的时候遇到了这个问题,我希望您能给我一下建议。
my wechat:15273115280

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.