How to use Data Approximation for Computer Vision

Akruti Acharya
December 14, 2022
8 min read
blog image

This article is going to be a brief introduction to data approximation and it can be used to improve the training efficiency of your computer vision or machine learning models. 

What Is Data Approximation In Machine Learning?

Data approximation is the process of calculating approximate outcomes from existing data using mathematically sound methods. The machine learning algorithms need to be trained on data and this data defines the robustness of the machine learning algorithm. 

Many real-life problems, such as image classification, for example, can be formulated as SVM (support vector machine) or logistic regression problems. However, the number of features in such issues can be quite large, as can the volume of training data.  Tackling such large-scale problems frequently necessitates solving a large convex optimization problem, which can be impossible at times. Moreover, it is also expensive to store the data matrix in the memory and sometimes the data cannot even be loaded into the memory. 

Furthermore, the algorithms which use the original feature matrix directly to solve the learning problem have extremely large memory space and CPU power requirements. It is sometimes infeasible due to the huge sizes of the datasets and the number of learning instances that need to be run. 

One simple solution to deal with large-scale learning problems is to replace the data with a simple structure. We call this data approximation. 

How Can Data Approximation Be Used In Computer Vision Projects?

Data approximation can be used in computer vision projects which require large datasets or large-scale learning techniques. Many of the real-world applications that employ computer vision to monitor and respond to real-time data require a huge dataset and the ability to process large-scale learning. Some of these applications are:

Scale your annotation workflows and power your model performance with data-driven insights
medical banner

Autonomous Vehicles

Autonomous cars which entirely rely on cameras need to process image and video data and make decisions in real time. It has to make sure there are never any memory constraints and that the computation can be carried out at any time. Maybe not for all, but for some of the internal processes, data approximation can be used to make efficient and reliable decisions in real-time.

Applications Using Remote Sensing Technology

Applications like mineral mapping, agriculture, climate change monitoring, and wildlife tracking use images collected by satellites. These applications need to provide real-time reports for areas with complex feature distributions. Satellite images are very large and computationally expensive. Many of these organizations are set up in different parts of the world. So, it might not be feasible to build these applications given the storage constraints. Data approximation, which brings down the computational cost and makes the learning process simple, can help in building robust and efficient artificial intelligence applications. 

Traffic Monitoring

A large training dataset is used to access and anticipate traffic situations. Traffic data includes car count, frequency, and direction, obtained via surveillance cameras. This data comes daily and in streams. The computer vision algorithm has to make a lot of real-time decisions like counting the number of vehicles, distinguishing different kinds of vehicles in high-traffic circumstances, and using the information to optimize traffic management. Waiting times or dwell time tracking and traffic flows are also tracked as part of traffic monitoring. 

When to Use Data Approximation?

A simple solution when you are dealing with large-scale learning problems while training your computer vision model is to replace the data with simpler data that is close to the original. Once the data approximation has converted the data to a simpler version, it can then be run on learning algorithms, helping use available storage and memory more efficiently. 

Many efficient algorithms have been developed for the task of classification or regression. However, the complexity of these algorithms, when it is known, grows fast with the size of the dataset.

Data approximation can be considered for the following issues that you might face while working on your computer vision model:

Large Dataset

A large image or video dataset is not only difficult to process for large-scale learning but also difficult to curate and manage. For curating and managing image and video datasets, platforms like Encord are available. But still, it might be difficult to process. Hence, data approximation could help the algorithm to learn efficiently. This also makes the process less expensive for memory as well.

Needing to Solve Large Optimization Problems

Large-scale optimization problems are difficult to solve in terms of resources and efficiency. Continuous streams of images and video streams are some examples of where algorithms are needed to perform large-scale optimization. Data approximation can come in handy when dealing with such problems. It can make it easier to process these optimization problems and make the optimization more efficient.

Data Storage Challenges

When working on machine learning algorithms. especially those which involve images and videos in the learning process, there can be a lot of data generated. Also, in general, while working with large datasets, it also requires a lot of memory for large-scale learning. 

