NISL-MSU / HSI-BandSelection

Developing Low-Cost Multispectral Imagers using Inter-Band Redundancy Analysis and Greedy Spectral Selection in Hyperspectral Imaging.
50 stars 13 forks source link

Issue on Interband reduction #1

Closed sankaraug closed 2 years ago

sankaraug commented 2 years ago

Hey Thanks for the code and nice work.

The inter band reduction module, does the algorithms 1, 2 are executed to get the selective influential bands ? Since at line 123, the code is opening the file 'Kochia_distanes_VIF12', which is already existing in the folder.

Whether the influential bands are selected using the algorithm or hard coded bands are being used ? Because in utils.py, under load_data function, the bands are hard coded and the indexes are given.

I am finding difficulty in runnning the repo

Thanks in advance

GiorgioMorales commented 2 years ago

Hi,

Yes, the IBRA and GSS algorithms are executed in the interbandredundancy.py file. Those existing files are just checkpoints that allowed me to avoid repeating computations over and over again during my experiments. In fact, line https://github.com/GiorgioMorales/HSI-BandSelection/blob/199f9c86d1e2c23acc1c0280b75d6034f87a8109/interBandRedundancy.py#L187 says that if it doesn't find the file with the pre-selected bands (which are obtained by IBRA), it will execute IBRA. If you want to see the process, you can delete those files and run the script again, after that, the files will be automatically created again (line 200).

On the other hand, the bands that are specified in utils.py are the ones obtained by IBRA-GSS (interbandredundancy.py) and other methods. Those bands are directly specified there to quickly run the cross-validation analysis in the main function of TrainSelection.py. In fact, interbandredundancy.py does not use the function load_data at all. You can verify that in line https://github.com/GiorgioMorales/HSI-BandSelection/blob/199f9c86d1e2c23acc1c0280b75d6034f87a8109/interBandRedundancy.py#L227, the classifier object is being initialized using the selection of bands (selection=index) that was found during that iteration. That is, when an explicit selection is given, the hard-coded bands are ignored.

Again, thanks for your comments, this is a project in progress and I did not spend a ton of time adding comments to the code. I will try to do that in the following weeks.

Bests,

Giorgio

sankaraug commented 2 years ago

Thank you Giorgio Morales for your elaborate answer

sankaraug commented 2 years ago

Hi In trainselection.py, Line470 getting error models.model.network.apply(weight_reset) Attribute error: 'Model' object has no attribute 'model'

how much ever I try to rectify, I couldn't

can you please suggest what could be the problem.

Many Thanks

GiorgioMorales commented 2 years ago

It seems you must have downloaded the repo while I was doing a modification. Line 470 does not correspond to the code you indicate. Update the repo and verify if the problem persists. For future references, verify you pulled the last version because I will probably keep changing it.

sankaraug commented 2 years ago

Oh Thank you I will try with the latest one