Mapping Brazil Nut Trees in the Amazon: How Drones and AI are Changing Conservation

Brazil nut trees hold a unique, protected status in Peru due to their ecological and economic significance. Unlike many crops, Brazil nut trees cannot be farmed—they require the rich biodiversity and healthy conditions of a mature Amazonian forest to produce nuts. Because of this dependency, these trees act as a bridge between conservation and local livelihoods: they offer a sustainable income source for families who depend on the forest, creating a powerful incentive for local people to maintain and protect the forest ecosystem. As one of the few species whose economic value is tied to conservation, Brazil nut trees encourage forest stewardship, helping to sustain the Amazon by aligning conservation efforts with the needs of the people who call it home.

In this post, I'll take you through my journey of using drones and machine learning—specifically, the YOLOv8 object detection and segmentation models to map Brazil nut trees from the air. With these tools, we’re finding ways to make forest management smarter, conservation more effective, and the future of Brazil nut trees a bit more secure.

An expansive aerial view of the Amazon rainforest canopy, showcasing its immense scale and density. Highlighted among the lush greenery, a few towering Brazil nut trees stand out—key players in both the forest ecosystem and local economies.

Why Brazil Nut Trees Matter

Brazil nut trees are more than just sources of income; they are keystone species in Amazonian ecology. They contribute to the rainforest's structural complexity, supporting countless animal species and indirectly aiding the global climate. For the local economy, these nuts are invaluable: just in 2019, Brazil nut exports from Peru reached about $35 million USD, supporting sustainable development across the region.

Demand and overharvesting have begun to strain natural regeneration of Brazil nut trees, leading to a demographic bottleneck as mature trees produce fewer seedlings. Developing drone technology to map and monitor Castañas can help not only in tracking the health of existing trees but also in supporting efforts to regenerate new Brazil nut seedlings in areas where natural regeneration is falling short. With precise mapping, we can identify and prioritize zones for regeneration, ensuring a sustainable population of Brazil nut trees and supporting the long term health of the Amazonian ecosystem.

The Potential of Drones in Conservation

Drones (also called unmanned aerial vehicles or UAVs) are changing the game for researchers in fields like forestry and ecology. Traditional forest mapping techniques require a lot of time and often only cover limited areas. But with drones, we can efficiently capture high-resolution imagery over vast areas, making it possible to get a bird’s eye view of individual tree species.

DJI Air 2S drone in action taking off to fly an automated mission over the Amazon canopy to capture high resolution images and map and monitor Brazil nut trees.

Drone view from 100 meters above ground, capturing two large Brazil nut trees (Castañas) standing out within the dense Amazon canopy. This perspective showcases the trees' unique structure, essential for monitoring and conservation efforts in the rainforest

Study Area: Finca Las Piedras Reserve in the Peruvian Amazon

In this study, data was collected at the Finca Las Piedras property, a 50-hectare reserve and research station operated by the Alliance for a Sustainable Amazon in Madre de Dios, Peru. This area, part of the Amazon rainforest, is home to around 60 to 70 Brazil nut trees (locally known as Castañas), which form a core aspect of both the research and conservation efforts on-site. The station supports a wide variety of flora and fauna and serves as a hub for ecological studies focused on sustainable land use and biodiversity preservation.

Finca las Piedras

54.24 Hectares

Automated Drone Mission Interface: A screenshot displaying the boundary of Finca Las Piedras Reserve, highlighting the area where drone missions were conducted to capture imagery of Castaña trees within the designated research site..

The Tech: Drones, Orthomosaics, and YOLOv8

For this study, I used a DJI Air 2S equipped with a high-resolution camera to capture clear imagery of the Amazon canopy. After each flight, the images were processed with OpenDroneMap (ODM) to create georeferenced 2D orthomosaics. This step stitches the images into a single, high-quality georeferenced image, giving us accurate spatial information to analyze.

From Images to Insight: Training the YOLOv8 Model

Simply having georeferenced orthomosaics isn’t enough. We needed a way to automatically identify Brazil nut trees in them. Enter YOLOv8, an object detection model that’s known for its speed and accuracy. YOLO (You Only Look Once) looks at an image just once to detect objects, making it ideal for large datasets like ours.

