Computer Vision System for Monitoring Sports Facilities
Australian governments implement programs to develop and promote sports and an active and healthy lifestyle.
Municipalities support and co-finance sports organizations, clubs, and individuals. Local governments invest in sports facilities and sponsor sports events.
The City Council of a Western Australian township asked Integra Sources to develop software for monitoring sports fields. The city authorities administer sports grounds with lawns.
Their task is to monitor sports grounds, keep them in order, sow grass on time, prevent dogs from walking in the fields, etc.
The city administration also wants to track how actively people play sports to understand if additional sports grounds need to be built.
The city council needed to optimize data collection on the use of fields and determine the degree of lawn wear.
It was necessary to develop a system for counting the number of visits and monitoring what people do in the field.
The customer asked us to develop an analytics system based on computer vision algorithms. Modern technologies can help the municipality save money and get reliable information about the state of sports grounds.
First, the algorithms had to detect people and objects on the field, namely, where they are and what they are doing. After that, it was necessary to analyze the data and store it in a database for further use. The customer planned to use analytics for the following purposes:
- Predictive maintenance - analyze the condition of the field and predict when it should be sown.
- Statistics gathering - collect data about sports activities and demographics of people working out at the sports ground.
- Sports venue management - ensure safety, functionality, and aesthetics of the playing field.
Integra Sources started the project with research and development to determine the most suitable cameras to be used in the project. To cope with the tasks, we needed to use high-quality photos of sports grounds.
Three 4K cameras with a 60-degree angle of view are installed on high-mast lighting poles around the field and pointed to the left, right, and central parts of the stadium. The cameras periodically take photos of the venue.
The cameras can automatically switch between day and night modes. The system relies on RGB images for object detection during the daytime and detects objects in the infrared in the dark.
The scope of the project included the implementation of algorithms for detecting people, counting them, and determining the sport they play.
First, developers prepare a data set. They manually mark people on the available photo materials.
The data set is then loaded into the object detection framework. We train the framework so that the neural network can successfully find people in given images.
Once a picture is taken, it’s saved to a separate directory within a file system. Our dispatcher bots recognize changes and inform performer bots whenever a new image is downloaded.
In the next phase, we link the object's coordinates in the photo to the physical coordinates on the map.
When determining a person, we fix his coordinates in the image in pixels. Next, we compile a transformation matrix to bind the pixels to the physical coordinates.
We translate the data into coordinates on the map, focusing on the reference point of the mast on which the camera is installed.
Our neural networks recognize the images and save the results in a document database as real-world coordinates. Using them, the system can identify the exact location of an object and its behavior.
Reports stored in the document database contain information about the cameras (IDs) and detected objects (classes, types, or scores, the field coordinates, and GPS coordinates).
Integra Sources’ developers have created an algorithm for detecting targets on sports fields. Additionally, we made a heat map drawing, where the number of people was graded by color.
If too many people workout regularly at the stadium, some lawn areas may be heavily damaged. In this case, groundskeepers need to sow some grass on time.
Also, the systematic excess of the threshold number of people indicates the need to build an additional sports ground.
Major Issues Resolved
The major challenge of this project was detecting objects in a vast area—the dimensions of the playing field are 159 m x 136 m (521 ft x 446 ft).
In such a large area, people and other objects look like tiny dots, which makes it hard for neural networks to identify them.
To tackle this problem, we optimized the architecture of the networks and improved the detection accuracy.
For example, to recognize a target RGB image, we used a Gabor filter for texture analysis. This method helps filter out irrelevant textures, such as grass. It allows the system to focus on the target object, such as a player on the field.
Another significant challenge was in detecting people in densely packed scenes. In team sports, people interact with each other and are physically close. So they can merge into a single object, which is difficult to discern.
To cope with that, we enhanced the system’s architecture and implemented additional neural networks responsible for specific tasks. For example, one network deals with the detection of heads only.
After studying an array of scientific articles on the above problems, we performed experiments and tried different methods to improve the quality and accuracy of object and people detection.
The Scope of Work
- Research of algorithms for detecting objects
- Data preparation
- Data markup
- The algorithm construction and training
- Testing the algorithm
- Implementation of the algorithm in the client's business cycle
- Images are taken with cameras that have a 60-degree viewing angle and 4k resolution.
- We wrote the backend software in Python.
- The C++ language in a compartment with the OpenCV library has been used for algorithms converted from Python.
- RabbitMQ acts as a messaging broker to exchange data between the microservices, such as the system’s bots.
- The cross-platform document-oriented NoSQL database program MongoDB powers the document database built to store the results of the recognized images.
- With the help of the Vue.js framework, we built the web GUI for the frontend part of the system.
- We used the one-stage RetinaNet object detection model.
- We trained our machine learning algorithms and neural networks on the YOLOv5 object detection algorithm and the PyTorch machine learning framework.
Our developers created the recognition algorithm and provided it to the customer for testing.
The project is under further development. The next stage involves scaling the system to cover more fields.
We are going to develop an algorithm for the analysis of games that people play on sports fields. The algorithm should recognize the game according to patterns — for example, the placement and movement of people playing.
The system will be able to determine the sport from the list of activities it already knows.
Using our solution, the client receives up-to-date analytical information in real-time.
You might also like...
Cross-Platform Application Development for Forage Production Monitoring
Integra Sources has developed a monitoring system for agricultural facilities. The cross-platform mobile application receives, organizes, and transfers data to cloud services, providing the farmer with information 24/7 in real time.
Virtual Camera Driver and Desktop Application Development for macOS
The software team of Integra Sources developed a custom desktop application, as well as macOS video and audio drivers for the customer’s video streaming system based on a mobile application and a movement tracking device.