Rapid growth in the number of vehicles in urban areas often leads to prolonged traffic congestion, especially at intersections and major roads. This congestion not only creates time and cost problems, but also adversely affects the environment through increased exhaust emissions. Effective traffic management requires accurate and continuous monitoring of the volume and type of vehicles crossing critical points.
Artificial intelligence (AI) technology has become a promising solution in traffic monitoring. With the ability to detect, classify, and count the number of vehicles in real-time, AI-based systems can provide richer and more efficient data than conventional manual or sensor-based methods. However, energy challenges are often an obstacle, especially in locations that do not have direct access to electricity.
To overcome this obstacle, this research develops an AI-based vehicle detection system powered by renewable energy sources in the form of solar panels. The system is designed to be placed at traffic congestion points to detect and count motorized vehicles such as cars and motorcycles. The use of solar energy ensures that the system can operate autonomously without dependence on conventional electrical power sources, making it suitable for applications in various locations, including remote areas.
This research not only focuses on developing an efficient system, but also emphasizes the aspects of energy sustainability and the relevance of technology in supporting smart city infrastructure. The data obtained from the system is expected to be used to optimize traffic management and design solutions to reduce congestion, as well as identify traffic trends useful for authorities.
solution OverviewThis project is made utilizing AI to detect cars and motorcycles at congestion points, after detecting, calculations are carried out, after detecting, calculations are carried out using the virtual loop method, the calculation data will be entered into the memory card for analysis so that it can be used to solve congestion problems.
The source of electricity obtained through the solar panel plate, the power obtained is stored in the lippo battery, which manages it all DF Robbot Power Manger 5V
Create Data ModelIn utilizing AI, a dataset (a set of data has gone through the filtering process) is needed, this project uses a dataset found in robflow https://universe.roboflow.com/motorxcar/motorxcar this dataset has 3 classes (cars, motorcycles, tricycles) these 3 classes are included in the training data settings in google colab cannot leave these three, otherwise it will show an error message
in the process of training the dataset into a data model o followed the documentatio from wiki seeedstudio
in setting the height and width has a defalut setting of 192x192 you can aslo change to 220x220 and should not exceed 240x240
method Virtual Loop For Countingsystem to count moving vehicles from surveillance videos, moving vehicle image is extracted using „double difference image „algorithm and counting is accomplished by tracking vehicle movements within a virtual loop area with the help of detection lines. The system works in 5 steps, as shown in Figure 1. All steps will be described in following sections.
#define carCountMax 9999
#define motorCountMax 9999
int carCount = 0;
int motorCount = 0;
int xCarBegin = 0;
int xCarEnd = 0;
int xMotorBegin = 0;
int xMotorEnd = 0;
// Loop parameters car
bool loopOccupiedCar = false;
bool loopOccupiedPreviousCar = false;
int loopxMinCar = 20;
int loopxMaxCar = 200;
// Loop parameters motor
bool loopOccupiedMotor = false;
bool loopOccupiedPreviousMotor = false;
int loopxMinMotor = 30;
int loopxMaxMotor = 180;
SSCMA AI;
void checkAIBox() {
if (!AI.invoke()) {
if (AI.boxes().size() > 0) {
for (int i = 0; i < AI.boxes().size(); i++) {
int boxX = AI.boxes()[i].x;
int boxW = AI.boxes()[i].w;
int xBegin = boxX;
int xEnd = xBegin + boxW;
if (boxW > 50) {
xCarBegin = xBegin;
xCarEnd = xEnd;
if ((xCarBegin > loopxMinCar) && (xCarEnd < loopxMaxCar)) {
loopOccupiedCar = true;
if (!loopOccupiedPreviousCar) {
carCount++;
if (carCount > carCountMax) {
carCount = carCountMax;
}
loopOccupiedPreviousCar = true;
}
} else {
loopOccupiedCar = false;
loopOccupiedPreviousCar = false;
}
} else {
xMotorBegin = xBegin;
xMotorEnd = xEnd;
if ((xMotorBegin > loopxMinMotor) && (xMotorEnd < loopxMaxMotor)) {
loopOccupiedMotor = true;
if (!loopOccupiedPreviousMotor) {
motorCount++;
if (motorCount > motorCountMax) {
motorCount = motorCountMax;
}
loopOccupiedPreviousMotor = true;
}
} else {
loopOccupiedMotor = false;
loopOccupiedPreviousMotor = false;
}
}
}
} else {
loopOccupiedPreviousCar = false;
loopOccupiedPreviousMotor = false;
}
}
}
Save Data
the data to be saved consist of time, number of motorcycles, number of cars every 30 minutes, when the data has been saved, the calculation will return to 0, the file is saved in the form of a.csv file so that it can be imported into the analysis tool.
Comments