Class MHTKernel<T>

java.lang.Object
clickTrainDetector.clickTrainAlgorithms.mht.MHTKernel<T>

public class MHTKernel<T> extends Object
Core functions for a multi-hypothesis tracking (MHT) algorithm which groups data based on a minimisation function.

The MHT algorithm is passed data and keeps a record of all possible ways to group the data, creating a tree like structure in memory. As the tree becomes larger (and risks taking up too much memory), the branches of the tree are "pruned" based on a minimisation function. For example the minimisation function may favour slowly changing amplitude or bearing.

The algorithm can hold multiple groups at the same time. Once a group reaches a pre-defined size then, on completion, it is saved.

Author:
Jamie Macaulay
  • Field Details

    • verbosity

      public static int verbosity
  • Constructor Details

    • MHTKernel

      public MHTKernel(MHTChi2Provider<T> mhtChi2)
      Constructor for the MHT kernel. This handles the data.
  • Method Details

    • clearKernel

      public void clearKernel()
      Clear up the kernel if starting a new run.
    • addDetection

      public void addDetection(T detection)
      Add a new data into the possibility mix. Note that data units should be sequentially in chronological order.
      Parameters:
      detection - - the detection to add.
    • printConfirmedTracks

      public void printConfirmedTracks()
      Prints the confirmed tracks.
    • printMHTKernalData

      public void printMHTKernalData()
      Prints the resulting data in the MHT Kernel
    • printMHTKernalData

      public void printMHTKernalData(int maxTracks)
      Prints the resulting data in the MHT Kernel
      Parameters:
      maxTracks - - the maximum number of tracks to print.
    • printMHTKernalData2

      public void printMHTKernalData2(int maxTracks)
    • getMHTChi2Provider

      public MHTChi2Provider<?> getMHTChi2Provider()
      Get the chi^2 provider. This handles chi^2 calculations for possible tracks. .
      Returns:
      the mnhtchi2
    • setMnhtchi2

      public void setMnhtchi2(MHTChi2Provider<T> mhtChi2Provider)
      Set the chi2 class.
      Parameters:
      mhtChi2Provider - the chi^2 provider to set
    • getMHTParams

      public MHTKernelParams getMHTParams()
      Returns:
      the mHTParams
    • setMHTParams

      public void setMHTParams(MHTKernelParams mHTParams)
      Parameters:
      mHTParams - the mHTParams to set
    • bitSetString

      public static StringBuilder bitSetString(BitSet bitSet, int size)
      Print bit set.
      Parameters:
      bitSet - - the bit set.
      Returns:
      the string builder representation
    • getNConfrimedTracks

      public int getNConfrimedTracks()
      Get the number of confirmed tracks. These are tracks which have been designated as done by the algorithm.
      Returns:
      the number of confirmed tracks.
    • clearConfirmedTracks

      public void clearConfirmedTracks()
      Clear the confirmed tracks from memory.
    • getConfirmedTrack

      public TrackBitSet getConfirmedTrack(int i)
      Get the confirmed track at the specified index.
      Parameters:
      i - - the index.
      Returns:
      the TrackBitSet at index i.
    • confirmRemainingTracks

      public void confirmRemainingTracks()
      Confirm all remaining tracks and add to confirm list. This is usually called once the last data unit has been added.
    • getActiveTracks

      public ArrayList<TrackBitSet> getActiveTracks()
      Get a list of the active in ascending chi^2 order. Active tracks are newPossibleTracks with a prune back and duplicates removed. Usually only used for plotting.
      Returns:
      a list of active tracks.
    • getReferenceUnit

      public T getReferenceUnit()
      Get the reference data unit. This is unit 0 for all current confirmed tracks and track possibilities.
      Returns:
      the reference data unit.
    • getKCount

      public int getKCount()
      Get the kcount. This is the total number of data units which have so far been added to the kernel.
      Returns:
      the kcount.
    • getPossibleTracks

      public ArrayList<TrackBitSet> getPossibleTracks()
      Get possible tracks. These are all possible tracks which are in the current possibility mix up to the last recieved data unit.
    • clearKernelGarbage

      public void clearKernelGarbage(int newRefIndex)
      Set a new reference index and junk all data before that index. This can be useful for long data sets to save memory once all click trains in preceding data units have been detecteded. Note that the function deletes the currently confirmed tracks. These should be extracted beforehand;
      Parameters:
      newRefIndex - - the new reference index. This is the index of refUnit
      newRefUnit - - the new reference data unit.
    • getFirstDetectionIndex

      public int getFirstDetectionIndex()
      Get the index from the current data unit which has the first non-zero detection. Can be used in conjunction with clearKernelGarbage(newIndex) to help save memory during long processing runs. 06/10/2019
      Returns:
      the first non zero detection
    • findFirstNonZeroBit

      public static int findFirstNonZeroBit(BitSet bitset, int kcount)
      Find the first non zero.
      Parameters:
      bitset - - the bitset to find non zero for.
      kcount - - number of bits to iterate through.
      Returns:
      the index of the first non zero.
    • getTrueBitCount

      @Deprecated public static int getTrueBitCount(BitSet bitset, int kcount)
      Deprecated.
      Get the number of bits which are 1.
      Parameters:
      bitset - - the bitset to test.
      kcount - - number of bits to iterate through.
      Returns:
      the number of positive bits in the bitset.
    • getTrueBitCount

      public static int getTrueBitCount(BitSet bitset)
      Get the number of bits which are 1.
      Parameters:
      bitset - - the bitset to test.
      kcount - - number of bits to iterate through.
      Returns:
      the number of positive bits in the bitset.
    • getPruneBack

      public int getPruneBack()
      Convenience function get prune back value from params. The prune back is the number of detections backwards the algorithm prune the branches for
      Returns:
      the prune back value.
    • getDataUnits

      public ArrayList<T> getDataUnits()
      Get a list of all data units added to the click train detector.
      Returns:
      a list of all data units added to the click train detector.
    • getPossibilityCount

      public int getPossibilityCount()
      Get the number of track possibilities currently in the possibility mix. As the algorithm runs this should initially increase and then stabilise.
      Returns:
      the possibility matrix count.
    • getLastDataUnit

      public T getLastDataUnit()
      Get the last data unit added to the matrix.
      Returns:
      the last data unit.