Skip to content

About

Posture enforcer with Texas Instruments TDA4VM board and Edge Impulse Machine Learning platform

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§β€β™‚οΈπŸ‘οΈ TDA4VM Posture Enforcer

An edge-AI computer-vision prototype that recognizes correct and incorrect working posture.

TDA4VM Posture Enforcer explores a practical industrial computer-vision problem:

Can a camera continuously recognize whether a worker is using a machine with the expected posture and turn that recognition into a physical action?

The reference experiment focuses on repetitive leather-working operations involving hard pressing.

A USB camera observes the operator. An Edge Impulse FOMO object-detection model classifies the visible posture as:

ok

or:

notok

The model runs locally on a Texas Instruments SK-TDA4VM. A Python script parses the inference output and controls a relay through the board's GPIO header.

             Worker
                β”‚
                β–Ό
          USB webcam
                β”‚
                β–Ό
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚ Texas Instruments   β”‚
     β”‚     SK-TDA4VM       β”‚
     β”‚                     β”‚
     β”‚ Edge Impulse Linux  β”‚
     β”‚ FOMO model          β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚
          β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”
          β–Ό           β–Ό
        `ok`       `notok`
          β”‚           β”‚
          β”‚           β–Ό
          β”‚      posture1.py
          β”‚           β”‚
          β”‚           β–Ό
          β”‚        GPIO 18
          β”‚           β”‚
          β”‚           β–Ό
          β”‚         Relay
          β”‚
          β–Ό
     Continue monitoring

The repository is a compact companion to the complete Edge Impulse Expert Network tutorial, where dataset creation, TDA4VM configuration, model training, deployment, GPIO setup, and relay integration are documented in detail.


✨ Features

  • πŸ‘οΈ Real-time camera-based posture recognition
  • 🧠 Edge Impulse Machine Learning
  • 🎯 FOMO object detection
  • ⚑ Texas Instruments SK-TDA4VM
  • πŸš€ Hardware-accelerated edge inference
  • πŸ“· Logitech USB webcam support
  • 🏷️ Two posture labels: ok and notok
  • πŸ“¦ Public Edge Impulse model
  • 🐍 Python inference-output parser
  • πŸ”Œ GPIO-controlled relay
  • πŸ“΄ Local inference without cloud video streaming
  • πŸ“Š Bounding-box confidence output

🧠 Concept

Traditional programming works well when a condition can be expressed using clear rules.

For posture recognition, a rule such as:

if shoulder_x < 32
and head_y > 41
and arm_angle < 70:
    posture = bad

would be brittle.

Real images vary because of:

  • body proportions
  • clothing
  • lighting
  • background
  • camera position
  • machine position
  • movement
  • partial occlusion
  • different workers

Instead, the project trains a computer-vision model from examples.

Examples of correct posture
            +
Examples of incorrect posture
            β”‚
            β–Ό
       Edge Impulse
            β”‚
            β–Ό
       FOMO model
            β”‚
            β–Ό
New camera image
            β”‚
       β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”
       β–Ό          β–Ό
      `ok`      `notok`

🏭 Reference use case

The original experiment was created around a leather-working process involving repeated manual pressing.

The task requires the operator to maintain a particular body position while repeatedly using a machine.

The project investigates whether computer vision can automate the observation step:

Supervisor demonstrates
expected posture
       β”‚
       β–Ό
Capture examples
       β”‚
       β–Ό
Train model
       β”‚
       β–Ό
Machine monitors
future operation

⚑ Texas Instruments SK-TDA4VM

The project runs on the:

Texas Instruments SK-TDA4VM Starter Kit

The board is designed specifically for embedded computer vision and Edge AI.

Official information:

SK-TDA4VM β€” Texas Instruments

