A YOLO-based package for detecting and counting industrial objects.
Project description
PyFarm
A YOLO-based package for detecting and counting industrial objects, powered by Ultralytics.
Installation
pip install pyfarm-detection
From source
git clone https://github.com/chhaytheanly/pyfarm.git
cd pyfarm
pip install -e ".[test]"
Usage
CLI
pyfarm
Python API
from pyfarm.detector import get_model
model = get_model()
results = model("image.jpg")
results[0].show()
The model is downloaded from GitHub releases on first use and cached locally.
Configuration
All settings are configured via environment variables:
| Variable | Default | Description |
|---|---|---|
GITHUB_REPO |
https://github.com/chhaytheanly/pyfarm |
Repository hosting model weights |
TAG |
v0.0.1 |
Release tag for model weights |
MODEL_FILENAME |
640_yolo.pt |
Model weights filename |
CACHE_DIR |
~/.cache/pyfarm |
Model download cache directory |
CONF_THRESHOLD |
0.45 |
Detection confidence threshold |
IOU_THRESHOLD |
0.45 |
NMS IoU threshold |
IMG_SIZE |
640 |
Input image size |
USE_ONNX |
True |
Enable ONNX export |
TILE_OVERLAP_RATIO |
0.35 |
Tiling overlap ratio |
TILE_MIN_OVERLAP_PX |
128 |
Minimum overlap in pixels |
TILE_USE_REFLECT_PADDING |
True |
Use reflect padding for tiles |
TILE_ENABLE_TTA |
True |
Enable test-time augmentation |
TILE_SOFT_NMS |
True |
Enable soft NMS for tiles |
TILE_SOFT_NMS_SIGMA |
0.5 |
Soft NMS sigma parameter |
Example
export TAG=v0.0.1
export CONF_THRESHOLD=0.5
pyfarm
Note: The
.envfile is not automatically loaded. Set variables in your shell or useexport/$env:(PowerShell).
Private repositories
If your model weights are hosted in a private GitHub repository, set a GITHUB_TOKEN environment variable with a Personal Access Token that has contents: read access.
export GITHUB_TOKEN=ghp_...
Development
pip install -e ".[test]"
pytest test/ -v
Project structure
src/
└── pyfarm/
├── __init__.py
├── __main__.py # CLI entry point
├── detector.py # Model loading (get_model)
├── weight.py # Model downloader from GitHub releases
├── core/
│ ├── __init__.py
│ └── config.py # Configuration dataclass
└── utils/
└── __init__.py
License
MIT
Project details
Release history Release notifications | RSS feed
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 pyfarm_detection-0.0.1.tar.gz.
File metadata
- Download URL: pyfarm_detection-0.0.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89df1c120a9e8c7798271c0c2da26ba50f814ee9a01d95d48e38a37e8d17d09a
|
|
| MD5 |
367f1141baf3777a33178990c4775359
|
|
| BLAKE2b-256 |
fc1492112d158f28d4e681e1f647103b2063b17bcdcf177b6b6ec72cdb27056d
|
File details
Details for the file pyfarm_detection-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pyfarm_detection-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
926ed4def05cf4d0c65f52e98654fb2a6a4463441e4ef7fecdf9d38141fc0a8a
|
|
| MD5 |
089d9f28eabc51b9867d9c89848c8bac
|
|
| BLAKE2b-256 |
67a1eb8f7e91496d6b6044d7e0b6412f01499976e1aff839f03f13a498553d02
|