Code Monkey home page Code Monkey logo

norfair's Introduction

Norfair by Tryolabs logo

Fork of https://github.com/tryolabs/norfair
Customized for Maritime Vessel Tracking.

Features

  • Detection class support MMSI and message_type (ex. AIS)
  • The distance function is matrix, for fast computation.

Installation

git clone https://github.com/rs9000/norfair

How it works

Define a matrix euclidean distance metric

def matrix_euclidean(threshold, detections, objects):
    detections_arr = np.array([x.points for x in detections])
    objects_arr = np.array([x.estimate[0] for x in objects])
    same_mmsi = np.array([x.mmsi == y.mmsi for x in detections for y in objects]).reshape(len(detections), len(objects))

    distance_matrix = scipy.spatial.distance_matrix(detections_arr, objects_arr)
    distance_matrix[distance_matrix > threshold] = threshold + 1
    distance_matrix[same_mmsi] = 0

    return distance_matrix

Tracking Example

class Message():
    def __init__(self, timestamp, position, stn, mmsi, type):
        self.timestamp = timestamp
        self.position = position
        self.mmsi = mmsi
        self.type = type


tracker = Tracker(distance_function=matrix_euclidean, distance_threshold=0.5,
                  initialization_delay=3)

messages_t0 = [Message("987298479", np.array([44, 22]), "873624", "AIS"),
            Message("987298479", np.array([44, 22]), "873624", "AIS")]

messages_t1 = [Message("987298479", np.array([44, 22]), "873624", "AIS"),
            Message("987298479", np.array([44, 22]), "873624", "AIS")]

messages_t2 = [Message("987298479", np.array([44, 22]), "873624", "AIS"),
            Message("987298479", np.array([44, 22]), "873624", "AIS")]


messages = [messages_t0, messages_t1, messages_t2]

for t in messages:
    detections = [Detection(points=np.array([x.position for x in t]),
                            mmsi=[x.mmsi for x in t],
                            message_type=[x.message_type for x in t])]

    tracked_objects = tracker.update(detections=detections)

Citing Norfair

For citations in academic publications, please export your desired citation format (BibTeX or other) from Zenodo.

License

Copyright © 2022, Tryolabs. Released under the BSD 3-Clause.

norfair's People

Contributors

joaqo avatar dekked avatar wakame1367 avatar 3dgiordano avatar facundo-lezama avatar donbraulio avatar fcakyon avatar rs9000 avatar shafu0x avatar aguscas avatar huh-david avatar

Stargazers

Roman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.