AI assists in locating hidden farms

In many countries, it is difficult for government agencies to know where animal farms are located. Using satellite imaging and deep learning provides a new, effective, accurate and low-cost approach for detecting these facilities.

The trend in livestock production is to raise large numbers of animals in confinement1. These facilities, or ‘concentrated animal feeding operations’ (CAFOs), produce more than 40% of US livestock2. Concentration increases productivity, but also raises significant questions about environmental impacts (climate change, air quality, water pollution, biodiversity loss, land degradation, zoonoses and so on)3. Significantly, many of these environmental problems are caused by improper management of animal dejections. The US Environmental Protection Agency (EPA) estimates that 60% of CAFOs do not hold permits for discharging their pollutants4, and the US Government Accountability Office (GAO) complains about the lack of CAFO location data5. This information is critical for assessing manure generation and other forms of environmental non-compliance, but also for the design and implementation of mitigation policy approaches. Ho and Handan-Nader show how CAFO location can be predicted by means of satellite imaging and a modern computer-vision-based technique called deep learning. Several applications of deep learning to agriculture have already been described6, but this use in environmental regulation represents an important novelty.

Swine CAFOs in North Carolina have very distinctive features, such as long barns, and massive pools for the treatment of pig slurries. Credit: Water Keeper Alliance

The Article focuses on swine and poultry operations in the US state of North Carolina, where CAFOs are largely unpermitted and, therefore, environmental non-compliance is significantly harder to detect. The authors trained two convolutional neural networks (CNNs): one to detect the presence of swine CAFOs, and the other to the presence of poultry CAFOs. They obtained high classification accuracies of 99%, meaning that the prediction of the model for a CAFO location is within 250 m of the actual location in 99% of the cases. CNNs constitute a sub-category of deep-learning models, consisting of an input layer, an output layer and various hidden layers7. Some of these layers are convolutional, using a mathematical model to pass on results to successive layers. Convolution is a mathematical way of combining (or cross-correlating) two functions to form a third function. CNNs are a special category of neural network that have proven very effective in areas such as image recognition and classification.

The authors used publicly available high-resolution satellite images from the US Department of Agriculture National Agricultural Imagery Program (NAIP). The images used had a resolution of 1 metre per pixel, covering 299×299 metres of geographical area per image. CNNs use supervised learning in order to be trained to correctly classify elements of interest in pictures. Accordingly, during the training phase, CNN requires labelled datasets. In this study, such labels were ‘swine CAFOs’, ‘poultry CAFOs’, or ‘no CAFOs’ (control images). The 24,440 images of North Carolina were manually labelled, by hand-validating a manual census conducted by two leading environmental interest groups (EIGs). A quarter of the hand-validated images was reserved to verify the accuracy of the model.

This research applied a well-known CNN technique and architecture based on the Inception V3 model8, into an important agricultural sector in terms of economic and environmental impacts. The authors showed how satellite imagery with deep learning can contribute to environmental policy-making and regulation enforcement. The technical implementation has additional interesting novelties, such as the utilization of ‘class activation maps’, which depict which pixels activate the predicted CAFO classes. These pixels are then used to re-centre the CAFO images and re-classify them, in a (successful) effort to increase the overall accuracy of the model. Activation maps are also used to cluster the activated pixels in the re-centred image, representing the CAFO facility as a polygon shape, using the polygon centre as the point location. The end result is a list of latitudes and longitudes for (predicted) poultry facilities. Impressively, although the model missed 172 CAFOs that were manually detected by EIGs (the 1% error of classification), it also detected an additional 589 CAFOs that EIGs were unable to detect. These additional facilities represent a 15% gain from the manual census.

Compared to the existing manual census, which is very time-consuming, the proposed approach promises to save considerable resources. The class activation map approach can provide a meaningful measure of CAFO size, which is a critical dimension under federal law. Most importantly, this approach can facilitate identification of facilities that pose particular environmental risk due to proximity to water sources. Furthermore, abandoned CAFO sites may be cross-referenced with expired permit data to determine which facilities have undergone the appropriate clean-up procedures.

Finally, as the authors point out, although computer vision has been most rapidly adopted in the private sector, the public sector has been late to adopt artificial intelligence, creating a substantial technology gap. This paper shows why and how governments worldwide should adopt AI, especially for environmental policy.


  1. 1.

    Dimitri, C. et al. The 20th Century Transformation of US Agriculture and Farm Policy Economic Information Bulletin 3 (USDA, 2005).

  2. 2.

    Copeland, C. Animal Waste and Water Quality: EPA Regulation of Concentrated Animal Feeding Operations 367 (CAFOs) Tech Report CRS-RL31851 (Congressional Research Service, 2010).

  3. 3.

    Herrero, M. et al. Ann. Rev. Environ. Res. 40, 177–202 (2015).

    Article  Google Scholar 

  4. 4.

    National Pollutant Discharge Elimination System (NPDES) Concentrated Animal Feeding Operation (CAFO) Reporting Rule Federal Register 76 65431–65458 (Environmental Protection Agency, 2011).

  5. 5.

    Concentrated Animal Feeding Operations: EPA Needs More Information and a Clearly Defined Strategy to Protect Air and Water Quality from Pollutants of Concern Tech Report GAO-08-944 (US Government Accountability Office, 2008).

  6. 6.

    Kamilaris, A. & Prenafeta-Boldú, F. X. Computers Electron. Agricult. 147, 70–90 (2018).

    Article  Google Scholar 

  7. 7.

    Krizhevsky, A. et al. In Advances in Neural Information Processing Systems 1097–1105 (2012).

  8. 8.

    Szegedy, C. et al. Rethinking the inception architecture for computer vision. In Proc. IEEE Conf. Computer Vision Pattern Recog. (2016).

Download references

Author information



Corresponding authors

Correspondence to Francesc X. Prenafeta-Boldú or Andreas Kamilaris.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Prenafeta-Boldú, F.X., Kamilaris, A. AI assists in locating hidden farms. Nat Sustain 2, 262–263 (2019).

Download citation


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing