Giter VIP home page Giter VIP logo

deephyperx's People

Stargazers

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

Watchers

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

deephyperx's Issues

Why ignored label appeared in prediction map?

Sorry, I`m bothering you again.

I meeted a problem again:
1. I trained some model and the result is bad
2. In the final Confusion matrix ,there appeared a lot of elements in Undefined column.

Confusion matrix :
[[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[ 0 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[ 0 0 568 0 0 0 0 0 0 0 0 1 2 0 0 0 0]
[ 66 0 1 265 0 0 0 0 0 0 0 0 0 0 0 0 0]
[ 5 0 0 0 90 0 0 0 0 0 0 0 0 0 0 0 0]
[ 27 0 0 0 0 166 0 0 0 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 292 0 0 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0]
[ 11 0 0 0 0 0 0 0 180 0 0 0 0 0 0 0 0]
[ 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0]
[ 31 0 0 0 0 0 0 0 0 0 358 0 0 0 0 0 0]
[ 36 0 0 0 0 0 0 0 0 0 0 946 0 0 0 0 0]
[ 14 0 0 0 0 0 0 0 0 0 0 0 223 0 0 0 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 82 0 0 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 506 0 0]
[ 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 105 0]
[ 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 35]]---

I feel this is not reasonable.I think that it makes the model to influence the final bad result

Is there any way to solve this problem?

@nshaud

Add support for unsupervised models

Maybe out of scope for this toolbox.

The toolbox currently work with the assumption that the models are supervised. Working with unsupervised models (e.g. autoencoders) could be helpful.

  • Support other criterions in models.py (easy)
  • Support other metrics in metrics() (medium)
  • Either support no target or target = data (e.g. autoencoder) (hard)

Defining Train Set and Test Set

Hi,

Anyone know how to define the training and test set?

I have the GT defined in a mat file and I put the path in but it comes back with the following error:

python main.py --model nn --dataset Selene1TestX --train_set C:\Users\bbop1\hsi-toolbox-master\DeepHyperX\Datasets\Selene1TrainX\Sub1TargetMapPyTrainX.mat --cuda 0

Setting up a new session...
Image has dimensions 1250x1596 and 134 channels
Traceback (most recent call last):
File "main.py", line 275, in
test_gt[(train_gt > 0)[:w,:h]] = 0
TypeError: '>' not supported between instances of 'dict' and 'int'

I have a feeling the train gt needs to be defined as a dictionary. Has anyone done this?

Cheers,

Bop

/bin/sh: 0: Can't open start.sh

Hello,

I tried running the container on both Docker and Singularity; however, I am getting this error "/bin/sh: 0: Can't open start.sh". Is there a way to fix this?

This is the command I ran on Docker docker run -p 9999:8097 -ti --rm -v pwd:/workspace/DeepHyperX/ registry.gitlab.inria.fr/naudeber/deephyperx:rc2 and on Singularity singularity run ./deephyperxtest_latest.sif.

Thank you!

Refactor

  • Rewrite disjoint sampling method
  • Move sklearn models into their own file
  • Rewrite the Dataset
  • Add parallelization option (see #32)
  • Use a unique IGNORED_INDEX value for all ignored pixels
  • Use sklearn.metrics everywhere needed (especially in validation)
  • Move data exploration/data visualization functions into their own file
  • Rewrite the build_dataset function
  • Main script uses a main function
  • Unify val and test function
  • Deal with the varying tensor sizes when using : spectra (1D), images (2D), cubes (3D).
  • Unify segmentation and classification datasets
  • Use Sequential API for simple models
  • Add --overlap options for training and test
  • Use scheduler/auto LR reduction (see #22)
  • Save output image after training
  • Rewrite data augmentation as torchvision.transforms (see #33)
  • Move downloaders into their own script
  • Add other class balancing schemes (see #39)
  • Add IoU/dice score loss
  • Improve cross-validation support
  • Optional: Simplify dataset configuration
  • Optional: Support defining a dataset as a collection of HSI images and GT masks

problem for weights with ignore_label

Describe the bug
when i run this demo,the result of confusion matrix is not correct, cm[0,0] always equals to zero. so i check the parameters of weight, 'weights': tensor([0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,])
the weights[0] is always 0.
the function of get_model instantiate the weights.
weights = torch.ones(n_classes)
weights[torch.LongTensor(kwargs["ignored_labels"])] = 0.0
i think it maybe casued by the ignored_labels=[0]
so, i replace ignored_labels=[] instead of ignored_labels=[0]
but it don't work
when i delete or comment out weights[torch.LongTensor(kwargs["ignored_labels"])] = 0.0
the initial values weight, 'weights': tensor([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,])

when , i replace ignored_labels=[2] instead of ignored_labels=[0]
the values weight, 'weights': tensor([0., 1., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,])
anywhere,weights[0] always equals to zero.
To Reproduce
Steps to reproduce the behavior (e.g. the command that you used).

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: window
  • CUDA : yes

Visdom server does not work

visdom_error

The visdom server does not show any of the visualizations during or after training, as shown attached. Any fixes for this?

Class balancing/resampling

Current approach to class balancing is to use inverse median frequency loss reweighting.

Other options could be:

Resampling

Resample the dataset (e.g. upsample minority classes or downsamples majority classes)

  • Static resampling before constructing the train Dataset
  • Dynamic resampling in the DataLoader

Loss balancing

  • IMF, this is what we do.
  • IF, ignore the median cost.
  • others?

Defined hyperspectral-specific Transforms

torchvision defines Transforms objects to apply data augmentation and other transformations to data.

We could and should define our own custom Transforms.

Pros:

  • easier to reuse the data augmentation transforms that we implement
  • easier to apply various kinds of DA in the toolbox

Cons:

  • adds an external dependency to torchvision

Why the lose value is Nan at the beginning of training sometimes?

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior (e.g. the command that you used).

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: [e.g. Linux/Windows]
  • CUDA : yes/no

Batch training

I'm trying to train a model with multiple images at once.
It seems I need to change the DATASETS_CONFIG.
If anyone has any insight into what the method is, your thoughts would be much appreciated.

OSError: [Errno 22] Invalid argument

Traceback (most recent call last): File "main.py", line 312, in <module> display=viz) File "C:\Users\yang6\PycharmProjects\DeepHyperX\models.py", line 1059, in train save_model(net, camel_to_snake(str(net.__class__.__name__)), data_loader.dataset.name, epoch=e, metric=abs(metric)) File "C:\Users\yang6\PycharmProjects\DeepHyperX\models.py", line 1068, in save_model torch.save(model.state_dict(), model_dir + filename + '.pth') File "C:\Users\yang6\Anaconda3\envs\DeepHyperX\lib\site-packages\torch\serialization.py", line 260, in save return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol)) File "C:\Users\yang6\Anaconda3\envs\DeepHyperX\lib\site-packages\torch\serialization.py", line 183, in _with_file_like f = open(f, mode) **OSError: [Errno 22] Invalid argument: './checkpoints/hamida_et_al/PaviaU/2020-07-03 10:52:46.094626_epoch2_0.78.pth'**

I am very confused about this error. How to solve it?

Tensorboard

Migrate visualization from Visdom to Tensorboard

Docker repository doesn't exist

Hi, thank you very much for such a great tool.
I was trying like to grab a Docker image but seems that it doesn't exist. Would you please upload it once again so I could copy the image?

(base) alexanch@alexanch:~/docker$ docker pull registry.gitlab.inria.fr/naudeber/deephyperx:preview
Error response from daemon: manifest for registry.gitlab.inria.fr/naudeber/deephyperx:preview not found

Prediction vs test_gt

Describe the bug
I am encountering an issue with the prediction versus test_gt (labels border are eliminated) for the 'Sharma' and 'Chen' models in my project. The predictions seem to be inconsistent or incorrect compared to the ground truth labels.

Expected behavior
I expect the model to generate a full prediction image that includes the border labels, accurately capturing the entire image.

Desktop :

  • OS: Windows
    screenshot

How to create DFC2018_HSI dataset

Downloaded DFC2018_HSI dataset, not found

Hainan -2018_ IEEE_ GRSS_ DFC_ GT_ TR.tif
Hainan -2018_ IEEE_ GRSS_ DFC_ HSI_ TR
Hainan -2018_ IEEE_ GRSS_ DFC_ HSI_ TR.aux.xml
Hainan -2018_ IEEE_ GRSS_ DFC_ HSI_ TR.HDR

I would like to know how you configured these files. Thank you very much

Inverse Median Frequency Weights functioning?

Hi!

I was using this framework (thank you), but I cannot understand if the inverse median frequency weights are called at all? For me it seems they are created after constructing the loss function and thus never passed anywhere. Is this assumption wrong on my part? Where do they come into play? I assumed the weights would have been passed to the get_model function through the hyperparameters, then used to construct the loss function and not be overwritten by the new initialization of the weight vector. Thank you!

Use block-wise spatial sampling for train/test splitting

The current spatially disjoint train/test split divides the image in 2 for each class. However there might be spatial correlations between the pixels for those regions and this approach is not well-suited to repeated runs or cross-validation anyway. A more robust way to perform a spatially disjoint split is to extract random blocks (i.e. windows larger than the model's patch size) with constraints on class percentages.

See e.g. BlockCV that does this kind of thing in R.

How to use the disjoint mode?

Hello,

Can anyone teach me how to use the disjoint mode correctly please?

I use the below command but the code cannot be run.
!python main.py --model SVM --dataset IndianPines --sampling_mode disjoint --cuda 0

I also tried to find if there were training and testing split samples on the GRSS DASE Website to download. However, there are only testing samples to download.

Here is the environment I used:

  • OS: Google Colab
  • CUDA : yes

Attribute of input is error when summary is running

Attribute of input is error when summary in main.py is running.
When I go to 'python main.py --model conv3d --dataset IndianPines --training_sample 0.05 --cuda 0' , I see error 'AttributeError: 'builtin_function_or_method' object has no attribute 'size' '.Error code:'summary(model.to(hyperparams["device"]), input.size()[1:])'
Conv3d model is added by myself.

About the model "Sharma(2DCNN)"

Hi, I'm very thanks for your great work. Here, I have a question about the model "sharma" to ask for your help.

I can't understand the input "x" of the network,
why "'" x = torch.zeros( (1, 1, self.input_channels, self.patch_size, self.patch_size))"'"?
what is """b, t, c, w, h = x.size()"""?

I am looking for your apply, thanks!

How to set `ignored_labels`

Hello, Recently,I miss a question .I want to omit some label_values in My Training set .
Please tell me how to set ignored_labels

Salinas loading

I have suffered from loading failure before I examine the name of the data.
Now code runs after
#img = open_file(folder + 'Salinas.mat')['Salinas_corrected']
img = open_file(folder + 'Salinas_corrected.mat')['salinas_corrected']
#gt = open_file(folder + 'Salinas_gt.mat')['Salinas_gt']
gt = open_file(folder + 'Salinas_gt.mat')['salinas_gt']

Have issue with the 'disjoint' eksperiment

Hi, I have tried to run your code with "hu" model and sampling_mode "disjoint". However, I got a worse result than the result in Table 3 of your paper. Is there any specific setting for the result of Table 3? Thank you very much.

How to get stable results?

Thanks for your great work!
I run the code and set "--run 10", but the results of each run fluctuate wildly.
I adjusted lr, batchsize ..., but it didn't work.
Could you give me some advice? thank you!

can't reproduce the results

HI ~
Thanks for your great work, Recently I am trying to reproduce the experiment on paper. But I found there are no accurate experiment settings in the part of the experiment. I am wondering if you can give me some suggestions on the initialization of the parameters. Such as the learning_rate、training_sample etc.

Here is the result by using the command python main.py --model hamida --dataset IndianPines --training_sample 0.1 --cuda 0.
I found its accuracy has a margin comparing the result on paper.

image

Looking forward to your early reply ~ Thanks for your consideration.

“loss ” is very large

Hi, When I run 'python main.py --model hu --dataset IndianPines --training_sample 0.1 --cuda 0', the loss is over 2.
And it's useless to change the training_sample, because it's still over 1.
How can I solve it?
Would you please give me the best train parameters?
Thank you very much.

Parallelize data loading

Currently, the torch DataLoader uses blocking data loading. Although loading is very fast (we store the NumPy arrays in-memory), transfer to GPU and data augmentation (which is done on CPU) can slow things done.

Using workers > 0 would make data loading asynchronous and workers > 1 could increase speed somewhat.

TODO:

  • Benchmark speed gain using asynchronous data loading
  • Implement asynchronous data loading for all DataLoader objects
  • Add a user-input option to define the number of jobs

Can't obtain Table III results with Li's 3D CNN network

Hi,
I am testing Li's 3D CNN network on IndianPines dataset. In table III in disjoint mode, you have an accuracy of 75%. I can't reach more than 65%.

  • Are the default parameters of the network (lr = 0.01, epoch = 200, patch_size = 5, momentum=0.9, weight_decay = 5e-4, n_planes = 16) the ones you have used ? In particular, in the original paper, n_planes = 2
  • Did you just apply flip_augmentation or also mixture_augmentation or radiation_augmentation ? Even with those it doesn't work.
  • The other parameters I used : training_sample = 0.9, default batch_size, class_balancing=True

Thank you :)

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.