Skip to main content

PanoSAM is a Python library for running SAM3 segmentation on equirectangular panorama images with automatic perspective projection and deduplication.

Project description

PanoSAM

SAM3 segmentation for equirectangular panorama images.

Handles perspective projection, coordinate conversion, and mask deduplication.

https://github.com/user-attachments/assets/61a546ac-3fce-4c26-b87c-3e09b0e4c331

Installation

pip install panosam[sam3]   # Recommended: includes SAM3 dependencies
Extra Command Use Case
(none) pip install panosam Bring your own engine
[sam3] pip install panosam[sam3] SAM3 segmentation
[viz] pip install panosam[viz] Visualization
[full] pip install panosam[full] All features

SAM3 requires HuggingFace authentication:

huggingface-cli login

Usage

import panosam as ps
from panosam.engines.sam3 import SAM3Engine

engine = SAM3Engine()
client = ps.PanoSAM(engine=engine, views=ps.PerspectivePreset.DEFAULT)
result = client.segment("panorama.jpg", prompt="car")

for mask in result.masks:
    print(f"{mask.label}: yaw={mask.center_yaw:.1f}, pitch={mask.center_pitch:.1f}")

result.save_json("results.panosam.json")

Custom Engine

Any class with a matching segment() method works:

class MyEngine:
    def segment(
        self,
        image: Image.Image,
        text_prompt: str,
        threshold: float = 0.5,
        mask_threshold: float = 0.5,
        simplify_tolerance: float = 0.005,
    ) -> list[ps.FlatMaskResult]:
        ...

client = ps.PanoSAM(engine=MyEngine())

Perspective Presets

Preset FOV Resolution Perspectives
DEFAULT 45° 2048x2048 16
ZOOMED_IN 22.5° 1024x1024 32
ZOOMED_OUT 60° 2500x2500 12
WIDEANGLE 90° 2500x2500 8

Documentation

See yz3440.github.io/panosam for full API reference and examples.

License

MIT

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

panosam-0.1.1.tar.gz (6.6 MB view details)

Uploaded Source

Built Distribution

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

panosam-0.1.1-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file panosam-0.1.1.tar.gz.

File metadata

  • Download URL: panosam-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for panosam-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5bbadcbde1c85ffbb3697bb93d618b695f2f422480b4d98325b47cc1a74f0480
MD5 477d8d6efda5642224a785478a7aad25
BLAKE2b-256 3e36c39be1d3fef6a6696e1876b015bd8d45885d38c7d761c318cdabeec7709c

See more details on using hashes here.

Provenance

The following attestation bundles were made for panosam-0.1.1.tar.gz:

Publisher: publish.yml on yz3440/panosam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file panosam-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: panosam-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for panosam-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 829f25cdd97393825f0c2d7619fb7900ff7be5f9a9c326d828caf41dd7b8ffd0
MD5 dd7725847de031010793031e9ec980ad
BLAKE2b-256 bdcebaefd029b36974356254d0c250be93a532c8c63d197742ff21f847248c99

See more details on using hashes here.

Provenance

The following attestation bundles were made for panosam-0.1.1-py3-none-any.whl:

Publisher: publish.yml on yz3440/panosam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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