The underlying TDA4VM SoC includes:

  • Dual 64-bit Arm Cortex-A72 up to 2 GHz
  • C7x DSP
  • Deep-learning matrix accelerator
  • Up to 8 TOPS of 8-bit AI performance
  • Vision-processing accelerators
  • Depth and motion processing
  • PowerVR GPU
  • Multiple Arm Cortex-R5F cores
  • Hardware video acceleration

Processor documentation:

TDA4VM β€” Texas Instruments


🧠 Why the TDA4VM?

The board provides considerably more vision-processing capability than a small microcontroller.

The project benefits from:

camera input
+
Linux
+
Python
+
Edge Impulse Linux Runner
+
TI deep-learning acceleration
+
GPIO

on the same platform.

The SK-TDA4VM also supports multiple camera interfaces, making multi-view posture analysis a possible extension.


🧰 Hardware

The reference build uses:

Qty Component Purpose
1 Texas Instruments SK-TDA4VM Edge AI inference
1 Logitech C270, C920 or C922 USB webcam Image acquisition
1 1-channel relay module Physical output
1 microSD card TDA4VM Linux image
1 Ethernet cable SSH / network access
1 5 V / 3 A USB-C power supply Board power

The repository also includes:

TDA4VMGpioPinout.jpg

as a GPIO-header reference.


πŸ“· Camera

The documented setup supports conventional USB webcams such as:

Logitech C270
Logitech C920
Logitech C922

The camera should be positioned so that the relevant working posture remains visible during the complete task.

A fixed camera mount is strongly recommended.

Changes in:

camera angle
distance
height
field of view

can affect model behavior if those conditions were not represented in the training data.


🧠 Edge Impulse project

The complete public Machine Learning project is available in Edge Impulse Studio:

Posture Detection β€” Public Edge Impulse Project

It can be cloned instead of rebuilding the model from scratch.


πŸ“Š Dataset

The reference dataset was intentionally small.

Approximately:

50 images β†’ correct posture
50 images β†’ incorrect posture

were collected.

Some images were discarded because they contained:

  • only background
  • non-representative machine states
  • unsuitable frames

Each usable image was annotated with a bounding box.

Labels:

ok
notok

πŸ“± Data acquisition

Although Edge Impulse can capture images directly from connected hardware, the reference dataset was collected using an Android phone.

The project used Open Camera because it supports:

repeated photos
+
configurable intervals
+
small image resolution

This allowed images to be collected at the actual workplace without moving the TDA4VM setup.


🏷️ Bounding-box labeling

The Edge Impulse project uses:

Bounding Boxes

as the labeling method.

Each training image contains a box around the worker and one of two labels:

ok

or:

notok

Conceptually:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                            β”‚
β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚        β”‚  worker  β”‚        β”‚
β”‚        β”‚          β”‚        β”‚
β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚             `ok`           β”‚
β”‚                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

or:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                            β”‚
β”‚      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚      β”‚   worker   β”‚        β”‚
β”‚      β”‚            β”‚        β”‚
β”‚      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚           `notok`          β”‚
β”‚                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧩 Impulse configuration

The reference Edge Impulse impulse uses:

Image Data
   β”‚
   β–Ό
96 Γ— 96 pixels
Resize: Fit shortest axis
   β”‚
   β–Ό
Image processing
   β”‚
   β–Ό
Object Detection
   β”‚
   β–Ό
FOMO

Training configuration:

Training cycles: 60
Learning rate:   0.001
Data augmentation: enabled
Model: FOMO

🎯 FOMO

The project uses FOMO β€” Faster Objects, More Objects, Edge Impulse's lightweight object-detection architecture.

Instead of returning only:

image = bad posture

the model can return localized detections:

{
  "height": 8,
  "label": "notok",
  "value": 0.71,
  "width": 8,
  "x": 64,
  "y": 72
}

The result includes:

Field Meaning
label ok or notok
value Detection confidence
x Detection location
y Detection location
width Bounding-cell width
height Bounding-cell height

πŸ“Š Reference training result

