Skip to main content
. 2021 Mar 10;21(6):1947. doi: 10.3390/s21061947
Algorithm 1 Hierarchical learning approach.
  •   1:

    Load RF dataset

  •   2:

    Define the inputs and the outputs

  •   3:

    Pre-process the data

  •   4:

    Encoding the outputs with respect to the inputs

  •   5:

    Split the data into Sets: training (70%) and testing (30%) sets (trainSet,testSet)

  •   6:

    Define the input variables and find the optimal parameters (params) using GridSearch

  •   7:

    Records startTime

  •   8:

    Train the system on (trainSet) by calling HierarchicalApproach procedure

  •   9:

    Test the system by using (testSet) and evaluate the required metrics

  •  10:

  •  11:

    procedureClassifier(Sets,params)

  •  12:

      Use the optimal parameters params for KNN and XGBoost

  •  13:

      Use ensemble learning based on KNN and XGBoost

  •  14:

      Train and fit the classifier using (trainSet)

  •  15:

      Predict the test samples

  •  16:

    end procedure

  •  17:

  •  18:

    procedureHierarchicalApproach(trainSet,testSet,params)

  •  19:

      Sample from Sets will pass the first Classifier to specify the availability of the UAV (2 classes: 0-No UAV, 1-UAV)

  •  20:

      if class==0 then

  •  21:

        procTime=timeNowstartTime

  •  22:

        go to end procedure and return the predicted class (predClass==C1)

  •  23:

      else

  •  24:

        Sample will pass the second Classifier to specify the type of the UAV (3 classes: 0-Bebop UAV, 1-AR UAV, 2-Phantom3 UAV)

  •  25:

        if class==2 then

  •  26:

          procTime=timeNowstartTime

  •  27:

          go to end procedure and return the predicted class: Phantom3 UAV (predClass==C10)

  •  28:

        else

  •  29:

          if class==0 then

  •  30:

           Sample will pass the third Classifier to specify the mode of the Bebop UAV (4 classes: 0-ON (C2), 1-Hovering (C3), 2-Flying (C4), 3-Recording (C5))

  •  31:

           if class==0 then

  •  32:

             procTime=timeNowstartTime

  •  33:

             go to end procedure and return the predicted class: Bebop UAV with ON mode (predClass==C2)

  •  34:

           else if class==1 then

  •  35:

             procTime=timeNowstartTime

  •  36:

             go to end procedure and return the predicted class: Bebop UAV with Hovering mode (predClass==C3)

  •  37:

           else if class==2 then

  •  38:

             procTime=timeNowstartTime

  •  39:

             go to end procedure and return the predicted class: Bebop UAV with Flying mode (predClass==C4)

  •  40:

           else

  •  41:

             procTime=timeNowstartTime

  •  42:

             go to end procedure and return the predicted class: Bebop UAV with Recording mode (predClass==C5)

  •  43:

           end if

  •  44:

         else

  •  45:

           Sample will pass the fourth Classifier to specify the mode of the AR UAV (4 classes: 0-ON (C6), 1-Hovering (C7), 2-Flying (C8), 3-Recording (C9))

  •  46:

           if class==0 then

  •  47:

             procTime=timeNowstartTime

  •  48:

             go to end procedure and return the predicted class: AR UAV with ON mode (predClass==C6)

  •  49:

           else if class==1 then

  •  50:

             procTime=timeNowstartTime

  •  51:

             go to end procedure and return the predicted class: AR UAV with Hovering mode (predClass==C7)

  •  52:

           else if class==2 then

  •  53:

             procTime=timeNowstartTime

  •  54:

             go to end procedure and return the predicted class: AR UAV with Flying mode (predClass==C8)

  •  55:

           else

  •  56:

             procTime=timeNowstartTime

  •  57:

             go to end procedure and return the predicted class: AR UAV with Recording mode (predClass==C9)

  •  58:

           end if

  •  59:

         end if

  •  60:

        end if

  •  61:

      end if

  •  62:

      Return predicted class (predClass) and processing time (procTime)

  •  63:

    end procedure