For example, the input data could be closed to a sparse matrix or a low-rank matrix, etc. If the data matrix has a simple structure then it is often possible to exploit that structure to decrease the 1 computational time and the memory needed to solve the problem. Data approximation helps us change our data to help in decreasing the memory needed to solve the problem.

How Can You Apply Data Approximation to Your Computer Vision Model?

Here are some of the data approximation techniques which are helpful for your computer vision project which uses a large dataset:

Thresholding

The thresholding technique is usually used for data approximation for solving large-scale sparse linear classification problems. The dataset is made sparse with appropriate thresholding levels to obtain memory saving and speedups without losing much of the performance. 

The thresholding method for data approximation can be used on top of any learning algorithm as a preprocessing step. One should keep in mind that you also need to determine the largest value of the threshold level under which a suboptimal solution can be obtained.

Low-Rank Approximation

Many large-scale computer vision problems involving massive amounts of data have been solved using low-rank approximation. The perturbed issues sometimes require substantially less computer work to solve by substituting the original matrices with estimated (low-rank) ones.

Low-rank approximation approaches have been demonstrated to be effective on a wide range of learning problems, including spectral partitioning for image and video segmentation. The low-rank approximation can also be used in kernel SVM learning which is very common in computer vision.

Usually in low-rank approximation, the original data matrix is directly replaced with the low-rank ones. Then a bound is provided on the error introduced by solving the perturbed problem compared to the solution of the original problem. 

Non-Negative Matrix Factorization

In this method of data approximation, the data is approximated as a product of two non-negative matrices. These two non-negative matrices could also be low-rank. The data approximation should be such that the norm of error is minimal. 

Feature Engineering

In this technique of data approximation, you create features from raw data. This helps the predictive models to deeply understand the dataset and perform well on unseen data. Feature engineering just like other data approximation methods needs to be adopted based on different datasets. 

Autoencoders are a fantastic example of feature engineering in computer vision since they automatically learn what kinds of features the model will grasp best. Since autoencoders input images and output the same image, the layers between them learn the latent representation of those images. Neural networks understand these hidden representations better and can be utilized to train superior models. 

Unlike these methods of data approximation, there are techniques that also reduce the data complexity. In these cases when data approximation does not change the shape of the original matrix, it makes it easier to work with the new features, the same as we would with the original data matrix.

What Are The Common Problems With Data Approximation For Computer Vision?

Simply replacing the original data with its approximation does allow a dramatic reduction in the computational effort required to solve the problem. However, we certainly lose some information about the original data. Furthermore, it does not guarantee that the corresponding solution is feasible for the original problem.

In order to deal with such issues, using robust optimization is proven to yield better results. With robust optimization, the approximation error made during the process is taken into account. The approximation error is considered an artificially introduced uncertainty on the original data. Then you can use robust optimization to obtain modified learning algorithms that are capable of handling the approximation error even in the worst-case scenario. This takes advantage of the simpler problem structure on the computational level. Also, it controls the noise. This approach has the advantage of saving on memory usage, increasing compute speed and delivering more reliable performance.

Scale your annotation workflows and power your model performance with data-driven insights
medical banner

Conclusion

In this article, we learned that the technique of data approximation is capable of solving large-scale optimization problems. It can be a powerful way to make large-scale computer vision projects more efficient, especially when you have huge datasets like video streams.

From remote sensing data analysis to traffic handling, all these complex problems can be optimized with data approximation. It can help you generate really robust models. The challenge is identifying when to use data approximation and using the right data approximation technique for a particular situation.

Resources for Learning More About Data Approximation

author-avatar-url
Written by Akruti Acharya
Akruti is a data scientist and technical content writer with a M.Sc. in Machine Learning & Artificial Intelligence from the University of Birmingham. She enjoys exploring new things and applying her technical and analytical skills to solve challenging problems and sharing her knowledge and... see more
View more posts
cta banner

Build better ML models with Encord

Get started today
cta banner

Discuss this blog on Slack

Join the Encord Developers community to discuss the latest in computer vision, machine learning, and data-centric AI

Join the community

Software To Help You Turn Your Data Into AI

Forget fragmented workflows, annotation tools, and Notebooks for building AI applications. Encord Data Engine accelerates every step of taking your model into production.