Running the neural network with the provided input and output - lasseufpa/5gm-lidar GitHub Wiki

1. First, you'll need the given network's inputs and outputs, available in the following links:

Input: https://nextcloud.lasseufpa.org/s/fwGaScH85beoBj4

Output: https://nextcloud.lasseufpa.org/s/E2Zd7rXSRzDsmkm

2. Unzip both files and move the .npz to the folder with the cloned codes:

mv beams_input.npz D:\github\5gm-lidar
mv beams_output.npz D:\github\5gm-lidar

3. Execute the neural network running the following:

python classifierTopKBeams.py

In the end, it'll generate a .txt file with the precisions obtained.

4. In addition, you can alter some parameters of the Neural Network, like the number of epochs and filters:

For epochs, you can alter it in line 88 of the classifierTopKBeams.py file:

85  seed = 7
86  np.random.seed(seed)
87  batch_size = 32
88  epochs = 400 #20000 #Alter here
89  thresholdBelowMax = 6

For filters, you can alter in line 177 of the same file, by default, it'll start running with 21 filters:

177  for NN in range(21, 100, 5):  #Alter here
178     print('Running with NN = ', NN)
179     model = Sequential()

5. (OPTIONAL)To generate curves, for a better observation of results, you can use matplotlib library, an example is given below:

287    print(history.history) #This line is already in the code
       model.save("./pesos/LIDAR"+str(NN))
       print('Save model NN:'+str(NN))
       k_beams = [5, 10, 30, 50, 100]
       epochsk = range(1,epochs+1,1)
       fig, ax = plt.subplots()
       for i in k_beams:
           labelk = 'top_' + str(i)
           if i ==5:
               i = 'k_categorical'
           ax.plot(epochsk,history.history["top_"+str(i)+"_accuracy"], label = labelk)
       ax.set(xlabel='Epochs', ylabel='Accuracy',
           title='5gm-lidar '+ str(NN))
       ax.grid()
       plt.legend()
       fig.savefig("./plots/accuracy_"+str(NN)+".png")
       #plt.show()
288    f.write(str(history.history)) #This line is already in the code

The matplotlib import is not informed in the code so it must be added.