Use CreateML to train a model for recognize squat and shoulder press.

According to coreml new features at WWDC2020, I write a sample code for action classification.

First, we need to use CreateML, so we have to upgrade macOS to Big Sur, although it is beta version now.

Step 1. Open CreateML, new a “Action Classification” project.

CreateML screenshot

Step 2. Wrap your videos in a folder.

Step 3. Select the folder(Step 2), it shows the classes and items

Step 4. Click “View” button, check the class label is correct or not.

Step 5. Press “train” button.

Step 6. Click “Preview” and import a video for testing the label result.

Step 7. Click “Output” and export the model, then you can use it with Vision.famework and CoreML.famework now.

Vision.famework: use VNDetectHumanBodyPoseRequest to get keypoints.

CoreML.famework: recognize the actions

You can download the demo code on my gitHub

iOS Developer