Control of an intelligent car based on OpenMV perception

. This project presents an intelligent car system based on machine vision, which enables the car to perform a series of tasks through visual perception. The project utilizes an OpenMV camera and an Arduino microcontroller board, where the OpenMV camera captures and preprocesses images, and the processed data is then transmitted to the Arduino for further processing and recognition. In addition, the project incorporates the GoogleNet network for training and classifying the preprocessed images. The network is used to recognize common objects, and the model is optimized and tested accordingly. The results demonstrate a high accuracy in image recognition, making it applicable to visual perception in vehicles


Introduction
With the increasing number of automobile users in the 21st century, issues such as traffic congestion and safety accidents have become more prominent in road traffic.With the support of Internet of Vehicles (IoV) technology and artificial intelligence (AI) technology, autonomous driving technology can effectively coordinate travel paths and optimize itinerary planning, thereby greatly improving travel efficiency and reducing energy consumption to some extent.From a policy perspective, since 2022, various regions have continuously opened test roads for autonomous driving, and the Ministry of Industry and Information Technology has continuously improved relevant systems, which has laid a good foundation for the development of intelligent vehicles.With the continuous promotion of policy improvement, it is expected that the domestic intelligence rate will continue to increase rapidly [1].

Advancements in Intelligent Traffic Systems
In recent years, with the rapid development of urbanization, the number of motor vehicles has been increasing, which has not only brought great pressure to traffic management departments but also increased the risk of traffic accidents.Intelligent vehicles based on camera perception can perceive and analyze their surrounding environment through computer vision technology, thereby achieving precise recognition and control of target objects, thereby improving transportation efficiency and safety [2] .

Providing Technological Support and Application Scenarios for Innovation in Intelligent Traffic
For example, in the field of urban express delivery, intelligent vehicles use machine vision technology to achieve autonomous recognition and delivery, thereby improving the efficiency and accuracy of express delivery.In intelligent parking management, intelligent vehicles can use machine vision technology to automatically find parking spaces, reducing the time and cost of searching for parking spaces.

Algorithms Used in Autonomous Driving Research Status of Image Recognition in Autonomous Driving
Deep learning-based image recognition, which extracts features for classification, has the characteristics of high recognition rate and strong robustness [3].Compared to traditional methods, Convolutional Neural Networks (CNNs) have many advantages in object recognition.With the advancement of hardware technology and the application of parallel computing tools such as graphics processors, the training and inference speed of CNNs have been significantly improved, making it one of the main methods for object recognition in the field of computer vision.
Neural Networks Used in Autonomous Driving GoogleNet, proposed in 2014, is a 22-layer deep network that achieved significant improvements compared to the award-winning networks ZFNet in 2013 and AlexNet in 2012.Deep learning networks contain more parameters and are more prone to overfitting.Increasing the network size also increases the use of computational resources.To address these issues, GoogleNet uses 1x1 convolution kernels for dimensionality reduction, thereby further reducing computational complexity.Instead of using fully connected layers, GoogleNet uses global average pooling at the end of the network [4~6].
Inception is a method that combines multiple convolution and pooling operations into network modules to assemble the entire neural network structure on a module basis.GoogleNet is composed of multiple inception modules, which allows for deeper networks.The reduced-dimension inception block typically includes 1x1 convolution, 3x3 convolution, 5x5 convolution, and 3x3 max pooling, all of which are stacked together at the output from the previous iteration.

Research Content
This project aims to achieve route control of an intelligent vehicle through obstacle avoidance and decision planning.Specifically, the research will focus on the following aspects:

Using a Camera Image Sensor for Signal Transmission
OpenMV Camera integration: The intelligent obstacle avoidance vehicle designed in this project utilizes the OpenMV module for digital recognition, which is a convenient, low-power, and high-efficiency vision module.In the field of machine vision, OpenMV uses an embedded solution based on the STM32H743VI microcontroller, combining a high-definition camera module (OV7725) with a Python-driven machine vision module [7~9].In this experiment, we will use OpenMV to control Arduino for vehicle control.

Using a Camera Image Sensor for Signal Transmission
Using GoogleNet convolutional neural network for image recognition.GoogleNet is a deep learning-based image recognition model, also known as Inception V1 [10].
First, we will build the framework of the vehicle.To achieve intelligent obstacle avoidance control based on camera perception, we will build a two-wheeled differential drive vehicle platform.
The vehicle will be equipped with an OpenMV as a vision sensor, capturing environmental image information in front of the vehicle.The control system of the vehicle is based on the STM32 microcontroller, which can recognize obstacles in front of the vehicle based on the image data obtained from OpenMV and perform obstacle avoidance control.Specifically, the mechanical structure of the vehicle includes two drive wheels, one omni-directional wheel, and the vehicle body.The drive wheels, driven by two DC reduction motors, can control the forward, backward, and turning motions of the vehicle.The omni-directional wheel ensures the stability of the vehicle.

