Edge Impulse logo
Blog Post

Weighted Sums and Green Thumbs: Analyzing Crops in Remote Greenhouses with ML and IoT

TinyML, Machine Learning, Computer VisionThis greenhouse system uses machine learning and the IoT to help grow food in remote greenhouses.

Nick Bild

July 30, 2022

    If you are in need of an Internet connection, then a greenhouse may not be the best place to go looking for one. Greenhouses support agricultural operations of all sizes around the world, so many of them happen to be in remote areas. These locations are frequently without WiFi connectivity and even electricity. Since greenhouses are an important part of producing food to feed the surrounding community, it is important to keep an eye out for plant diseases and pests that can ruin the crop. Machine learning approaches have gone a long way towards avoiding such problems, but without WiFi or power, most devices either will not work, or cannot report the problems that they find.

    To support greenhouses in remote or otherwise unconnected areas, a new approach is needed. Fortunately, machine learning enthusiast Gerrit Niezen has been working on exactly this problem. He has leveraged a low-power microcontroller and the Edge Impulse machine learning platform to create a device that can monitor for problems — and report the results — for extended periods of time without either WiFi connectivity or mains power availability.

    Device mounted in a greenhouse over a row of tomatoes

    Niezen’s idea was to use computer vision to capture images of plants in the greenhouse and classify them to identify any areas of concern. The low-power, high-performance Sony Spresense development board was chosen, along with a Spresense camera to capture images. The Spresense can be put into a deep sleep state when not in operation so that a battery can last for weeks, or even months between charges. It also has a six-core CPU and 1.5 MB of SRAM to run machine learning algorithms on-device, which eliminates the need for cloud computing resources. Finally, a Spresense LTE extension board was added in to allow the device to report any problems that need attention over cellular networks — no WiFi necessary.

    Sony Spresense mounted in a 3D-printed case

    These components were assembled then placed inside a custom, 3D-printed enclosure that is designed to hang from the ceiling of a greenhouse where it can get a good view of everything inside. With the hardware all squared away, it was time to move on to building the machine learning model to power it. Samples of plant diseases and pest infestations were needed to train the model, and fortunately the New Plant Diseases Dataset was available to fill this need. Niezen uploaded 23,000 images from this dataset that represent healthy plants and nine abnormal conditions (bacterial spot, early blight, late blight, leaf mold, leaf spot, mosaic virus, spider mites, target spot, yellow leaf curl virus) to Edge Impulse.

    An impulse was created to preprocess the image data to extract the most important features and reduce the amount of computational resources that will be required, which is critical when both connectivity and power are in short supply. These features were then fed into a classification algorithm that can identify if any concerning conditions are detected in the greenhouse’s plants. The model was trained on the New Plant Diseases Dataset, then evaluated for accuracy. Everything checked out, so Niezen deployed the full machine learning pipeline to the Spresense with a few clicks of the mouse.

    A simple dashboard showing observation results

    The pipeline was deployed from Edge Impulse as an Arduino library so that Niezen could incorporate it into a sketch containing the logic for reporting issues via cellular networks. He sent these notifications as JSON data structures to a web API that he created. Once the data is stored there, it could in theory be used to power a web dashboard, or even send notifications to the farmer’s phone.

    Niezen installed his device at a local community supported agriculture operation that was located in an area with limited connectivity. Since then, it has been waking up every three hours to make sure everything looks good before going back into a deep sleep to conserve battery power.

    With minimal changes, this method could be adapted to detect other plant diseases. Or, a network of devices of this sort could be deployed to monitor larger farming operations. To learn how this work might help enhance your agricultural operations, take a look at the project write-up.

    Want to see Edge Impulse in action? Schedule a demo today. 


    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter