Home / Blog / Article
Robotics & Edge AI

Smart Weed Remover Robot: YOLOv5 on Jetson Nano with a 3-DOF Delta Robot

From a 2,822-image dataset to TensorRT inference and safe pluck trajectories: the full chain from seeing a weed to moving a parallel robot to remove it.

RoboticsNVIDIA JetsonYOLOv5TensorRT
0.701Test mAP@0.5 (YOLOv5m)
2,822Images · 14,919 boxes
17.1 msTensorRT inference
56 FPSSimulated control loop
Weed detection and Delta robot project summary dashboard

The problem

Weeds compete with crops for water, light and nutrients, and removing them by hand is slow while blanket herbicide spraying treats the whole field to reach a few plants. A robot that can see a weed and remove just that plant is an appealing alternative, but it is a hard mechatronics problem: perception and actuation have to agree in real space, not just on a screen.

A false positive can uproot a crop. A slow loop can miss the weed. A perfect detector is useless if the coordinate transform is off by a few centimetres. This project works through that whole chain, from the dataset to the robot command, for an NVIDIA Jetson Nano and an igus 3-DOF Delta parallel robot.

Project summary: dataset audit, model evaluation, edge deployment, robotics integration, control-loop simulation and the field-validation plan.
Fig. 1 Project summary: dataset audit, model evaluation, edge deployment, robotics integration, control-loop simulation and the field-validation plan.

System at a glance

AreaSummary
Dataset2,822 images, 14,919 annotations, two classes: crop and weed
Best modelYOLOv5m, test mAP@0.5 0.701, recall 0.738
Edge formatsPyTorch, ONNX and TensorRT, with parity and latency checks
Robotigus Delta parallel robot, 3 DOF, 1000 mm class, 2.5 kg payload
Jetson stackRealSense RGB camera, DeepStream, TensorRT, YOLOv5, Python controller
SafetyROI filtering, confidence threshold, repeated-frame confirmation, workspace limits, emergency stop

The work is organised as fifteen numbered notebooks, from the dataset audit through to the field-validation plan, plus a separate jetson_robot package for deployment.

Understanding the data first

Before training anything, the dataset was audited for missing labels, missing or corrupted images, unsupported formats and duplicates. It scored 97.14 / 100 on the health check. The audit also exposed the main challenge: the classes are heavily imbalanced. Weeds account for 94% of the 14,919 boxes and crops for just 6%.

Representative crop and weed samples under varied field conditions.
Fig. 2 Representative crop and weed samples under varied field conditions.
Bounding-box size and shape distributions. Many objects are small, which makes detection harder.
Fig. 3 Bounding-box size and shape distributions. Many objects are small, which makes detection harder.

Further notebooks checked for leakage between splits, analysed near-duplicates, corrected the splits, measured the effect of brightness correction and confirmed that augmented images kept their labels and a realistic field appearance.

Training two models

Two YOLOv5 variants were trained and compared on the held-out test set. The medium model is slightly more accurate; the nano model is ten times smaller, which matters on a Jetson Nano.

ModelSizeTrain timePrecisionRecallmAP@0.5mAP@0.5:0.95
YOLOv5n3.7 MB92.5 min0.7190.7080.6820.344
YOLOv5m40.2 MB216.4 min0.7190.7380.7010.363
Loss and validation metrics across epochs, used to judge convergence.
Fig. 4 Loss and validation metrics across epochs, used to judge convergence.
Predictions next to the ground truth, showing where the model matches or misses annotations.
Fig. 5 Predictions next to the ground truth, showing where the model matches or misses annotations.
Confusion matrix for crop and weed predictions on evaluation data.
Fig. 6 Confusion matrix for crop and weed predictions on evaluation data.

Where the model fails, and why it matters

For a robot, the type of error matters more than the average score. A missed weed is a minor loss; a crop wrongly classified as a weed is damage. The error-analysis notebook separates true positives, false positives and false negatives, and measures how errors change with lighting, crowding and object size.

Error rates by lighting, crowding and object size.
Fig. 7 Error rates by lighting, crowding and object size.

Getting it onto edge hardware

The nano model was exported to ONNX and TensorRT. Each format was checked for parity against a reference and benchmarked for latency:

FormatBackendSizeLatencyParity
PyTorch (.pt)PyTorch, GPU3.9 MB16.96 msReference
ONNXONNX Runtime, CPU7.8 MB33.26 ms85.8% (different preprocessing)
TensorRT (FP32)TensorRT, GPU10.3 MB17.12 ms100% vs ONNX (matched preprocessing)
Latency comparison of the three backends.
Fig. 8 Latency comparison of the three backends.

These timings were measured on the development GPU, not yet on the Jetson Nano itself. They show that the pipeline is feasible and that the TensorRT engine is numerically faithful; on-device numbers come next.

From a bounding box to a robot motion

A detection only becomes useful once it turns into a safe physical motion:

camera frame (RealSense RGB, DeepStream v4l2src)
  → YOLOv5 TensorRT inference (nvinfer)
  → keep weed class, confirm across 2 frames, confidence ≥ 0.50
  → weed ROI midpoint
  → pixel-to-robot coordinate transform
  → Delta inverse kinematics
  → approach / pluck / retract trajectory
  → serial or TCP command to the robot controller

A Delta robot is a parallel mechanism: three arms share the load of one end effector. It gives stiffness and precise positioning inside a bounded workspace, which suits a tool that has to strike a small target point. The inverse kinematics are derived in the project notes, and the trajectory planner generates the approach, pluck and retract motion.

Safety comes before motion

Combining vision with a physical actuator means safety cannot be an afterthought. The controller defaults to a dry-run transport that prints commands instead of moving hardware; real motion needs an explicit --enable-motion flag. Detections must pass several gates before any command is issued:

  • a region-of-interest filter and crop-clearance check;
  • a confidence threshold of 0.50;
  • confirmation across two consecutive frames;
  • workspace limits for the Delta robot;
  • support for a hardware emergency stop.

The simulated control loop

Before touching hardware, the whole loop was run in simulation:

MetricValue
Frames processed48
Tracked detections89
Actuation commands issued70
Mean loop time17.76 ms
Loop rate56.3 FPS
End-to-end loop timing and the actuation decisions made in simulation.
Fig. 9 End-to-end loop timing and the actuation decisions made in simulation.
Example detections after the confidence, confirmation, brightness and action filters.
Fig. 10 Example detections after the confidence, confirmation, brightness and action filters.

The latency budget is honest about what is still unknown. Of an estimated 80 ms from camera capture to actuator response, only the inference step is measured; capture, preprocessing, communication and the robot's mechanical response are still placeholders until the hardware is in the loop.

What comes next

The final notebook defines a field-validation protocol with sample-size planning and rollout gates: dry runs first, then slow supervised commissioning with an emergency stop, then autonomous trials. The goal is a robot that removes weeds selectively and uses less herbicide, and that is precise enough for a farmer to trust. That only happens when the vision, the kinematics and the mechanics are tested together.