Skip to main content

cornvision

Offline corn kernel detection and row counting from ear images.

CornVision demo

Installation

pip install -e .

Model weights are downloaded automatically from Hugging Face on first run and cached at ~/.cornvision/model.pth.

Usage

GUI

cornvision

The GUI supports both single and batch inference:

Control Description
Add Images… Add one or more images to the queue
Remove / Clear All Remove selected or all images from the queue
Device Select inference device (auto, cpu, cuda, mps)
Analyze All Run inference on all pending images in sequence
Stop Halt the batch after the current image finishes
Save Annotated… Save the annotated image for the selected result
Export CSV… Export all completed results to a CSV file

Queue items are colour-coded: ○ pending, ↻ running, ✓ done, ✗ error.

Python API

from cornvision import CornAnalyzer

analyzer = CornAnalyzer()          # loads model, downloads weights if needed
result = analyzer.analyze("corn.jpg")

print(result.total_kernels)        # int
print(result.total_rows)           # int
print(result.kernels_per_row)      # list[int]
print(result.inference_time_sec)   # float

result.save_viz("annotated.png")   # save annotated image to disk

CornAnalyzer loads the model once and can analyze multiple images:

for path in image_paths:
    result = analyzer.analyze(path)

CornAnalyzer(device="auto")

Parameter Description
device "auto" (default) picks CUDA → MPS → CPU automatically

AnalysisResult fields

Field Type Description
total_kernels int Total detected kernels
total_rows int Number of kernel rows
kernels_per_row list[int] Kernel count per row
inference_time_sec float Wall-clock inference time
average_kernel_width_mm float Estimated mean kernel width
average_kernel_height_mm float Estimated mean kernel height
viz_image PIL.Image | None Annotated image (in-memory)

Dependencies

Package Purpose
torch / torchvision Model inference
Pillow Image I/O and visualization
numpy Array operations
requests Weight download

tkinter is used for the GUI and ships with the standard Python installer.

Project layout

src/cornvision/
├── __init__.py       # public API: CornAnalyzer, AnalysisResult
├── _gui.py           # tkinter GUI (entry point)
├── _analyzer.py      # CornAnalyzer — model load + analyze()
├── _inference.py     # end-to-end inference pipeline
├── _clustering.py    # kernel row clustering
├── _image_proc.py    # image pre/post-processing helpers
├── _model.py         # model architecture + weight loading
├── _download.py      # weight download + cache path
├── _config.py        # shared constants
└── _result.py        # AnalysisResult dataclass

Metadata

Release files for cornvision 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cornvision 0.1.0
File Size Uploaded Provenance
cornvision-0.1.0.tar.gz 3.6 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cornvision 0.1.0
File Interpreter ABI Platform
cornvision-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.7 MB

Release files / cornvision-0.1.0.tar.gz

Download URL cornvision-0.1.0.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
c0dfafd508acba74ef68946e6489f32f6650b33bc855e57deba867216397ed78
BLAKE2b-256 checksum
How to use checksums
c6b301192f633f3e4bc1290bffeb676a132ae9826605c1e75e3eb37ba4a599c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / cornvision-0.1.0-py3-none-any.whl

Download URL cornvision-0.1.0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6186c6e703e35b54f015264ba606a1fcd33d4cca56ea65ef87b151f89fdfb511
BLAKE2b-256 checksum
How to use checksums
84f9ee717cf9ccca84e37a50dc62ee87b42b15ed0f1322072e064bf85b509cd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for cornvision 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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