kvos / CoastSat

Global shoreline mapping tool from satellite imagery
http://coastsat.wrl.unsw.edu.au/
GNU General Public License v3.0
667 stars 245 forks source link

Problems with 'Batch shoreline detection' #209

Closed Juavafer closed 3 years ago

Juavafer commented 3 years ago

Hi,

Normally, I have not so many problems with shoreline extraction but in the next case, program shows an error. I think it could be some advanced parameter that I am not performing properly. In this case, 'default' advanced parameters do not work in order to extract shoreline.

My study area is: 2020-01-18-10-49-38_S2 I know the area beach is really small and it is difficult to classify sand areas. I have tried to change min_beach_area and buffer_size several times but still with no success.

Area features: -Beach (sand) length: 7000m (aprox) -Beach (sand) perimeter: 12100m (aprox) -Beach sand area: 300m^2 (aprox)

Error showed after %matplotlib qt output = SDS_shoreline.extract_shorelines(metadata, settings):

`Mapping shorelines: S2: 50%

MemoryError Traceback (most recent call last)

in 1 get_ipython().run_line_magic('matplotlib', 'qt') ----> 2 output = SDS_shoreline.extract_shorelines(metadata, settings) C:\Python_liclipse\Proyectos\CoastSat\coastsat\SDS_shoreline.py in extract_shorelines(metadata, settings) 169 # classify image in 4 classes (sand, whitewater, water, other) with NN classifier 170 im_classif, im_labels = classify_image_NN(im_ms, im_extra, cloud_mask, --> 171 min_beach_area_pixels, clf) 172 173 # if adjust_detection is True, let the user adjust the detected shoreline C:\Python_liclipse\Proyectos\CoastSat\coastsat\SDS_shoreline.py in classify_image_NN(im_ms, im_extra, cloud_mask, min_beach_area, clf) 362 363 # classify pixels --> 364 labels = clf.predict(vec_features) 365 366 # recompose image c:\python379\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in predict(self, X) 951 """ 952 check_is_fitted(self, "coefs_") --> 953 y_pred = self._predict(X) 954 955 if self.n_outputs_ == 1: c:\python379\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in _predict(self, X) 674 layer_units[i + 1]))) 675 # forward propagate --> 676 self._forward_pass(activations) 677 y_pred = activations[-1] 678 c:\python379\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in _forward_pass(self, activations) 100 for i in range(self.n_layers_ - 1): 101 activations[i + 1] = safe_sparse_dot(activations[i], --> 102 self.coefs_[i]) 103 activations[i + 1] += self.intercepts_[i] 104 c:\python379\lib\site-packages\sklearn\utils\extmath.py in safe_sparse_dot(a, b, dense_output) 171 return ret 172 else: --> 173 return np.dot(a, b) 174 175 <__array_function__ internals> in dot(*args, **kwargs) MemoryError: Unable to allocate 300. MiB for an array with shape (393120, 100) and data type float64` Thanks in advance, Juanjo V.
kvos commented 3 years ago

hey juanjo, try to make the polygon smaller so you have to load less pixels in live memory.

Juavafer commented 3 years ago

Hi Kilian,

You are right, polygon too big. Thanks so much!

As well, I have been having some problems with other' big' areas. Automatic shoreline extraction had worked properly but Digitalizing shoreline + automatic extraction does not work. Maybe it could be because the digitalized shoreline is too long... I will try with a smaller polygon.

Regards, Juanjo V.