kvos / CoastSat

Global shoreline mapping tool from satellite imagery
http://coastsat.space
GNU General Public License v3.0
697 stars 252 forks source link

Re-train the classifier of water and ice #95

Closed Alan19922015 closed 4 years ago

Alan19922015 commented 4 years ago

Hello, I plan to re-train the classer to seperate two classes ( ice and water ) in glacier terminate position. So I change the code and related function and I want make a label that need just two classes. What's important to make label. I digitize water and ice pixels with lassos with partly region of images. But it's not still specified. After I finifshed classier but it can't extract the coastline and occure the errors 'Could not map shoreline for this image: 2017-06-09-15-29-07_S2_Greenland

Best, Alain

kvos commented 4 years ago

hi alain, icy shoreline detection sounds pretty cool. The classifier example is using 4 classes (sand, whitewater, water and other) and the shoreline detection algorithm relies on those 4 classes to map the shoreline (I guess that's why it says "could not map shoreline"). If you want to change this to a 2 classes algorithm it will require a bit of twicking in the code. Go to SDS_classify.py in the coastsat folder and change lines 190 to 340 (there is one block for each class in there). Otherwise another option (quick and dirty) would be to leave it as it is but train the sand class as ice class, then the algorithm will automatically map the boundary between ice and water. Make sure you don't include the original training data when training your classifier as it may be confused if it is given sand and then ice for the same class, so re-train it only with your training data. Another question here is: the MNDWI is the best index to map sandy shorelines but is it the spectral index to differentiate ice from water? I believe there should be literature about this. Good luck

Alan19922015 commented 4 years ago

Thanks for your suggestion and If I have any update and I will upload the github branch.