The original experiment reported:

F1 score: 71.4%

and:

Incorrect-posture detection rate: 100%

for the small reference dataset.

These values belong to that specific training run.


πŸ§ͺ Inference examples

No posture detected

boundingBoxes 2ms. []
boundingBoxes 1ms. []

Correct posture

Example:

boundingBoxes 1ms.
[
  {
    "height": 8,
    "label": "ok",
    "value": 0.5057658553123474,
    "width": 8,
    "x": 48,
    "y": 24
  }
]

Incorrect posture

Example:

boundingBoxes 1ms.
[
  {
    "height": 8,
    "label": "notok",
    "value": 0.7100046873092651,
    "width": 8,
    "x": 64,
    "y": 72
  }
]

The runner continuously generates these detections from the USB camera stream.


πŸ”Œ Relay output

A single-channel relay provides the physical-output portion of the experiment.

The documented GPIO is:

GPIO 18

The demonstration architecture is:

FOMO prediction
      β”‚
      β–Ό
posture1.py
      β”‚
      β–Ό
GPIO 18
      β”‚
      β–Ό
Relay
      β”‚
      β–Ό
External load / test machine

The relay converts the Machine Learning result into an observable physical action.


🧩 40-pin expansion header

The SK-TDA4VM includes a:

40-pin
2 Γ— 20
2.54 mm

expansion header.

It exposes interfaces including:

  • GPIO
  • IΒ²C
  • SPI
  • IΒ²S
  • UART
  • PWM

The interface signals use:

3.3 V logic

The repository includes:

TDA4VMGpioPinout.jpg

as a practical pinout reference created during development.


βš™οΈ Enabling the expansion header

Expansion-header GPIO was disabled by default in the Linux configuration used by the original project.

After initially obtaining no GPIO output, the solution was to modify:

/run/media/mmcblk0p1/uenv.txt

and add:

name_overlays=k3-j721e-edgeai-apps.dtbo k3-j721e-sk-rpi-exp-header.dtbo

After rebooting with that overlay, GPIO control became available.

This reflects the Processor SDK configuration used by the original project. Current Texas Instruments SDK releases may use different device-tree or overlay procedures, so check the documentation for the image you install.


🐍 GPIO test

The original GPIO test uses the Raspberry Pi-compatible GPIO interface:

import RPi.GPIO as GPIO
import time

output_pin = 18

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(output_pin, GPIO.OUT)

GPIO.output(output_pin, GPIO.HIGH)
time.sleep(3)
GPIO.output(output_pin, GPIO.LOW)

This provides a simple hardware test before combining relay control with Machine Learning.


🐍 posture1.py

The repository's main source file is:

posture1.py

Its role is to bridge:

Machine Learning prediction

and:

GPIO action

The script parses the output produced by the Edge Impulse Linux Runner, identifies the posture label, and changes the relay state accordingly.

edge-impulse-linux-runner
        β”‚
        β–Ό
boundingBoxes output
        β”‚
        β–Ό
posture1.py
        β”‚
   β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
   β–Ό         β–Ό
 `ok`     `notok`
   β”‚         β”‚
   β–Ό         β–Ό
relay      relay
state      state

The important architectural point is that the inference model and the physical action remain separate components.

This makes it possible to replace the relay action with something else without retraining the model.


πŸ”„ Alternative outputs

Instead of switching a relay, the same recognition event could trigger:

warning light
buzzer
screen message
industrial stack light
MQTT event
database log
Telegram message
supervisor notification
PLC input

The ML model answers:

What posture is visible?

while the application decides:

What should happen next?

πŸ’» TDA4VM operating system

The original build uses the Texas Instruments Processor SDK Linux image for the SK-TDA4VM.

Current official downloads:

PROCESSOR-SDK-LINUX-SK-TDA4VM

Flash the provided:

.wic.xz

image to a microSD card.

