Skip to main content

ci_status PyPI version version license downloads


LandingLens Python Library

The LandingLens Python library 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.

Documentation

Quick start

Install

First, install the LandingAI Python library:

pip install landingai

Acquire Your First Images

After installing the LandingAI Python library, you can start acquiring images from one of many image sources.

For example, from a single image file:

from landingai.pipeline.frameset import Frame

frame = Frame.from_image("/path/to/your/image.jpg")
frame.resize(width=512, height=512)
frame.save_image("/tmp/resized-image.png")

You can also extract frames from your webcam. For example:

from landingai.pipeline.image_source import Webcam

with Webcam(fps=0.5) as webcam:
    for frame in webcam:
        frame.resize(width=512, height=512)
        frame.save_image("/tmp/webcam-image.png")

To learn how to acquire images from more sources, go to Image Acquisition.

Run Inference

If you have deployed a computer vision model in LandingLens, you can use this library to send images to that model for inference.

For example, let's say we've created and deployed a model in LandingLens that detects coffee mugs. Now, we'll use the code below to extract images (frames) from a webcam and run inference on those images.

[!NOTE] If you don't have a LandingLens account, create one here. You will need to get an "endpoint ID" and "API key" from LandingLens in order to run inferences. Check our Running Inferences / Getting Started.

[!NOTE] Learn how to use LandingLens from our Support Center and Video Tutorial Library. Need help with specific use cases? Post your questions in our Community.

from landingai.pipeline.image_source import Webcam
from landingai.predict import Predictor

predictor = Predictor(
    endpoint_id="abcdef01-abcd-abcd-abcd-01234567890",
    api_key="land_sk_xxxxxx",
)
with Webcam(fps=0.5) as webcam:
    for frame in webcam:
        frame.resize(width=512)
        frame.run_predict(predictor=predictor)
        frame.overlay_predictions()
        if "coffee-mug" in frame.predictions:
            frame.save_image("/tmp/latest-webcam-image.png", include_predictions=True)

Examples

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 Colab
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 Colab
License Plate Detection and Recognition This notebook shows how to extract frames from a video file and use a object detection model and OCR from LandingLens to identify and recognize different license plates. Jupyter Notebook Colab
Streaming Video This application shows how to continuously run inference on images extracted from a streaming RTSP video camera feed. Python application

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 (See the poetry docs for how to install poetry)
  3. Activate the virtual environment: poetry shell
  4. Run: python landingai-python/examples/capture-service/run.py

Metadata

Release files for landingai 0.3.49

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for landingai 0.3.49
File Size Uploaded Provenance Actions
landingai-0.3.49.tar.gz 1.0 MB Without provenance Details for landingai-0.3.49.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for landingai 0.3.49
File Interpreter ABI Platform Actions
landingai-0.3.49-py3-none-any.whl Python 3 none any Details for landingai-0.3.49-py3-none-any.whl

Total release size: 2.1 MB

Release files / landingai-0.3.49.tar.gz

Download URL landingai-0.3.49.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
9bc8051f3ecf2b686b285b03967cc42c47931dae62f54dafd5a23be7c95fb2b3
BLAKE2b-256 checksum
How to use checksums
1013a11121c5df3629ab8a21bceeb599fa07ebf1fc764153c14a460adf354a31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/6.5.0-1025-azure

Release files / landingai-0.3.49-py3-none-any.whl

Download URL landingai-0.3.49-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ed6c74bdd1a09d963910f646edf1c2268615a76161a37dabfcafc7fc7df4f1c2
BLAKE2b-256 checksum
How to use checksums
04b54cc5b10dfb542ef8008dd9f6142c4999b02cc49665c12962a57470ade883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/6.5.0-1025-azure

Security for landingai 0.3.49

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.49 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page