Skip to main content

Pattern Discovery Kit

Project description

https://github.com/mansour-b/pattern-discovery-kit/blob/main/assets/patrick_hollywood.png

PATteRn dIsCovery Kit (PATRICK)

Build Status Code Coverage

Welcome to the Pattern Discovery Kit!

This library provides tools to discover, detect, and track meaningful patterns in physical signals. These signals can be of various forms:

  1. Time series,

  2. Images,

  3. Movies,

  4. Any other type of n-dimensional data.

Installation

You can install the pattern-discovery-kit from the source code by doing the following:

pip install pattern-discovery-kit

You can then try running this notebook on your computer to verify that the installation was succesful.

Quickstart

Here is an example to briefly present the API:

import numpy as np

from patrick.core import Box, Frame, Model, Movie, Tracker
from patrick.display import plot_frame

# Define the dimensions of the problem
frame_width = 5
frame_height = 5
movie_length = 3
gif_frames_per_second = 2

# Define a concrete model class, just for the example
class DumbModel(Model):
    def predict(self, frame: Frame) -> Frame:
        frame_id = int(frame.name)
        frame.annotations.append(
            Box(label="noise_in_a_square", x=frame_id, y=frame_id, width=1, height=1)
        )
        return frame

model = DumbModel()

# Our data for this short tutorial
frames = [
    Frame(
        name=str(10 * i),
        width=frame_width,
        height=frame_height,
        annotations=[],
        image_array=np.random.random(frame_height, frame_width),
    )
    for i in range(movie_length)
]

movie = Movie(name="some_noise", frames=frames, tracks=[])

# Run the detection model on individual frames
analysed_frames = [model(frame) for frame in movie.frames]
analysed_movie = Movie(
    name="some_noise_with_boxes", frames=analysed_frames, tracks=[]
)

# TBD: run tracker on detections
analysed_movie = tracker.make_tracks(analysed_movie)
analysed_movie.name = "some_noise_with_boxes_and_tracks"

# Plot individual frames with detections
for frame in analysed_movie:
    plot_frame(frame)

# TBD: make a GIF to show the tracks
export_to_gif(analysed_movie, fps=gif_frames_per_seconds)

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

pattern_discovery_kit-0.2.2.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

pattern_discovery_kit-0.2.2-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file pattern_discovery_kit-0.2.2.tar.gz.

File metadata

  • Download URL: pattern_discovery_kit-0.2.2.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for pattern_discovery_kit-0.2.2.tar.gz
Algorithm Hash digest
SHA256 8225cdd7655762b273bbb0d3cbff3652740486124e3bc88bfcfbd2aafc83aa55
MD5 32c795f1392eb0625a053e08023fb76d
BLAKE2b-256 27f50138c7ebfe6f7c637ce2fbd95d41b7bc9b5e32db7a9ce754b76680facce2

See more details on using hashes here.

File details

Details for the file pattern_discovery_kit-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pattern_discovery_kit-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9f8ab823a8bbf7f44aa6faee2b01fe8fc6f7c41eacce46baaf609a5c0aba11ca
MD5 86757e31c0542a0decedbbc77fa674bd
BLAKE2b-256 e16d7eb6dfcdddc8bd98ea9ca3f0e5105221d24943f2305ac7faf08dd9fdd5d1

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