Skip to main content

FrontVeg V2: Foreground-Aware Zero-Shot Plant Trait Segmentation in Trellised Crops

Abdoul Djalil Ousseini Hamza (ORCID), Herearii Metuarea (ORCID), Corentin Lothodé (ORCID), Morgane Roth (ORCID), Eric Duchêne (ORCID), Lionel Ley, David Alletru (ORCID), and David Rousseau* (ORCID)

* Project Supervisor

Partner Logo

napari hub Python 3.10+ PyTorch License: BSD 3-Clause

FrontVeg V2

A napari plugin for automated plant organ segmentation and leaf area estimation in trellised crops using side view monocular RGB images.

Some examples of organ segmentation on different trellised crops:

FrontVeg V2 Segmentation Examples Grid


Prerequisites

  1. Create and activate a virtual environment

We recommend using Python 3.10 and cuda 12.1:

conda create -n <env_name> python=3.10 -y
conda activate <env_name>
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
  1. Request SAM3 Weights Access: Request access to the SAM3 checkpoint on Hugging Face. Once approved, download sam3.pt.

  2. Download Depth-Anything V2 Weights: Download the Large model checkpoint (depth_anything_v2_vitl.pth) from the official Depth-Anything V2 repository.

  3. Place your downloaded checkpoints inside the project folder:

    • Place sam3.pt into: checkpoints/sam3_ckpts/
    • Place depth checkpoints into: checkpoints/depthanything_ckpts/

Installation

FrontVeg V2 requires a dedicated Conda environment and two external models: Depth-Anything V2 and SAM3.

Note: The FrontVeg V2 GitHub repository is currently private. Therefore, users should install the FrontVeg V2 package from PyPI rather than cloning the main repository.

1. Clone and install the external models

Create a directory for the external dependencies:

mkdir external
cd external

Depth-Anything V2

git clone https://github.com/DepthAnything/Depth-Anything-V2.git

Depth-Anything V2 does not need to be installed as a package at this stage; FrontVeg V2 uses it from the external/ directory.

SAM3

git clone https://github.com/facebookresearch/sam3.git
cd sam3
pip install -e .
cd ..

You should now have:

external/
├── Depth-Anything-V2/
└── sam3/

2. Install FrontVeg V2 from PyPI

Once the external dependencies have been installed, return to the directory where you want to use FrontVeg V2 and run:

pip install frontvegV2

This installs the FrontVeg V2 package and its Python dependencies.

3. Check the installation

You can verify that FrontVeg V2 is available with:

python -c "import frontveg; print('FrontVeg V2 installed successfully')"

Important: The external repositories must be installed before running FrontVeg V2. In particular, SAM3 must be installed with pip install -e . from its cloned repository.

Alternative: Development Installation

If you have access to the private FrontVeg V2 GitHub repository and want to modify the source code, you can clone the repository and install it in editable mode:

git clone https://github.com/djaliloh/FrontVegV2.git
cd FrontVegV2

mkdir external
cd external

# Depth-Anything V2
git clone https://github.com/DepthAnything/Depth-Anything-V2.git

# SAM3
git clone https://github.com/facebookresearch/sam3.git
cd sam3
pip install -e .

cd ../..

# Install FrontVeg V2 in editable mode
pip install -e .

This development installation is intended for contributors and users who need direct access to the source code.

Usage in Napari

  1. Launch Napari: napari
  2. Open an RGB image of a row crop.
  3. Select Plugins > FrontVeg V2 Studio.
  4. Set your prompt (e.g., "leaf") and adjust parameters (Tile Overlap, Sigma, etc.).
  5. Click Run Complete Pipeline.

Acknowledgements

This work was supported by the French Programme et Équipements Prioritaires de Recherche (PEPR) AgroEcoNum (pepr-agroeconum.fr), the France 2030 program through the Agence Nationale de la Recherche (ANR), and the European Union’s Horizon Europe research and innovation programme (Grant No. 101094587, PHENET).

This research used computing resources from the GLiCID Computing Facility (Ligerien Group for Intensive Distributed Computing, doi:10.60487/glicid, Pays de la Loire, France), as well as HPC and storage resources provided by GENCI at IDRIS on the Jean Zay supercomputer’s H100 partition (Grant 2025-AD010115553R1).

The authors would like to thank Sirine Gharbi, Oumaima Karia, Justin Langlois, Paul, and Thomas for their valuable assistance in annotating the image dataset used in this study.

Contact

Imhorphen team, bioimaging research group,
IRHS, UMR 1345, INRAE,
42 Rue Georges Morel, 49070 Beaucouzé, France

Troubleshooting

  • Missing Module 'triton': On Windows, install the Windows-compatible Triton build: pip install triton-windows.
  • RuntimeError: mat1 and mat2 must have the same dtype: If running on GPUs older than NVIDIA Ampere (e.g., GTX 10xx, RTX 20xx), ensure autocast is set to float16 or float32 instead of bfloat16.
  • Missing Checkpoints Error: Verify that sam3.pt exists at the expected path or set FRONTVEG_SAM3_CKPT manually.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frontvegv2-0.1.5.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frontvegv2-0.1.5-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

File details

Details for the file frontvegv2-0.1.5.tar.gz.

File metadata

  • Download URL: frontvegv2-0.1.5.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for frontvegv2-0.1.5.tar.gz
Algorithm Hash digest
SHA256 dd786835493aa6a94bbc660d0b4806cebd7aa80048fd919318f2e1deb857c88d
MD5 482709e1e21bffd1d986bfd6490893b9
BLAKE2b-256 840711f091ba179dd246bdadc8158c46aca4a7f30c33d6c0674c1a63c90a066e

See more details on using hashes here.

File details

Details for the file frontvegv2-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: frontvegv2-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 36.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for frontvegv2-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ff7b768e8eff9856eeb083b7a4935d3a43d12d2fdb6ff7199d27f38c7984c185
MD5 37531a1fca9a9d15101dcae419e113b5
BLAKE2b-256 d275abb6a931912382632a11c55915f5dc75e0de52eb9dd069b00bd4c64549f4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page