Embedded vision prototype for livestock weight monitoring - Lemberg Solutions

Embedded vision prototype for livestock weight monitoring

An automated system for pig-weight monitoring based on image recognition with the help of computer vision and non-iterative neural networks

Full case study in PDF
About the client

Barkom Ltd. is a Ukrainian agricultural company that specializes in growing pigs and cattle, as well as selling self-produced food products.

The challenge

Weight is an important indicator of a pig’s health, which makes regular weight monitoring vital to pig farming. But manual weighing is labor-intensive, especially on large farms; it takes multiple people and many hours to weigh animals one by one — and doing so daily expands that effort dramatically. This issue prompted Barkom to find a solution for automated, remote, and daily pig-weight monitoring.

Delivered value

Our team of data scientists and embedded engineers have designed and built a computer vision-based prototype for automated weight monitoring in pig farms. Based on a set of non-iterative neural networks and an innovative image recognition algorithm, our prototype allows visual estimation of an animal's weight.

The work is still in progress for this project, as we’re improving the prototype to make it into an easy-to-use handheld device. 

The process

This prototype is a first-of-its-kind system, which means that we didn’t have many market references and acquired most of the necessary knowledge through trial and error.

The main challenge we came up against was a complete absence of training data. That’s why our first step was to build a hardware data collection system to place on the farm. The system included regular scales with two stereo cameras attached above the pig.

Our vision was, when a pig stepped on the scales, the cameras would take an image of the pig’s back. Then, the weight from the scales would be automatically assigned to the image, and we would have an image-weight record in the database. With enough records of this kind, we would be able to build a weight recognition algorithm. However, the first prototype was stationary and worked effectively only from a specified height of the stand with the cameras.

While working on the hardware, we discovered more challenges, like pigs sleeping on the scales, multiple pigs stepping on the scales at the same time, feces that covered the scales, light reflecting into the cameras and distorting images, etc.

Once the hardware was ready, our data scientists started working on the weight recognition algorithm. We tried several approaches, including neural networks and mathematical modeling, and in the end our engineers settled on a set of non-iterative neural networks combined with a custom image recognition algorithm. This approach provides a near-98% recognition accuracy on manually cleaned and pre-processed data.

Our next step was to make a second prototype that, unlike the first one, would be portable and more convenient. Our engineers added a height sensor and camera stabilizer. Both prototypes use high energy consumption lighting and passive 3D cameras to increase the quality of the images.

The first two prototypes were sensitive to lighting conditions, meaning that different light levels equaled different weighing results. The LS team couldn't resolve this issue by providing sufficient light since it would have increased the device's weight and required more energy. So, we decided to change the existing camera to a passive stereo vision camera Stereolabs, which worked in the RGB spectrum, and a stereo camera Intel RealSense D435, which was sensitive to the infrared spectrum. In this way, the third prototype of the device could efficiently operate in poor lighting conditions and provide high-quality images to the neural network. Now, the ML model doesn’t need to rely on a pig’s color or breed to know that it sees a pig; instead, the newly added camera allows the neural network to identify a pig’s body shape and weight in low light conditions.

In the ongoing project development phase of the third prototype, we are focusing on automatization to make the device save the client's time and money. Our data science engineers are working on a filter based on a neural network that automatically recognizes whether a pig's image is suitable for accurate weighing and screens out the cases when a pig is in the wrong position. The LS team also aims to make the device convenient for use in field conditions by improving the algorithand teaching it to recognize a pig's weight from any height. This time, the ML model has to be retrained to work with the data collected from a portable device.

With the development of the third portable prototype, farmers will be able to weigh pigs even faster than originally possible with the first and second prototypes. 

Technologies
Python
C++
OpenCV
Convolutional Neural Network
TensorFlow
SGTM neural networks library
NVIDIA Jetson
Intel RealSense
Industries
Embedded vision prototype for livestock weight monitoring - Lemberg Solutions
Embedded vision prototype for livestock weight monitoring - Lemberg Solutions
Embedded vision prototype for livestock weight monitoring - Lemberg Solutions

How it works

Embedded vision prototype for livestock weight monitoring - How it works - Lemberg Solutions
Embedded vision prototype for livestock weight monitoring - Lemberg Solutions
INTERESTED IN THIS CASE STUDY?
Download the full case study in PDF to save it for later.