OpenMV
Shields
Lens
Robotics
Book
Video
Download
Docs
Forum
OpenMV.io
GithubArtificial intelligence has two very common tasks in the field of vision: classification and object detection.
Category:Determine the category to which the image belongs, such as cat or dog.
Object Detection:Used to locate the positions, quantities, and dimensions of multiple distinct objects in an image.
In previous video tutorials, we explained how to use the OpenMV4 Plus to train neural networks online for classifying different objects. It can determine in real time whether an image within the OpenMV field of view corresponds to a specific object—for example, whether a face is wearing a mask—but it cannot output the coordinates of faces or masks, nor the number of faces.
Target detection is significantly more complex and computationally intensive than classification, making it rare in the microcontroller domain. The main control MCU of OpenMV is the STM32H7. We have now added a new feature to SingTown OpenMV that enables target detection–like tasks to run on microcontrollers, delivering outstanding performance.

Today, we will explain to youTraining demonstrates traffic sign detection in real-road environments, detecting traffic signs on our actual roads.such as no honking, no parking, and a speed limit of 80 km/h, rather than a laboratory environment free from interference.
You can view the entire project content, including all code and models, at the following address: https://book.openmv.cc/project/traffic-sign.html
It is widely recognized that real-world environments—particularly road environments—are highly complex and subject to numerous interferences. We captured images of traffic signs in real-world environments using devices such as smartphones, then trained a model on EdgeImpulse—the online platform of our OpenMV partner—with approximately 270 annotated images; the training process required only ten minutes. The resulting model achieved an F1 score accuracy of 92%, and its inference frame rate on OpenMV reached 10 frames per second—delivering both smooth performance and high accuracy.
Users can train the system to detect any target of interest—such as various digits, different fruits, distinct markers, diverse components, or even any specific irregular object—by following our video tutorials, thereby enabling detection of the target’s count, coordinates, and object class name.
Note:This video tutorial covers the neural network keypoint detection feature, which is compatible not only with the OpenMV4 H7 Plus but also with the OpenMV4 H7. The trained FOMO keypoint detection model is compact, highly effective, and occupies only dozens of kilobytes; therefore, even though the OpenMV4 H7 has less RAM than the Plus version, we can train a slightly smaller model to run on the OpenMV4.
Below is a brief introduction to the principle:
The primary design decision behind FOMO object detection on OpenMV is based on the idea that many object detection tasks do not actually require the size of the objects but only their positions within the image. Once the positions of the objects are known, subsequent operations can be performed—such as controlling a vehicle to move toward the detected target using OpenMV, enabling a drone to land at a specific location, or directing a robotic arm to grasp a particular target object.
The FOMO model is a model specially designed by EdgeImpulse for microcontroller environments; unlike conventional object detection, it can only detect the positions and count of multiple objects, but cannot obtain their exact dimensions.
The underlying principle of the FOMO model is exceedingly simple and flexible. It first divides the image into patches, each measuring 8×8 pixels. For an image with a resolution of 96×96, this yields a grid of 12×12 cells; for an image with a resolution of 360×360, it yields a grid of 40×40 cells. Image classification is then performed independently on each cell.
FOMO significantly outperforms YOLO V5 or MobileNet SSD in detecting numerous small objects. FOMO object point detection is 30 times faster than MobileNet SSD.
FOMO performs better when the objects to be detected are of similar sizes—for instance, when the markers you aim to identify have roughly comparable dimensions, rather than varying significantly in size.
OpenMV uses EdgeImpulse to train neural network object detection models online, which mainly involves the following steps: collecting and uploading the image dataset, labeling objects, training, testing the model, and deployment.
* Collecting the image dataset: Capturing images of specific objects in the actual environment where recognition will be performed. Images are collected in the same environment where recognition will occur, ensuring that the actual training environment closely matches the actual detection environment, thereby achieving better results.
* Annotation Target: Draw bounding boxes around each object to be detected in our dataset and associate each box with the corresponding object name, to facilitate subsequent training for object localization and classification.
* Training the Model: After annotation is completed, train the model using the convolutional neural network parameters designed by us.
* Test Model: We conduct testing using the trained model; if the performance is unsatisfactory, we correspondingly expand the training dataset or adjust the training parameters and continue training until we obtain a satisfactory model.
*Deployment: We can run the trained model file directly from the built-in USB drive of the OpenMV.
Below is a demonstration of the specific procedure:
01. Collect and upload the image dataset
I. First, log in to the website edgeimpulse.com, select “Log In”, enter the name of the newly created project, and select “Images” → “Classify Multiple Objects”

