Class MHTKernel<T>
java.lang.Object
clickTrainDetector.clickTrainAlgorithms.mht.MHTKernel<T>
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDetection
(T detection) Add a new data into the possibility mix.static StringBuilder
bitSetString
(BitSet bitSet, int size) Print bit set.void
Clear the confirmed tracks from memory.void
Clear up the kernel if starting a new run.void
clearKernelGarbage
(int newRefIndex) Set a new reference index and junk all data before that index.void
Confirm all remaining tracks and add to confirm list.static int
findFirstNonZeroBit
(BitSet bitset, int kcount) Find the first non zero.Get a list of the active in ascending chi^2 order.getConfirmedTrack
(int i) Get the confirmed track at the specified index.Get a list of all data units added to the click train detector.int
Get the index from the current data unit which has the first non-zero detection.int
Get the kcount.Get the last data unit added to the matrix.Get the chi^2 provider.int
Get the number of confirmed tracks.int
Get the number of track possibilities currently in the possibility mix.Get possible tracks.int
Convenience function get prune back value from params.Get the reference data unit.static int
getTrueBitCount
(BitSet bitset) Get the number of bits which are 1.static int
getTrueBitCount
(BitSet bitset, int kcount) Deprecated.void
Prints the confirmed tracks.void
Prints the resulting data in the MHT Kernelvoid
printMHTKernalData
(int maxTracks) Prints the resulting data in the MHT Kernelvoid
printMHTKernalData2
(int maxTracks) void
setMHTParams
(MHTKernelParams mHTParams) void
setMnhtchi2
(MHTChi2Provider<T> mhtChi2Provider) Set the chi2 class.
-
Field Details
-
verbosity
public static int verbosity
-
-
Constructor Details
-
MHTKernel
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
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
Get the chi^2 provider. This handles chi^2 calculations for possible tracks. .- Returns:
- the mnhtchi2
-
setMnhtchi2
Set the chi2 class.- Parameters:
mhtChi2Provider
- the chi^2 provider to set
-
getMHTParams
- Returns:
- the mHTParams
-
setMHTParams
- Parameters:
mHTParams
- the mHTParams to set
-
bitSetString
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
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
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
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
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 refUnitnewRefUnit
- - 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 withclearKernelGarbage(newIndex)
to help save memory during long processing runs. 06/10/2019- Returns:
- the first non zero detection
-
findFirstNonZeroBit
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.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
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
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
Get the last data unit added to the matrix.- Returns:
- the last data unit.
-