Identification of mountain peaks using a Artificial Neural Network.
Image source: Wikimedia
Our goal is to automatically identify mountain peaks. To do so, we will use the code Find_Mountaintops.ipynb to create Neural Network Model. This Deep-Learning model goal is to identify whatever some point desrcibe mountain peak or not.
In order to build the model, we will select proper area for training and testing the model. The area chosed located in the Alps Mountains, on the border between Italy and Switzerland. These are the boundaries of the defined area (wgs84 geo dd):
- north: 46.864583
- South: 45.687083
- East: 8.878750
- West: 7.250417
To build the model, we will use DTM, which was produced as part of the SRTM project. The data downloaded from this website srtmdata and transferred to a numpy matrix. The martix contain a grid of points which each point value indicates its height in meters above sea level. The tops matrix, contain 1955 rows, 1414 columns and a total of 2,764,370 height points. The file save as tops.npy. Now, we plot the tops matrix:
In order to illustrate the height values of the points, we chose to present in 3D the specific area from the matrix. The selcted area is Matterhorn Mountain area. The data present using a adapt version of the 3d-graph-gif code, full documentation can be found here: create-3d-graph-gif:
The file tags.csv contains 75508 label points: 'top'=1 means mountain peak and 'top'=0 means not a mountain peak. Using this tagging, we will extract the location (row + column) of each point in the matrix tops.npy. In order to identify whether each point is a peak or not, we will process each point together with The height points that surround it, so we get for each tagged point a 19X19 matrix. An example of such a matrix (showing a mountaintop point) can be seen here:
Now, based on the tagged labels (Y) and the array of matrices (X), we will perform the model training, based on 90% of the data we have. This is the model structure:
To evaluate the prediction quality of the model, we based on the remaining 10% test records. The percentage of correct results of the model seems to be 96.8%. In addition, we will present the results of the loss values and accuracy along the epochs of the model:
While examining the errors received from the model, it can be seen that in some cases might consider as controversial situations: in some of this cases its seems that the result consider incorrect sometimes seems to make sense:
Now, we would like to export the model so we can use it for future needs. The model is available at this link: Mountaintops_model.h5
Now, we want to use the model on new data. To do this, we will select as an example the area of Rheinwaldhorn Mountain. This new area not included in the boundaries of the old area which we used to build the model. As with the data we dealt with earlier, the information about the new area also should stored as a numpy matrix: Rheinwaldhorn.npy.
We should denfie scanning boundary from the selected area. This limitation is due to the fact that we want to examine each point next to the surrounding height points.
After using the model prediction, we will paint in red the peaks identified and check the results:
We would like also to present the result in 3D:
As can be seen, the model was able to successfully identify the peaks.
Full code for the model application process can be seen here: "implementation.ipynb"
To use this model, you just need to import it as follows:
# import tensorflow
from tensorflow import keras
# load model
model = keras.models.load_model(r'Model\Mountaintops_model.h5')
# load X
X = ...
# application
Y_prediction = np.round(model.predict(X),0)
X: numpy.array which contain 19x19 matrices of np.floats
tensorflow
matplotlib
pandas
numpy
MIT © Etzion Harari