The original tutorial used an older release than the current Texas Instruments SDK, so filenames, included packages, login defaults, and device-tree configuration may differ today.


🌐 Connecting to the board

The reference development workflow uses:

SK-TDA4VM
   β”‚
   β–Ό
Ethernet
   β”‚
   β–Ό
Router
   β”‚
   β–Ό
SSH / SFTP

Find the board's IP address through the router's DHCP-client list and connect over SSH.

The historical SDK used:

User: root
Password: empty

Do not assume current images use the same credentials.

If an image ships with permissive defaults, secure it before connecting the board to an untrusted network.


πŸ“¦ Install Edge Impulse Linux

The reference setup installs the Linux tools with:

npm install -g --unsafe-perm edge-impulse-linux

Then launches the model with explicit TI acceleration:

edge-impulse-linux-runner \
  --force-engine tidl \
  --force-target runner-linux-aarch64-tda4vm

On the first run, authenticate with Edge Impulse and select the posture-detection project.


πŸ“· Camera preview

Once the Edge Impulse Linux Runner is active, the original setup exposes a camera-preview page on:

http://<TDA4VM-IP>:4912

For example:

http://192.168.1.50:4912

Use this preview to verify:

  • worker visibility
  • camera angle
  • lighting
  • framing
  • model predictions

before relying on the parser.


πŸ“‚ Installing posture1.py

Transfer:

posture1.py

to:

/opt/edge_ai_apps

using SFTP or another file-transfer method.

Then run:

cd /opt/edge_ai_apps
python3 posture1.py

The script then connects the model output to the GPIO relay action.


πŸ“ Repository structure

tda4vmPostureEnforcer/
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ TDA4VMGpioPinout.jpg
└── posture1.py

posture1.py

Python glue code connecting Edge Impulse inference output to GPIO relay control.

TDA4VMGpioPinout.jpg

Reference image for the SK-TDA4VM 40-pin expansion header.

README.md

Original repository description and Edge Impulse project link.

LICENSE

MIT License.


πŸš€ Quick start

1. Clone the repository

git clone https://github.com/ronibandini/tda4vmPostureEnforcer.git
cd tda4vmPostureEnforcer

2. Clone the ML model

Open:

Public Edge Impulse project

and clone it into your own Edge Impulse account.


3. Install the TDA4VM Linux image

Download the current:

TI Processor SDK for SK-TDA4VM

and flash the .wic.xz image to a microSD card.


4. Connect the webcam

Attach a compatible USB camera such as:

Logitech C270
Logitech C920
Logitech C922

5. Enable the GPIO header if required

For the historical SDK configuration, add:

name_overlays=k3-j721e-edgeai-apps.dtbo k3-j721e-sk-rpi-exp-header.dtbo

to:

/run/media/mmcblk0p1/uenv.txt

Reboot the board.

Check the current TI SDK documentation before applying this to a newer image.


6. Test GPIO 18

Test the relay output independently before introducing the model.

Do this with a harmless low-voltage test load first.


7. Install Edge Impulse

npm install -g --unsafe-perm edge-impulse-linux

8. Run inference

edge-impulse-linux-runner \
  --force-engine tidl \
  --force-target runner-linux-aarch64-tda4vm

Verify the model through:

http://<deviceIP>:4912

9. Run the posture controller

Copy:

posture1.py

to:

/opt/edge_ai_apps

and execute:

python3 posture1.py

πŸ§ͺ Rebuilding the model

To create a model for another task or workplace:

1. Capture examples of accepted posture

2. Capture examples of unacceptable posture

3. Include different workers

4. Include realistic clothing

5. Include normal background variation

6. Label bounding boxes

7. Split train/test data

8. Train FOMO

9. Evaluate false positives

10. Evaluate false negatives

11. Deploy to TDA4VM

12. Validate using unseen workers

A production-quality system should use substantially more data than the reference proof of concept.


