3rd, Static Gestures, Inference

Now I have a Neural Network that infers static gestures, in order to keep this development process as tidy as possible, I created a new project and correspondent Graph in order to test the static inference functionality. It’s located in the folder “projects/staticGestures/staticGestures/” and the graph is “gestures_cpu.pbtxt” (it’s in the /graph folder)

 here’s the sub Graph:

It’s kind of simple to explain:

  • There is a Gate calculator that will only allow the passage of landmark Packets when receiving a Flag Packet indicating that there is a hand presence, this one is generated in the  “HandDetectionSubgraph” and forwarded to this graph by the main graph, I have included both graphs below for reference, you can check the definition in the project folder
  • The Angles packets are “reformatted” in the “anglesToTfLiteConverter” calculator, from Angles to TFLite input tensors
  • Those tensors are feed to a TFLite inference calculator which outputs a tensor with predicted results
  • The inferred Angles tensor in reconverted to Detections, as expected in the next node, also this calculator has an queue_size option, when set, it will create a FIFO buffer and will return the most frequent gesture in that buffer, this is to rejects spurious misdetections from the inference engine (though the actual implementation needs some debugging). It will also set a bounding box to be displayed in the output screen
  • DetectionLabelIdToTextCalculator” (from MediaPipe’s library of calculators) replaces Label ID with human readable label names, which will be shown in the output video.

Main graph:

Hand_detection_cpu graph: