Closed danielparthier closed 4 years ago
After checking further the easiest option is probably to detect the jumps by looking into the distance between labels. For example the ears should have a similar distance over time. A loss of a label would shift this. That what we can see in this example:
When looking at the ratio we can use it to identify these anomalies.
And when normalising we can even apply it without adjusting thresholds.
I will try to do this for all labels which belong to a structure and then interpolate coordinates.
It seems to be possible to fit a t-distribution to the differential of all the coordinates. This allows to detect outliers in a robust way and will be updated soon.
fitDT <- function(par, x){
-sum(dt(x = x-par[2], df = par[1], log = T))
}
nlminb(x = diff(Input), fitDT, start = c(1,0))
The interpolation is now the missing end. I will look for an appropriate interpolation (probably not linear?).
The issue was fixed in the last commit. The jumps are detected based on the t-distribution of the coordinate differential and then interpolated by using b-splines.
Without correction:
With correction:
A correction is needed for random jumps of labels. I am currently investigating whether a median filter and then deviation from there could be used or whether an ARIMA modelling could help. Currently, the median filter would work nicely, however, jumps at the beginning will not be corrected if they are closer than the rolling window size. Any suggestions?