FrontVeg-V2: Foreground-Aware Zero-Shot Plant Trait Segmentation in Trellised Crops
napari-frontveg-v2
⚠️ Important: SAM3 requires gated model weights from Hugging Face. Please follow the setup instructions below before running the plugin.
Prerequisites
-
Create a virtual environment
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
-
Request SAM3 Weights Access: Request access to the SAM3 checkpoint on Hugging Face. Once approved, download
sam3.pt. -
Download Depth-Anything V2 Weights: Download the Large model checkpoint (
depth_anything_v2_vitl.pth) from the official Depth-Anything V2 repository. -
Place your downloaded checkpoints inside the project folder:
- Place sam3.pt into: checkpoints/sam3_ckpts/sam3.pt
- Place depth checkpoints into: checkpoints/depthanything_ckpts/
Installation
Option 1: Recommended (Git Clone + Editable Install)
This option automatically sets up the relative paths for external/ submodules and checkpoints/.
# 1. Clone the repository with submodules
git clone https://github.com/djaliloh/FrontVeg2.git
cd FrontVeg2
# 2. Clone and install external models in `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 ../..
# 3. Install in editable mode
pip install -e .
Option 2: Direct PyPI Install + Environment Variables
# If you installed the plugin directly via PyPI (pip install frontvegv2), you must specify the paths to your local SAM3 code repository and checkpoints using environment variables :
# Windows (PowerShell):
$env:FRONTVEG_SAM3_REPO = "<path_to_sam3_repo>"
$env:FRONTVEG_SAM3_CKPT = "<path_to_sam3.pt>"
$env:FRONTVEG_DEPTH_REPO = "<path_to_depth_anything_v2_repo>"
$env:FRONTVEG_DEPTH_CKPT_DIR = "<path_to_depth_ckpts_folder>"
napari
# Linux / macOS (Bash):
export FRONTVEG_SAM3_REPO="<path_to_sam3_repo>"
export FRONTVEG_SAM3_CKPT="<path_to_sam3.pt>"
export FRONTVEG_DEPTH_REPO="<path_to_depth_anything_v2_repo>"
export FRONTVEG_DEPTH_CKPT_DIR="<path_to_depth_ckpts_folder>"
napari
Usage in Napari
- Launch Napari:
napari - Open an RGB image of a row crop.
- Select Plugins > FrontVeg V2 Studio.
- Set your prompt (e.g., "leaf") and adjust parameters (Tile Overlap, Sigma, etc.).
- Click Run Complete Pipeline.
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.
License
License is pending.
Contact
- David Rousseau - Professor, [david.rousseau@univ-angers.fr]
- Corentin Lothode - Researcher Engineer, [corentin.lothode@inrae.fr]
- Herearii Metuarea - PhD student, [herearii.metuarea@univ-angers.fr]
- Abdoul Djalil Ousseini Hamza - Engineer, [abdoul-djalil.ousseini-hamza@inrae.fr]
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frontvegv2-0.1.0.tar.gz.
File metadata
- Download URL: frontvegv2-0.1.0.tar.gz
- Upload date:
- Size: 30.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c950036f4b8ddec745eeed3bbd56d5a92aa23dd86fa959fefb43038a4bb2df90
|
|
| MD5 |
2216e5fd0378b1cd724addd4203c82a6
|
|
| BLAKE2b-256 |
3c80d176dc883c45b62adaaa27ad951f2a0e51bafed882fa0fddcae0528845c9
|
File details
Details for the file frontvegv2-0.1.0-py3-none-any.whl.
File metadata
- Download URL: frontvegv2-0.1.0-py3-none-any.whl
- Upload date:
- Size: 34.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e700ad30f08e88347287618b05163ee91715db1e3457a2d7fb8be4404dd1b1b4
|
|
| MD5 |
806970b056e27b853c82060aed78d462
|
|
| BLAKE2b-256 |
4cc2dc951fee3cf51cd4ae6a851337bcf9b325eef2186a581cca57856300b5cf
|