Skip to main content

AprilTag-calibrated dried shiitake mushroom cap analysis (diameter, crack ratio, pattern classification).

Project description

SMPAS (Shiitake Mushroom Pattern Analysis System)

SMPAS is an AprilTag-calibrated analysis system for dried shiitake mushroom caps. It measures real-world diameter, estimates crack/pattern ratio, and classifies pattern type using a YOLO detector and SAM-based segmentation. It ships with a web UI for image upload and visualization.

Key Features

  • AprilTag-based calibration for real-world measurements
  • Diameter measurement (mm)
  • Crack/pattern ratio estimation
  • Pattern type classification
  • Web app for interactive upload and results
  • CLI tools for model download and web startup

System Requirements

  • Python 3.10+
  • CUDA GPU recommended for speed (CPU is supported)
  • Network access to download models

Install

pip install smpas

SAM must be installed separately (PyPI does not allow direct Git dependencies):

pip install git+https://github.com/facebookresearch/segment-anything.git

Download Models

smpas-download-models

This downloads:

  • yolo_mushroom.pt (default URL hosted by you)
  • sam_vit_b.pth (official SAM checkpoint)

To override URLs:

smpas-download-models --yolo-url <URL> --sam-url <URL>

To download only one model:

smpas-download-models --no-yolo
smpas-download-models --no-sam

Run the Web App

smpas-web

Default address:

http://localhost:5000

Default Directories SMPAS creates these under ~/.smpas automatically:

~/.smpas/
├── models/      # model weights
├── data/        # optional input images
├── uploads/     # web uploads
└── outputs/     # optional outputs

Environment Variables

  • SMPAS_HOME: base directory (default ~/.smpas)
  • SMPAS_MODELS_DIR: model directory override
  • SMPAS_DATA_DIR: data directory override
  • SMPAS_UPLOAD_DIR: upload directory override
  • SMPAS_DEVICE: cuda or cpu
  • SMPAS_YOLO_URL: default YOLO download URL for smpas-download-models
  • SMPAS_SAM_URL: default SAM download URL for smpas-download-models
  • SMPAS_YOLO_MODEL: explicit YOLO model path
  • SMPAS_SAM_MODEL: explicit SAM model path
  • SMPAS_APRILTAG_SIZE: AprilTag size in mm (default 37.58)

CLI Options (smpas-web)

  • --host, --port: bind address
  • --base-dir: base directory (overrides SMPAS_HOME)
  • --models-dir: model directory
  • --data-dir: data directory
  • --uploads-dir: upload directory
  • --device: cuda or cpu
  • --apriltag-size: AprilTag size in mm
  • --max-workers: parallel workers
  • --no-parallel: disable parallel processing

Data Requirements

  • Images should include an AprilTag (tag16h5, ID 25)
  • AprilTag black square size: 37.58 mm
  • Prefer top-down images with minimal perspective distortion
  • Recommended resolution >= 2000×2000

Output (Web Response) The web API returns:

  • AprilTag detection status
  • px/mm calibration
  • Diameter (mm)
  • Crack/pattern ratio (%)
  • Pattern type classification
  • Flatness score and suspected “ban-gu” flag

Notes

  • Model weights are not bundled with the package.
  • SAM must be installed manually from GitHub.
  • GPU is optional but strongly recommended.

License Proprietary. See LICENSE.txt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smpas-0.1.2.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smpas-0.1.2-py3-none-any.whl (54.6 kB view details)

Uploaded Python 3

File details

Details for the file smpas-0.1.2.tar.gz.

File metadata

  • Download URL: smpas-0.1.2.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for smpas-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c614c3e0c5d2a07193d78ca00b356e419bb786bfc9d752a3d7e266cb4543c51c
MD5 63b1b997b7dfba4f063498a52273cdc4
BLAKE2b-256 165396431f5f26061a0bd0e63530cc87b017353f7ef740444a25308a18baa9c7

See more details on using hashes here.

File details

Details for the file smpas-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: smpas-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 54.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for smpas-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6355cbb6e5dbee0b05524c0c8619579501c934c363929e41b58dbf160c4925ed
MD5 c4743c5b5bb1134f61293f98007d4a7b
BLAKE2b-256 6f951862c60079d127cc5521d264429e641879651249753f02229cd1fed8de6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page