Open Y-F-Yang opened 4 years ago
Thank you for providing such detailed information, and maybe you found something interesting. If I understand correctly, the problem is that you found that the data distribution between the training set and the test set is too different.
For me, analyzing remote sensing images doesn't use NumPy because they're too big (actually because I'm too lazy). I generally use ENVI's quick stats
for statistics(ENVI is a professional remote sensing image processing software). I've done tests before and found that the ENVI statistics are consistent with the NumPy.
In ENVI, l2_n10_x95_y780.tif
's statistics are as follows:
In ENVI, hanyang2002
(the test set) is this:
Just as you did, to hanyang2002
, I converted 11 bits to 8 bits(only B-G-R), but I used the Export Layer to Tiff
(this is a very useful feature to save the number of bands displayed and the stretching mode in ENVI). In my experience, the best stretching mode is Optimized Linear
.
and the result image's statistical results is this:
then I used numpy to read indices [780:780+150, 95:95+150, 0:3], which is:
[[[11 25 30]
[11 25 30]
[ 6 21 26]
...
[18 32 38]
[19 33 39]
[15 29 35]]
[[13 24 29]
[14 24 30]
[13 23 29]
...
[19 29 34]
[24 34 38]
[16 26 31]]
[[15 25 31]
[13 23 29]
[17 27 33]
...
[23 33 37]
[14 25 29]
[18 28 32]]
...
But I guess maybe that's not the point, because [780:780+150, 95:95+150, 0:3] is just local information.
What's strange to me is these two things:
hanyang2002
's NIR channel is 16-bit, while the hanyang2009
's NIR channel is 11-bit.
I have already opened an issue in MtS-WH-Dataset, maybe you can take a look. If I made any mistakes, please correct me.
Thanks for your detailed reply! It really makes the problem more clear.
Hello,
In the MtS-WH data set, it seems that for images in training set, all the channels are corrected to 8-bit unsigned color, while for those in test set, the B-G-R channels are 11-bit and NIR channel is 16-bit. So I tried a naïve way to cast 11-bit color to 8-bit, i.e., 8-bit = 11-bit * 256 / 2048. However this does not work out well.
Here's an example: First I load a training data file 'l2_n10_x95_y780.tif' into numpy nd-array (only B-G-R). It looks like:
Then I read the corresponding part in 'hanyang2002' into numpy array, using indices [780:780+150, 95:95+150, 0:3] (hopefully I'm correct), which looks like:
Finally by performing 8-bit = 11-bit * 256 / 2048, the test data becomes
which obviously does not coincide with training data.
So is there any special color or maybe radiometric correction performed when extracting training set?
Thanks very much!