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 @ git+https://github.com/yz3440/panosam.git"
Extra Dependencies Use Case
(none) pillow, numpy, geopandas, shapely, py360convert Bring your own engine
[sam] + torch, transformers, opencv SAM3 segmentation
[viz] + opencv, matplotlib Visualization
[full] sam + viz 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.0.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.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: panosam-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 6b775cbc911fe3bbdec326c8424a3c04e70eca2fe839ecd139a56d9b7bf5df54
MD5 b0041f7d96f7ef5df4685ff1dec1edc9
BLAKE2b-256 e0f85c4fe79ede67a2b416e790556e9867b5a6caaac771d08fcc4249da107066

See more details on using hashes here.

Provenance

The following attestation bundles were made for panosam-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: panosam-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f79caf3f2cd60325b9b87eef6531dcfb8e33fbe24ee1d47ebbf1b258b940d59
MD5 7c1bf1ceb67e7f764df9505a50b085f2
BLAKE2b-256 ed40348a72a465677065b44b35e9fc04b436772bdba61a0694ff2e9a88338372

See more details on using hashes here.

Provenance

The following attestation bundles were made for panosam-0.1.0-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