Registry / ai-ml / rf-segment-anything

rf-segment-anything

JSON →
library1.0pypypiunverified

RF Segment Anything (rf-segment-anything) provides a simple API to run Meta's Segment Anything Model (SAM) for image segmentation with just a few lines of code. Version 1.0 is currently available. Release cadence is unknown; the library appears to be in early active development.

pip install rf-segment-anything
INSTALL
IMPORT
SIG · RF-SEGMENT-ANYTHIN
R
rf-segment-anything
ai-mlpythonv1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Segmentation
from segment_anything import Segmentation
from rf_segment_anything import Segmentation

Instantiate a Segmentation object, load a pre-trained model (e.g., vit_h), and call segment() on an image path or numpy array.

from rf_segment_anything import Segmentation segmenter = Segmentation() segmenter.load_model("vit_h") # Use an image path or numpy array result = segmenter.segment("path/to/image.jpg") print(result)
Debug
Known issues
gotchaModel weights are downloaded automatically on first use to ~/.cache/torch/hub/checkpoints/. Ensure you have disk space and network access.
fix
Pre-download weights manually or set environment variable TORCH_HOME to a custom directory.
affects: all
gotchaThe segment() method returns a dictionary with keys 'masks', 'boxes', etc. Do not expect a single mask array; iterate over results.
fix
Access result['masks'] for the list of masks.
affects: all
deprecatedThe parameter 'model_type' in load_model() may be renamed to 'model_name' in future releases.
fix
Use the correct parameter name for your version; check documentation before upgrading.
affects: 1.0
Upgrade
Version history
1.0latest on PyPI · released May 25, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
1
Resources
rf-segment-anything — pip install rf-segment-anything · libregistry