πŸ”¬ Ideas for extending the project

  1. πŸ“· Multi-camera posture detection β€” combine front and side views using the TDA4VM's multi-camera capabilities to reduce ambiguity.

  2. ⏱️ Temporal filtering β€” require several consecutive notok detections before generating an alert or control event, reducing reactions to single-frame false positives.

  3. πŸ“Š Event logging β€” save confidence, timestamps, posture duration, and machine state for later process analysis and model improvement.


πŸ“° External references

πŸ—žοΈ Edge Impulse β€” Straightening Out Posture in the Workplace

Edge Impulse published a dedicated article by Nick Bild on July 3, 2023.

The feature covers:

  • leather-work posture
  • Texas Instruments SK-TDA4VM
  • USB webcam
  • approximately 50 good and 50 bad posture images
  • bounding-box labeling
  • Edge Impulse FOMO
  • 71%+ F1 score
  • local edge inference
  • privacy advantages of on-device vision
  • relay integration
  • possible multi-camera extensions

Straightening Out Posture in the Workplace β€” Edge Impulse


🧠 Edge Impulse Expert Network

The complete technical guide is part of the Edge Impulse Expert Network:

Correct Posture Detection and Enforcement β€” Texas Instruments TDA4VM

The guide documents the full workflow from TDA4VM setup through relay control.


πŸ§ͺ Public Edge Impulse project

The complete trained project is publicly cloneable:

Posture Detection β€” Edge Impulse Studio


πŸ“š Edge Impulse project index

The project is listed in the Edge Impulse Expert Network's Computer Vision Projects collection alongside other TDA4VM deployments.

Edge Impulse Expert Network project list


πŸ“° Wevolver

The project is also referenced in Wevolver's article on high-performance microprocessors for Edge AI computer vision.

It appears as an example of posture detection and immediate physical feedback running on a Texas Instruments vision platform.

Building Robust Edge AI Computer Vision Applications with High-Performance Microprocessors β€” Wevolver


πŸ“• Contracultura Maker

More projects, technical experiments, embedded AI systems, unusual machines, and Maker Counterculture are collected in:

Contracultura Maker β€” book


πŸ“š Useful references


πŸ”— You may also be interested in...

Other projects by Roni Bandini using Edge Impulse and Texas Instruments edge-AI hardware.

πŸ‘οΈβš™οΈ Visual Anomaly

Real-time visual anomaly detection for industrial inspection using Edge Impulse FOMO-AD on the Texas Instruments SK-TDA4VM.

It uses the same hardware family for a different industrial computer-vision problem.

github.com/ronibandini/visualAnomaly


🀟🧠 ASL Trainer

American Sign Language training system using Machine Learning and Texas Instruments edge-AI hardware.

Another project combining real-time computer vision with a physical learning/application workflow.

github.com/ronibandini/ASLTrainer


πŸŽ™οΈβš‘ RUBIK Pi Audio Classification

Real-time glass-break sound classification using Edge Impulse and GPIO output on the Thundercomm RUBIK Pi 3.

Like Posture Enforcer, it converts an Edge Impulse inference result into an immediate physical GPIO action.

github.com/ronibandini/Rubik-Pi-AudioClassification


⚠️ Deployment considerations

ML false positives and false negatives

The model is probabilistic.

Possible outcomes include:

bad posture classified as good
good posture classified as bad
no detection
multiple detections

A production system should therefore consider:

  • confidence thresholds
  • temporal filtering
  • manual override
  • event logging
  • watchdogs
  • fail-safe behavior
  • independent safety mechanisms

πŸ“œ License

TDA4VM Posture Enforcer is released under the MIT License.

See LICENSE for details.


πŸ‘€ Author

Roni Bandini

Maker, AI developer, electronic artist and writer.

Buenos Aires, Argentina.

About

Posture enforcer with Texas Instruments TDA4VM board and Edge Impulse Machine Learning platform

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages