Skip to main content

Helper library for interacting with Landing AI LandingLens

Project description

LandingLens Python SDK

The LandingLens Python SDK contains the LandingLens development library and examples that show how to integrate your app with LandingLens in a variety of scenarios. The examples cover different model types, image acquisition sources, and post-procesing techniques.

We've provided some examples in Jupyter Notebooks to focus on ease of use, and some examples in Python apps to provide a more robust and complete experience.

Example Description Type
Poker Card Suit Identification This notebook shows how to use an object detection model from LandingLens to detect suits on playing cards. A webcam is used to take photos of playing cards. Jupyter Notebook Colab
Door Monitoring for Home Automation This notebook shows how to use an object detection model from LandingLens to detect whether a door is open or closed. An RTSP camera is used to acquire images. Jupyter Notebook
Streaming Video This application shows how to continuously run inference on images extracted from a streaming RTSP video camera feed. Python application
Satellite Images and Post-Processing This notebook shows how to use a Visual Prompting model from LandingLens to identify different objects in satellite images. The notebook includes post-processing scripts that calculate the percentage of ground cover that each object takes up. Jupyter Notebook

Install the Library

pip install landingai

Quick Start

Prerequisites

This library needs to communicate with the LandingLens platform to perform certain functions. (For example, the Predictor API calls the HTTP endpoint of your deployed model). To enable communication with LandingLens, you will need the following information:

  1. The Endpoint ID of your deployed model in LandingLens. You can find this on the Deploy page in LandingLens.
  2. The API Key and API Secret for the LandingLens organization that has the model you want to deploy. To learn how to generate these credentials, go here.

Run Inference

Run inference using the endpoint you created in LandingLens:

  • Install the Python library.
  • Create a Predictor fucntion with your Endpoint ID, API Key, and API Secret.
  • Call the predict() function with an image (using the NumPy array format).
from landingai.predict import Predictor
# Find your API key and secrets
endpoint_id = "FILL_YOUR_INFERENCE_ENDPOINT_ID"
api_key = "FILL_YOUR_API_KEY"
api_secret = "FILL_YOUR_API_SECRET"
# Load your image
image = ...
# Run inference
predictor = Predictor(endpoint_id, api_key, api_secret)
predictions = predictor.predict(image)

See a working example in here.

Visualize and Save Predictions

Visualize your inference results by overlaying the predictions on the input image and saving the updated image:

from landingai.visualize import overlay_predictions
# continue the above example
predictions = predictor.predict(image)
image_with_preds = overlay_predictions(predictions, image)
image_with_preds.save("image.jpg")

Run Examples Locally

All the examples in this repo can be run locally.

To give you some guidance, here's how you can run the rtsp-capture example locally in a shell environment:

  1. Clone the repo to local: git clone https://github.com/landing-ai/landingai-python.git
  2. Install the library: poetry install --with examples (Note: See Developer Guide for how to install poetry)
  3. Activate the virtual environment: poetry shell
  4. Run: python landingai-python/examples/capture-service/run.py

Documentation

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

landingai-0.0.25.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

landingai-0.0.25-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file landingai-0.0.25.tar.gz.

File metadata

  • Download URL: landingai-0.0.25.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1038-azure

File hashes

Hashes for landingai-0.0.25.tar.gz
Algorithm Hash digest
SHA256 b0a79b41dfb75714701dfe1abe5138b88553dfbf4a05cc29335aab20a7fe8903
MD5 8323005e41d07c4b514951df79b88599
BLAKE2b-256 05ee88e83b166837e6b35cf85f6305712be09064ee4e7af78922de882edeebb8

See more details on using hashes here.

File details

Details for the file landingai-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: landingai-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1038-azure

File hashes

Hashes for landingai-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 609fb49f14034e18a9d850beb8190708b0725d0582d2d52978ada659b06c3875
MD5 8d483c9f817acf2faecd10b2af0a0e0b
BLAKE2b-256 4992f22e4f81e6d4f93884ed6fb348f3cc33470f853a9905d75f229e1a09b7b9

See more details on using hashes here.

Supported by

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