Training the model involved feeding it a series of annotated drone images and labeling the Brazil nut trees by hand. There are two types of models that require different styles of annotations that I worked with for this project: segmentation and detection. For segmentation, I drew polygons around the trees to capture their precise shapes, while for detection, I used bounding boxes to outline the trees more generally. To speed up the annotation process, we utilized the Roboflow platform, which streamlined our workflow and improved efficiency.

A split image showcasing two annotation techniques used in our study. The top section features the detection mask, which highlights a Brazil nut tree with a bounding box, indicating its general location. The bottom section presents the segmentation mask, where a detailed polygon is drawn around the tree, capturing its exact shape. These methods enhance the model's ability to accurately identify and differentiate between Brazil nut trees in various drone imagery.

A screenshot of the Roboflow interface, where I am annotating an image for a segmentation model. This intuitive platform allows for precise polygon drawing around Brazil nut trees, facilitating the creation of detailed segmentation masks essential for training our deep learning model. The user-friendly tools streamline the annotation process, significantly enhancing the efficiency of preparing our dataset.

To make the model robust, we applied data augmentation techniques, which involve making slight modifications to existing images to create new variations. Techniques such as flipping, rotating, and adding noise effectively generate additional data from our existing dataset. This not only increases the size of the training dataset but also introduces diversity, enabling the model to learn to recognize Brazil nut trees under different conditions and perspectives. Ultimately, this helps the model generalize better when encountering new images in real-world scenarios.

A rotated image from Roboflow showcasing the annotated Castaña tree, highlighting the segmentation mask used for precise identification of the tree within the drone image. This visualization emphasizes the importance of accurate annotations in training our model for effective detection and segmentation.

To facilitate the training of the model, I utilized Google Colab, a cloud-based platform that provides access to powerful computing resources. This approach allowed me to leverage high-performance GPUs without the need for expensive hardware, making the training process more efficient.

The training process was iterative, taking 300 epochs to refine the model's ability to accurately identify Brazil nut trees in various lighting, weather, and canopy conditions. An epoch refers to a complete pass through the entire training dataset, allowing the model to learn from the data. By training over multiple epochs, the model gradually improves its performance as it adjusts to the data.

Screenshot of the Google Colab notebook displaying the command to initiate the training process for the YOLO model. This command activates the training loop, leveraging cloud computing resources to refine the model's capability to detect and segment Brazil nut trees from drone imagery.

Throughout the training, I also worked with various parameters and hyperparameters. Parameters are the internal variables of the model that are learned from the training data, while hyperparameters are settings that are configured before the training process begins, such as learning rate and batch size. Properly tuning these hyperparameters is crucial as they can significantly impact the model's learning efficiency and accuracy.

Key Model Metrics and Mean Average Precision:

The mean Average Precision (mAP) is a critical metric in object detection that assesses a model's accuracy across various intersection over union (IoU) thresholds. mAP@50 refers to the mean Average Precision calculated at an IoU threshold of 0.50, providing insight into the model's performance at a relatively lenient level of detection. A high mAP@50 score indicates that a significant percentage of the model's predictions align closely with the ground truth, demonstrating its effectiveness in accurately identifying objects. In contrast, mAP@50-95 calculates the mean Average Precision across a range of IoU thresholds from 0.50 to 0.95. This metric offers a more stringent evaluation of the model's performance, reflecting how well it maintains accuracy as the criteria for acceptable detections become more demanding. Together, these metrics provide a comprehensive understanding of the model's strengths and areas for improvement in object detection tasks.

MY Segmentation Models mAP:

  • mAP@50: 0.969 (high accuracy)

  • mAP@50-95: 0.894 (demonstrates robustness across different intersection-over-union thresholds)

The Confusion Matrix and evaluating a model:

