Toe detection revisited

Here I was testing my new results on all measurements, just to bug-test it and see if it would work. Checking some of the results, just to see if everything was working properly. Until I notices something funny, my code would crash on some dogs measurements and I had no idea why.

So I look for the dog that’s causing the problem, start printing some of the results into the console, to figure out what’s causing the problem. Hmmm, that’s strange the lower left dog only has 18 lines, versus over 80 on the top two. So what’s causing this?

Comparing the pressure over time graphs for 2 dogs

Turns out, the peak detection algorithm I got from my first SO question doesn’t work too well on anything but a ‘medium’ sized paw!

Looking good eh?

Good toe detection

Looking not so good huh?

Not so good toe detection

Turns out that with my large dogs, the rear toe area is so large or wide, that it recognizes two peaks that don’t overlap in a 3×3 area with each other. I guess I could tweak the toe-sorting loop, to have it find the two most rear toes and locate an area around them or even just use both.

But guess what?!? I also have dogs that have 7 and 8 toes, so good luck merging those peaks into toes. And newflash! Those cute tiny dogs quite often only have 4! So clearly, this is not looking good for several of these measurements until I have a better way of detecting toes.

Thank god I even checked for the amount of toes in the first place, else I would have been looking a lot longer (though it would have crash my toe-sorting loop, as it expects only 5...)

My incomplete step checker (see below) actually checks for three things:

def incomplete_step(data, x, y,maxtime):
    incomplete = 0
    if touches_edges(data, x, y,maxtime):
        incomplete = 1
    elif sumovertime[data](-1) > (0.1* max(sumovertime(data))):
        incomplete = 1
    elif not fivetoescheck(detect_peaks(data)):
        incomplete = 1
    return incomplete

It first looks to see if the impact touches the edge of the plate or if it was active at the last frame of the measurement. In those cases I can’t guarantee the impact is complete, so they’re out. This filters out a relatively small amount of impacts and in practice shouldn’t occur too much, because you would simply repeat the measurement if the dog missed the plate too much.

Then it checks whether the summed up pressure(sumovertime) in the last frame is larger than 10% of the maximal pressure during the entire stance phase. If so, bye bye measurement! Though come to think of it, this should actually overlap with the paw being active at the last frame, which means the measurement stopped before the paw pushed of the plate. Note to self: check if this is true!

And the last one is the evil: check for 5 toes test! The upside to all this is: it surely cleans up, none of the incomplete steps are left! The downside is: it’s a bit too clean for my liking!

Accepted vs Rejected counts:

  • (73, 44)
  • (31, 52)
  • (28, 76)
  • (0, 214)
  • (13, 168)
  • (52, 67)
  • (5, 200)
  • (31, 68)
  • (28, 81)
  • (82, 54)
  • (1, 209)
  • (72, 80)
  • (45, 63)
  • (2, 221)
  • (88, 43)
  • (31, 54)
  • (73, 31)
  • (96, 23)
  • (77, 28)
  • (2, 189)
  • (7, 155)
  • (0, 153)
  • (12, 73)
  • (16, 196)
  • (86, 26)
  • (2, 212)

This is a list of all the dogs, where I counted how many impacts got filtered out. As you can see, A LOT of impacts are being filtered. In 6 out of 26 dogs, nearly every measurement is gone! Based on the number of impacts, I guess these are all the little dogs, which means the toe detection couldn’t find enough toes. But that doesn’t mean it liked the big dogs any better, because there a significant portion also get’s filtered out.

Obviously, I need a better way of detecting these toes!

Because I didn’t want to have my entire day ruined, I turned the filtering off and only created an average and the standard deviation of the summed pressure over time for every trial for every dog.

Just for the kick of it, here’s the comparison before and after the filtering:

With filtering

Toe detection with filtering

Without filtering

Toe detection without filtering

The order is a bit scrambled, but as you can see for several dogs, we end up with a much larger variation. This is partially caused by the hind paws not making it through the filtering, but at least it clearly shows the need for a filtering!

For now, I guess I’ll have to get back to the drawing board on that SO-question...

links

social