flatbug
A General Method for Detection and Segmentation of Terrestrial Arthropods in Images
| Find and cite the flatbug paper in Method in Ecology and Evolution | Send us new data through our data contribution form. |
flatbug is partly a high-performance pyramid tiling inference wrapper for YOLOv8 and partly a hybrid instance segmentation dataset of terrestrial arthropods accompanied by an appropriate training schedule for YOLOv8 segmentation models, built on top of the original YOLOv8 training schedule.
The goal of flatbug is to provide a single unified model for detection and segmentation of all terrestrial arthropods on arbitrarily large images, especially fine-tuned for the case of top-down images/scans - thus the name "flat"bug.
Installation
We recommend using uv (installation):
# Install
uv pip install flat-bug --torch-backend=auto
# Add to a project permanently
uv add flat-bug
or (not recommended):
pip install flat-bug
Source/development
Or a development version can be installed from source by cloning this repository:
Clone the repository
git clone https://github.com/darsa-group/flat-bug.git
cd flat-bug
Install flatbug
uv sync --all-extras --all-groups --upgrade
# (optional but recommended)
uv pip install torch torchvision --torch-backend=auto --reinstall
or (not recommended):
pip install -e .
CLI Usage
We provide a number of CLI scripts with flatbug. The main one of interest is fb_predict, which can be used to run inference on images or videos:
[uv run] fb_predict -i <DIR_WITH_IMGS> -o <OUTPUT_DIR> [-w <WEIGHT_PATH>] ...
Tutorials
We provide a number of tutorials on general and advanced usage, training, deployment and hyperparameters of flatbug in examples/tutorials or with Google Colab .
Documentation
Find our documentation at https://darsa.info/flat-bug/.
CUDA Issues
Working with cross-platform PyTorch code can be a bit confusing, so if you ever get stuck with some CUDA errors, here are some possible paths to resolve the issues.
uv and pip
If you installed flat-bug via a package manager but find that GPU acceleration is not working, your environment likely downloaded the default PyPI wheels which may not match your system's NVIDIA drivers.
If you are using uv, the easiest fix is to force a re-resolution of the PyTorch backend:
# Automatically detect hardware and reinstall PyTorch
uv pip install torch torchvision --torch-backend=auto --reinstall
# OR manually force a specific CUDA version (e.g., CUDA 11.8)
uv pip install torch torchvision --torch-backend=cu118 --reinstall
If you are using standard pip, you must manually point to the PyTorch index that matches your system:
# Uninstall the broken versions
pip uninstall torch torchvision
# Reinstall pointing explicitly to the CUDA 11.8 or 12.1 (cu121) index
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
Verification:
[uv run] python -c "import torch; print(f'CUDA Available: {torch.cuda.is_available()}')"
Source
Rebuild the environment and lockfile from scratch:
# cd ~/flat-bug
# 1. Purge old state
rm uv.lock
rm -rf .venv
# 2. Generate the pure, cross-platform lockfile
uv lock
# 3. Create your local environment
uv sync --all-extras --all-groups
# 4. Patch your local environment with your specific hardware backend
uv pip install torch torchvision --torch-backend=auto --reinstall
Metadata
Release files for flat-bug 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flat_bug-1.2.0.tar.gz | 106.3 kB | Without provenance | Details for flat_bug-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flat_bug-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for flat_bug-1.2.0-py3-none-any.whl |
Total release size: 221.7 kB
Release files / flat_bug-1.2.0.tar.gz
| Download URL | flat_bug-1.2.0.tar.gz |
|---|---|
| Size | 106.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe55b229b2a67ed6d88e673f8ae9814185a63534646b17c14646e3f89a6babab
|
|
BLAKE2b-256 checksum How to use checksums |
5ca742fbdbf14f42d8a57f4a275dcd1c236896d9657fc7d8dcee3f808397a957
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / flat_bug-1.2.0-py3-none-any.whl
| Download URL | flat_bug-1.2.0-py3-none-any.whl |
|---|---|
| Size | 115.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc92d618ac8b516b6e505cb6d49683a5ea57ca1b293f5fa68bc98f7493c16b84
|
|
BLAKE2b-256 checksum How to use checksums |
383b523e149b61f3d1e778a562b38c72f2fe18753a9aa2439eaadd86e92b1a84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for flat-bug 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.