II. Select the image to upload. There are several ways to obtain the image dataset:
1. Capture images in real time using the OpenMV IDE. Use the “Dataset Editor” tool within the OpenMV IDE to create a new dataset and capture images in real time; for details, refer to our previous video tutorial on object classification and mask detection.

2. Images downloaded from the internet or captured directly using a mobile phone; preferably matching your actual detection environment. We have prepared approximately four to five hundred images of traffic signs, including “No Parking,” “No Honking,” and “Speed Limit 80 km/h,” all collected from real road conditions. This dataset is available for download on our GitHub repository and tutorial website.
02. Labeling Objectives
Upload approximately 100 images for each category; after uploading the images, proceed to annotate them by marking the positions and categories of the objects to be identified.


03. Train the Model
Configure the training parameters, change the resolution to 128×128, and select all default parameter settings; then click Save.

Generate features, where the three colors represent the three logos.

Configure the target detection training parameters. The default number of training epochs is 60, the learning rate is 0.001, and the validation set ratio is 20%. Enable data augmentation. For transfer learning, you may select the default MobileNetV2 0.35 or MobileNetV2 0.1. Note: SSD cannot be used, as it is not supported on OpenMV.
Select Start Training. The trained neural network model achieves an F1 Score of 91.2%; we can save the current version.

Select Storage, enter your description, and then select Save.

04. Deploying the Model
Export the trained model file. Only export the library; select OpenMV and click Build to begin deploying and exporting the model.

It will automatically download the exported model, which in this case is the model trained on our 300 images, thereby completing the entire training process.

05. Run the Model
Running the model on OpenMV:
Connect the OpenMV Plus, save the three trained files to the OpenMV’s built-in USB drive, and open the ei_object_detection.py file in the OpenMV IDE. Click Run, and the execution results will appear in the serial terminal.


This feature is also compatible with the OpenMV4. Since the OpenMV4 lacks external SDRAM and has less memory, we can reduce the model size to enable its operation on the OpenMV4.
There are two methods to reduce the model’s size:
I. Reduce the training resolution from 128×128 to 96×96.
II. Modify the transfer learning model used by changing MobileNetV2 0.35 to MobileNetV2 0.1.
Finally, place the trained new file into the OpenMV4 and run it.
The above is our target point detection tutorial. We look forward to your results!

AI Sentinel Based on OpenMV: Automatic Alert for Unsecured Key Locations
Automatically detects whether the door of a key location remains open for an extended period and issues timely alerts.

Personnel crossing the boundary triggers an alarm; OpenMV interprets the “sense of security boundary.”
Detects personnel or equipment crossing virtual perimeter lines.

“AI Urban Management Officer” is Here: An Automatic Vendors-Encroaching-on-Pavement Recognition System Built on OpenMV
Automatically identifies illegal street vending activities to support daily urban governance.

Improper Storage of Gas Cylinders? Use OpenMV to Automatically Trigger Hazard Warnings
Automatically identifies unauthorized placements of gas cylinders to proactively detect potential gas-related safety hazards.

Did you perform live-line work without wearing insulating gloves? OpenMV issues an immediate alert!
Automatically identifies whether workers are wearing insulating gloves to assist in safe operations.

Leverage the OpenMV smart camera to detect surface defects on aluminum plates in real time
Online identification of defects on aluminum plate surfaces, such as scratches and dents, to support quality control.