jkibele / OpticalRS

Python implementation of remote sensing methods from papers by David R. Lyzenga and others.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot process through Lyzenga 2006 method

CyanBC opened this issue · comments

I was able to get the KNN process to work through DepthEstimator

de = DepthEstimator('Input_Image', 'Depth_raster') depth = de.knn_depth_estimation(k=5)

however, the same process for Lyzenga

lyzdepth = de.lyzenga_depth_estimation()

fails eventually at Lyzenga2006.get_selfscore()

I've tracked it though to:
Lyzenga2006.py line 95: x_train = x_train.compressed().reshape(-1,nbands)

The above code takes my image array (x_train) which is a (x_train.shape==(7004,6199,8)) Woldview 2/3 image, and turns it into a (0,8) array, which then throws the error:
ValueError: Found array with a 0 sample(s) (shape=(0, 2)) while a minimum of 1 is required
when run through this line:
fit = get_fit( ind, x_train, y_train, n_jobs=njobs )

I'm not really sure what shape things should be in to get through this process, can you give me any tips?

There is a similar array shape problem in the Lyzenga Guide for X
full_pred = skolsfit.predict( X[...,best_ind] ) so I was hoping the above process would garner more success.

It's hard to say for sure what the problem is, but here's my best guess. I think that all of the training pixels are getting masked. That .compressed() bit only returns unmasked pixels. Try changing lyzdepth = de.lyzenga_depth_estimation() to lyzdepth = de.lyzenga_depth_estimation(n_std=3). If that works, you could try smaller values too. ...or if it doesn't you could try larger values.

If that does work and get you results, then I'm guessing that maybe you're working in temperate waters? There's something that's been called "over deduction" in the literature. I tried to address it in the data preprocessing section and the discussion of my depth estimation paper. It's difficult to explain clearly, but it's basically just that really dark bottom types cause the Lyzenga method to try to take the log of negative numbers. Where that happens, my code masks out those pixels. If too many pixels got masked, your error could be the result. I had to use a n_std of 2 for the Lyzenga method in my paper.

Please let me know if n_std fixes your problem. ...and please keep me posted if you get some comparable results. I'd love to know how the KNN method works vs. the Lyzenga method in other parts of the world.

Thank you for the direction. I'll keep pushing on it. My preliminary results for KNN for the waters off Okinawa (Motobu region) have been very, very good. My colleagues here have used Lyzenga processed through a different method that was not very convincing.

That's great to hear. Please keep me posted.

Also, if you're interested in habitat mapping, please check out my thesis. I intend to get a couple more publications out that'll put that work into a more concise format, but I've been too busy to make much progress. There's a lot more in OpticalRS than depth estimation.