Action recognition is a computer vision technique to infer human actions (present state) in images or videos.
In this example, you learn how to implement inference code with a ModelZoo model to detect human actions in an image.
The source code can be found at ActionRecognition.java.
Follow setup to configure your development environment.
You can find the image used in this example in the project test resource folder: src/test/resources/action_discus_throw.png
Use the following command to run the project:
cd examples
./gradlew run -Dmain=ai.djl.examples.inference.cv.ActionRecognition
Your output should look like the following:
[INFO ] - [
class: "ThrowDiscus", probability: 0.99868
class: "Hammering", probability: 0.00131
class: "JavelinThrow", probability: 7.4e-09
class: "VolleyballSpiking", probability: 1.8e-10
class: "LongJump", probability: 5.8e-11
]
The results show that there is a 99.868 percent probability that the action is “ThrowDiscus”.