Obstacle Avoidance Control
We have chosen an obstacle avoidance control method for intelligent vehicle based on convolutional neural network and PID control.We use the convolutional neural network to detect obstacles in the images and identify their types and orientations.The detection results and the current state of the vehicle are fed into the PID control algorithm to generate the obstacle avoidance control output.We have built a road obstacle dataset with multiple images of different types and corresponding annotations to train the neural network.
After customization, fine-tuning, and testing, the network is able to detect common obstacles that we have trained it on, such as cups, traffic cones, and achieve an accuracy rate of over 90%.Based on the orientation and type of the obstacles, the vehicle will generate a practical obstacle avoidance path.With the help of the line tracking module, the intelligent vehicle we have built can drive following the designated route effectively.The car model is designed as depicted in the above diagram.It is equipped with a motor driver board, an Arduino development board, and an OpenMV visual recognition module.The model adopts a two-wheel drive system with differential steering.The PID algorithm is implemented on the model to calculate the required drive speed to reach the target and output PWM values to control the car's rotation speed.

Line Following Mode
In the line following mode, the OpenMV is programmed to recognize the predicted horizontal offset and vertical deviation angle of a black line segment captured within the camera's image range.The OpenMV sends the line segment signal to the Arduino main controller, which then makes corresponding decisions.By fine-tuning the steering sensitivity and feedback coefficients, the car can achieve effective line following performance.

Dynamic Object Recognition
Based on the visual recognition model installed, when the car identifies an object with the label "dynamic object" (in the experiment, different cups were used as substitutes for actual objects), the car executes a stop command to prevent accidents caused by the unpredictable trajectory of dynamic objects.

Static Object Recognition
Based on the visual recognition model installed, when the car identifies an object with the label "static object" (in the experiment, different cups were used as substitutes for actual objects), the car executes a detour command to avoid staying near static objects, thereby maintaining high efficiency in its movement.

Test Results
Our method was tested under various obstacles and scenes (indoor and outdoor) to evaluate its robustness and generalization ability.To objectively measure the performance of the neural network's detection and recognition results, we designed a set of evaluation metrics.After conducting multiple tests and analyzing the results against each metric, we obtained the following table.The measurement approach for accuracy involves calculating the ratio of the difference between the programmed recognition distance and the actual recognition distance to the programmed distance.The tracking rate is determined by the deviation between the predefined trajectory (standard straight line) of the car and the actual motion trajectory, with the score being the arithmetic average of the two.
Through multiple experiments and tests, we have verified the performance of the intelligent obstacle avoidance system for our small car.In numerous trials, our intelligent car achieved an average obstacle recognition accuracy of over 92% and an average obstacle avoidance tracking rate close to 90%.It was able to detect obstacles within a range of 15 cm and initiate deceleration, stopping, or turning to avoid them.This demonstrates the effectiveness of our proposed solution, which can meet practical application requirements.The system performs stably in general indoor environments, although its performance slightly declines under complex lighting conditions such as nighttime or low light.9. Discussion 1) Adoption of a convolutional neural network enables the detection and recognition of a wider range of obstacle types and provides more accurate obstacle information output.
2) The dataset we constructed provides abundant data for training, resulting in higher recognition accuracy.
3) The series of evaluation metrics we designed can comprehensively and accurately assess the system's performance.
In summary, we propose an obstacle avoidance control method for intelligent cars based on convolutional neural networks, which enables fast, accurate, and high-performance obstacle avoidance in complex environments.This method holds certain reference value for the future applications of autonomous vehicles.

Conclusion
In this study, we proposed an obstacle avoidance system for intelligent cars based on OpenMV and Arduino.The system utilizes the OpenMV camera to capture environmental images and performs image processing and obstacle detection using OpenMV.The Arduino is used to control the car's motion to achieve obstacle avoidance.Through this project, we familiarized ourselves with the image processing capabilities of OpenMV, learned about the control knowledge for intelligent cars, and effectively combined the two to create an autonomous obstacle avoidance intelligent car.
Although there are still some limitations in the current system, such as insufficient robustness in recognizing and positioning objects in complex environments, and relatively simple control strategies, the entire solution demonstrates the feasibility of intelligent cars based on visual perception and embedded control.

Figure 1 .
Figure 1.Information Transmission Flow Chart when the Vehicle Encounters Environmental Changes.

Figure 2 .
Figure 2. Physical Image of the Car.

Figure 3 .
Figure 3. Process Diagram of Car Tracking.

Figure 4 .
Figure 4. Car Executes Stop Command upon Recognizing Dynamic Object.

Figure 5 .
Figure 5. Car Executes Detour Command upon Recognizing Static Object.

Table 1 .
Evaluation of Vehicle-mounted Model.