Dilepix Precision Agriculture

How long does it take to create a neural network in agriculture?

Photo de
Pierre Chatelain 20 January 2021

Artificial intelligence is driving a new era of precision farming. Through high-speed and high-quality analysis of agronomic images, neural networks provide farmers with valuable data that they would not otherwise have access to.

 

 

 

Aware of the advantages that artificial intelligence can bring you, you have decided to embark on a project for the automatic detection of a situation in livestock or crop production. This decision will allow your company to save precious time and give you a real competitive advantage...

But before you start, do you have an estimate of the time needed to develop your project? Do you know how long it will take to train the neural network that will help you so much on a daily basis? Are you available and organized enough to provide the images on which the algorithms will be trained? If it is still a bit unclear to you, we will try and shed some light on the issue by discussing in this article the time needed for the different steps leading to the creation of a neural network dedicated to the agronomic analysis of images.

 

What are the main stages in the building process of a neural network?

There are three main stages in the development of a neural network:

  • the building of an image database that will be used for training and evaluation of the network,
  • the choice of a neural network architecture,
  • the training of the network using the database.

Choosing an architecture may seem complex to novice users/beginners, but it is perhaps the least time-consuming step. Indeed, there are a number of reference models that have proven their effectiveness, and which can be used as a starting point to build various applications. For example, the same architecture could be used for weed detection in crops, to detect the presence of an insect pest in a trap, or to count fruits in a tree. The network's specialization will come from its training based on data sets created for each need/requirement. The time spent choosing an architecture can thus be shared between several applications.

The most time-consuming steps are therefore the building of an image database and the training of the network.

 

Data acquisition: a fundamental step in building a neural network

This is a step often neglected when embarking on a machine learning project. And yet it is the most tedious if you are not well prepared. The training of a neural network requires a large number of images, but above all a set of high-quality images, representative of what will be observed when using the neural network.

 

Quality images from all angles

A neural network learns to reproduce expected results based on selected images and features. It is therefore important that it be presented/fed with a variety of images/features that represent all the situations that could be encountered in practice.

Let's take the example of a neural network that would have been trained to recognize an object only on a clear day, and that makes a mistake as soon as the sky is overcast. This kind of situation can be avoided by carefully planning the training data acquisition, which anticipates all situations and covers every use case. For weed detection, for example, care should be taken to obtain images of plants at different growth stages, under different lighting conditions and in different soil types.

acquisitions-donnees-intelligence-artificielle-dilepix

One consequence of this constraint is that the building of the training database must be planned sufficiently in advance to allow time to collect images in all required conditions. The time needed then strongly depends on the nature of the project.

For example, if the goal is to develop a database containing images of a crop at all growth stages, the database will take at least one season to build. However, if the project focuses on a specific stage of crop development, the acquisition campaign may be shorter and more precise. In all cases, it is essential to anticipate in order to capture maximum variability in the first acquisition campaign and avoid having to repeat several acquisition-training cycles before reaching the desired performance.

 

Image annotations, time to spare

Images are only part of the data needed to train a neural network. For so-called supervised learning, network training also requires annotations that indicate expected features on training images. Data preparation and in particular image annotations can take several forms, more or less detailed:

 

  • For image classification, the annotation is simply a label among a predefined list. For example, for disease recognition in viticulture, each photo will be labelled as "healthy" or with the corresponding disease. This is the simplest form of annotation, and the quickest one to carry out.

  • For objects detection, the annotation should provide the position of the objects in the image. The most commonly used method is to define a "bounding box" for each object in the image, i.e. the smallest rectangle that contains the object. These annotations take longer to produce, since the rectangle must be drawn for each object in the image.

  • For even more precision, one may wish to have a precise delineation of the objects. This type of annotation provides more information but is very tedious to perform manually.

 

annotations-images-agricultures-dilepix_EN

Without a well-defined process, image annotation can monopolize most of the time spent on a project. Annotation is so time-consuming and technical that some companies do not hesitate to outsource this task. Others prefer to manage the annotation process in-house in order to better control data quality.

This second option is preferable when expertise is required for image interpretation. In this case, it is essential to provide the necessary annotation infrastructure and human resources to avoid the annotation phase becoming the bottleneck in the solution development. To meet this high level of quality, Dilepix has developed its own internal annotation tools specializing in agronomic issues.

 

 

Neural network training time

Once the image database is collected and annotated, the neural network must be trained. Training consists of varying the millions of parameters of the network until its output is as close as possible to the expected result. The time needed to reach the desired result depends on the initial value of the parameters: algorithm used to update them, size of the database, and finally computing power.

For the sake of argument, let's take the example of ImageNet, this bank of 14 million annotated images has been used for machine learning research since 2010. According to the results of Stanford University's DAWNBench competition in 2017, it took two days to achieve 93% accuracy on ImageNet, compared to nine minutes in 2018 and 2 minutes in 2019.

Please note that these performances are records obtained on the current best graphics computers. With a simple graphics card, this would take about two weeks.

However, it is possible to reduce training time by changing the initialization of network parameters. For a "complete" training, the parameters are initialized randomly: the network has no a priori information. But if you have a neural network already trained for a specific task, you can reuse it as a starting point to train it for another task. This is called transfer learning. For example, you can use a network already trained on ImageNet, and adapt its settings to perform a new, more specialized task, such as weed recognition. The network will already have learned from the 14 million images in ImageNet to extract shapes, textures and objects. Adjusting it to differentiate between different plant species will be much faster than starting from scratch.

 


In conclusion, the time needed to build a neural network must be estimated taking into account the different stages of its construction:

  1. Creation of an image database, 
  2. Image annotation, 
  3. Training of the neural network. 

While the actual training time mainly depends on technical means, it is more difficult to estimate the time needed for image acquisition and annotation. These steps require expertise and careful planning to avoid disappointment.

đź’ˇ As you will have understood, the time needed to build a neural network will also depend on you. Indeed, as part of the development of your project, you will have to provide a large number of images taken from different angles and at different times. This step may take some time if it has not been prepared sufficiently in advance. It is therefore important to plan the acquisition of this data. The more prepared and organized this step is, the shorter the training time of your neural network will be.

Because your project cannot be improvised, Dilepix experts will remain by your side to advise and support you every step of the way.

Photo de

Articles de Pierre Chatelain

Pierre is an expert in machine learning, image analysis and robotics. Before joining the Dilepix "Vision" team, he graduated with a doctorate from the Université de Rennes 1 and the Technical University of Munich, and worked as a postdoctoral researcher at the University of Oxford. At Dilepix, he develops image and video analysis algorithms applied to agriculture.

En savoir plus

Découvrir les possibilités apportées par l’Intelligence Artificielle & la vision par ordinateur

J'ai un projet

D'autres articles sur le sujet

How is agricultural data processed in the cloud?

Today, the Cloud is an integral part of our daily lives. We use it as soon as we check our emails and each user can access...

Why does AI generate so much enthusiasm in...

Better known for its use in crop production, Artificial Intelligence is now making its way into livestock buildings......