Computer vision toolkit for high-throughput fruit phenotyping.
Project description
Traitly is an open-source Python tool for automated, high-throughput fruit phenotyping from digital images. Using computer vision methods, it quantifies morphological, symmetry, and color traits across both internal structures and the external appearance of the fruit.
It supports both single-image analysis and batch processing workflows, making it easy to handle large image datasets with just a few lines of code, which is especially useful in plant breeding programs and research.
[!IMPORTANT] We are working on a manuscript describing this software and its applications, expected to be submitted in Spring–Summer 2026. In the meantime, if you use Traitly in your research, please cite it as:
Torres-Meraz, M. A., Lopez-Moreno, H., & Zalapa, J. (2026). Traitly: A Python Toolkit for High-Throughput Fruit Phenotyping. Zenodo. https://doi.org/10.5281/zenodo.18738366
What can Traitly do?
Traitly processes fruit images to measure:
- Fruit morphology: Area, perimeter, circularity, dimensions, and aspect ratio
- Locule anatomy: Locule number, size distribution, and spatial arrangement
- Pericarp structure: Thickness, uniformity (CV), and surface irregularity (lobedness)
- Color phenotypes: Multi-channel analysis (RGB, HSV, Lab) across different fruit regions
Project Status
The project's architecture and core logic are established, and a group of early testers is currently evaluating the tool across different workflows and use cases. We expect to publish the package on PyPI soon.
All updates will be announced through this repository and on LinkedIn, so we encourage interested users to follow or watch the repository to stay informed.
Publications & Presentations
Posters related to Traitly can be found in this folder:
- Posters ★ˎˊ˗
These materials provide additional methodological details and results from research derived from our package.
Usage
Traitly can be run in different ways:
| Environment | Status |
|---|---|
| Jupyter Notebook | ✔ Available |
| Command line (CLI) | ✔ Available |
| Web app (Shiny) | ✔ Available |
⤷ You can also try our interactive demo onlineˎˊ˗
Below is a basic example of how to use Traitly.
⋆ Python usage
Internal fruit morphology analysis
from traitly.fruit_phenotyping import FruitInternalAnalyzer
# Single image analysis
path = 'PATH/my_image.jpg'
analyzer = FruitInternalAnalyzer(path) # Initialize the FruitInternalAnalyzer class
analyzer.load_image() # Read the image
analyzer.setup_measurements() # Obtain label and reference size information
analyzer.generate_fruit_mask() # Create a binary mask to segment fruits and locules
analyzer.detect_fruits() # Filter detected fruits
analyzer.analyze_morphology() # Run the morphology analysis
analyzer.analyze_color() # Run the color analysis
analyzer.results.save_all() # Save results (color and morphology .csv files and annotated image)
analyzer.save_parameters() # Save session parameters as .txt and .json files
# Batch analysis
path = 'PATH/my_folder'
json = 'my_parameters.json'
analyzer = FruitInternalAnalyzer(path)
analyzer.analyze_folder(json_path = json)
External fruit morphology analysis
from traitly.fruit_phenotyping import FruitExternalAnalyzer
# Single image analysis
path = 'PATH/my_image.jpg'
analyzer = FruitExternalAnalyzer(path) # Initialize the FruitExternalAnalyzer class
analyzer.load_image() # Read the image
analyzer.setup_measurements() # Obtain label and reference size information
analyzer.generate_fruit_mask() # Create a binary mask to segment fruits
analyzer.detect_fruits() # Filter detected fruits
analyzer.analyze_morphology() # Run the morphology analysis
analyzer.analyze_color(color_channel='RGB') # Extract mean RGB channel values for each fruit
analyzer.results.save_all() # Save results (color and morphology .csv files and annotated image)
analyzer.save_parameters() # Save session parameters as .txt and .json files
# Batch analysis
path = 'PATH/my_folder'
json = 'my_parameters.json'
analyzer = FruitExternalAnalyzer(path)
analyzer.analyze_folder(json_path = json)
⋆ Command-line usage
# Run the web app
traitly-app
# Internal morphology analysis (single image or folder)
traitly --fruit_internal -i tests/sample_data/
traitly --fruit_internal -i tests/sample_data/ -o results/ --num_cores 4
traitly --fruit_internal -i tests/sample_data/ --json config.json
# External morphology analysis (single image or folder)
traitly --fruit_external -i tests/sample_data/
traitly --fruit_external -i tests/sample_data/ -o results/ --json config.json --num_cores 4
For more detailed examples, check our tutorials ᯓ★
Contact
For questions or comments about the project, feel free to reach out to:
We are open to collaborations, including adding new traits, and creating tutorials or workflows for specific crops or plant tissues.
Contributors
| Contributor | Role |
|---|---|
| María Meraz | 💻 📆 💬 🚧 📓 ✅ 🐛 📖 ⚠️ 🤔 🔣 🌍 🎨 |
| Héctor López | 📖 📓 ✅ 🤔 🐛 🔣 🌍 |
| Juan Zalapa | 🔣 |
Acknowledgements ♡
We thank the developers of OpenCV, Ultralytics, EasyOCR, NumPy, Pandas, Matplotlib, and Shiny, as well as all open-source libraries that made this project possible.
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 traitly-0.1.0.tar.gz.
File metadata
- Download URL: traitly-0.1.0.tar.gz
- Upload date:
- Size: 12.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a1ffc7ccac245b4b128519af7c5cade33c65a2ab69af93b83fc3706fcc30003
|
|
| MD5 |
9216cc08cb636791eaf00901ae7ecda0
|
|
| BLAKE2b-256 |
7360a863a95598ad16eaf43a27773b92949cd8bdf792678c103b91c3aae3282f
|
File details
Details for the file traitly-0.1.0-py3-none-any.whl.
File metadata
- Download URL: traitly-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b8ec4d0952dd70d19f319a982688bf87a5dfb9ad66e5d57425633fa8666bbdb
|
|
| MD5 |
774157d743f62cdfc57edff97518c5f9
|
|
| BLAKE2b-256 |
a736ef57533d0f23efb793350b65b58331b9b29d3ee6ebcc909de251da91c7ef
|