Skip to main content

Open vocabulary detection and segmentation package

Project description

Open vocabulary segmentation

Models

  • GroundingDINO
  • MobileSAMv2:
    • trt (predictor, generator)
    • torch (predictor)
  • MobileSAMv1 (predictor, generator)

Usage

Get detection

from ovsegmentation import build_segmentator, visualize, get_waypoint, OVSegmentation
input_data = {
    "image": image,
    "text": ovd_prompt,
    "depth": depth_image,
    "intrinsics": intrinsics,
    "tf": None 
}
Note: "tf" could be None or transform_matrix: np.array (4,4) 

ovs = build_segmentator(weights_path='weights')

res = ovs.get_detections(input_data, detect_most_confident=False)
# res = ovs.generate_masks(input_data)

Visualize

annotated_image, labels = visualize(
    image, res, instance_random_color=True, draw_bbox=True
)
plt.figure(figsize=(15, 8))
plt.imshow(annotated_image)
plt.show()

Weights structure

Weights structure:

  • MobileSAMv2:
    • trt
      • WEIGHTS_DIR/MobileSAM/l2_encoder.engine
      • WEIGHTS_DIR/MobileSAM/mobilesamv2_decoder.engine
      • WEIGHTS_DIR/MobileSAM/ObjectAwareModel.engine
    • torch
      • WEIGHTS_DIR/MobileSAM/Prompt_guided_Mask_Decoder.pt
      • WEIGHTS_DIR/MobileSAM/l2.pt
  • MobileSAMv1:
    • WEIGHTS_DIR/MobileSAM/mobile_sam.pt
  • GroundingDINO:
    • WEIGHTS_DIR/GroundingDINO/groundingdino_swint_ogc.pth

weights_path: WEIGHTS_DIR

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

ovsegmentation-1.0.41-py3-none-any.whl (755.9 kB view details)

Uploaded Python 3

File details

Details for the file ovsegmentation-1.0.41-py3-none-any.whl.

File metadata

  • Download URL: ovsegmentation-1.0.41-py3-none-any.whl
  • Upload date:
  • Size: 755.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for ovsegmentation-1.0.41-py3-none-any.whl
Algorithm Hash digest
SHA256 d6a985165b6f90969b2d86a11913dc9275bc23ae110bf4c01cf591de9f0c90c7
MD5 143033b68a224c3faf6449da9c781a65
BLAKE2b-256 517264541d0fd8c3a4ff767463a17f424dfe4e8289250adc96f6740f1e382544

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