The confusion matrix is a crucial output from the YOLO (You Only Look Once) object detection model, providing a detailed breakdown of the model's performance in classifying and detecting objects. It consists of a table that summarizes the counts of true positive, false positive, true negative, and false negative predictions, allowing for a clear evaluation of how well the model performs across different classes.

  1. True Positives (TP): This value represents the number of instances where the model correctly identifies an object of interest (e.g., Brazil nut trees). High TP counts indicate that the model is effective at recognizing the target objects in various conditions.

  2. False Positives (FP): This metric shows the number of instances where the model incorrectly identifies an object (detects an object that is not present). High FP counts can suggest that the model is over-sensitive, potentially detecting noise or irrelevant features as objects.

  3. True Negatives (TN): This value indicates the number of instances where the model correctly identifies the absence of an object. While not always highlighted in object detection tasks, TNs can still provide context about the model's overall accuracy.

  4. False Negatives (FN): This count represents instances where the model fails to detect an object that is present in the image. High FN rates can indicate that the model may miss detecting certain classes or struggle with specific conditions, such as poor lighting or occlusion.

From the confusion matrix, various performance metrics can be derived, such as precision, recall, and the F1-score.

  • Precision measures the accuracy of the positive predictions (TP / (TP + FP)), showing how many of the predicted positive cases were actually correct.

  • Recall assesses the model's ability to detect all relevant instances (TP / (TP + FN)), highlighting how well the model identifies true positives among all actual positives.

  • The F1-score combines both precision and recall into a single metric, providing a balance between the two (2 * (Precision * Recall) / (Precision + Recall)).

By analyzing the confusion matrix and the derived metrics, we can gain insights into the model's performance, identifying strengths and weaknesses in object detection, which can inform further tuning and improvements to enhance accuracy.

The confusion matrix illustrates the performance of the YOLO model in detecting Brazil nut trees. The top left square (151) represents true positives, indicating the model correctly identified 151 Brazil nut trees. The top right square (17) shows false positives, where the model incorrectly identified 17 instances as Brazil nut trees. The bottom left square (4) indicates false negatives, reflecting 4 instances where the model failed to detect actual Brazil nut trees. The bottom right square has no number, signifying there were no true negatives in this context. This matrix helps assess the model's accuracy and areas for improvement.

The Results: Accurately Mapping Brazil Nut Trees

With the model in place, I tested it on new, unseen images, and the results were promising. The model consistently detected Brazil nut trees, creating a reliable spatial dataset for mapping. This dataset could then be used in GIS software to produce shapefiles—essentially digital maps—that highlight the presence of Brazil nut trees across the study area.

Notably, the model performed well even under challenging conditions like varying light and complex canopy structures.

Practical Applications:

The shapefiles generated from this data can be integrated into conservation workflows, allowing forest managers and local NGOs to:

  • Identify overharvested areas and assess regeneration potential.

  • Plan reforestation initiatives more accurately by pinpointing areas lacking juvenile Brazil nut trees.

  • Support sustainable harvesting by monitoring and mapping tree distribution over time.

Where This Research Could Go Next

There’s still room for improvement. With each detected tree, we gain more data to refine the model and adapt it to new environmental conditions. Future steps could include expanding this approach to monitor other valuable or endangered tree species in the Amazon, building an even richer understanding of forest dynamics. Additionally, detecting changes over time would help quantify the impact of conservation actions, aiding local NGOs and forest management teams.

It's important to note that all my data was collected from Finca Las Piedras at the same time of year. For a robust model, we need data from various times of the year and under different environmental conditions so that users can effectively fly and detect trees year-round.

Further, we aim to develop programming to utilize georeferenced orthomosaics. By cutting these images into georeferenced tiles, we can perform inference on each tile. This will allow us to extract mask coordinates from detection or segmentation outputs and convert them from the image's coordinate system to a georeferenced coordinate system. Ultimately, this will enable us to save the results into shapefiles, transitioning from image detection to structured data that facilitates mapping of concessions and identifying all trees in a given area.

Final Thoughts

Using drones and machine learning to map trees like the Brazil nut is a step toward better, smarter forest management. As these technologies become more accessible, we open new doors for conservation that are efficient, scalable, and data driven. By safeguarding key species like the Brazil nut tree, we’re not only supporting local economies but also preserving the biodiversity that keeps the Amazon rainforest and our planet healthy.

Through this work, my hope is to empower more conservation efforts that harness technology in meaningful and impactful ways. The Amazon’s secrets are worth uncovering, and with these tools, we’re getting closer to seeing them one drone flight at a time.

Next
Next

Using 3D models in ArcGIS Pro to visualize buildings susceptible to sea level rise.