Git Product home page Git Product logo

imageanalyst's Introduction

ImageAnalyst

ImageAnalyst is a library that simplifies image analysis. The library achieves this goal by standardizing the input and output vectors of a few machine learning models and by providing some high-level analysis algorithms.

Requirements

The application requires:

Extras

The application has some extras that can be installed:

Download & Installation

There is two ways to download and install the application.

Using PyPI

You can download and install the application using PyPI. To do so, run the following command:

pip install image-analyst

Using the GitHub releases

You can download the application on the downloads page. Then, you can install the application by running the following command:

pip install image_analyst-X.X.X-py3-none-any.whl

(Note: The X.X.X must be replaced by the version that you want to install.)

Example

This example allows you to track objects from your webcam. It requires the cv2 extra.

from image_analyst.cv2.utils import convert_image, create_frame_generator
from image_analyst.cv2.models import YoloV3OpenCV
from image_analyst.trackers import IOUTracker
import cv2

def report_callback(filename: str, current_size: float, total_size: float):
    print("{} {:.2f}%".format(filename, current_size/total_size*100), end="\r", flush=True)

model = YoloV3OpenCV.coco(report_callback=report_callback)

tracking_function = IOUTracker(model)

with create_frame_generator(0) as frame_generator:
    for frame in frame_generator:
        converted_frame = convert_image(frame, model.supported_format, model.supported_dtype)
        instances = tracking_function(converted_frame)

        for instance in instances:
            xmin, ymin, xmax, ymax = instance.bounding_box.as_tuple()

            text = "{} {} {:.2f}".format(instance.id, instance.class_name, instance.score)
            cv2.rectangle(frame, (xmin, ymin), (xmax, ymax), (0, 255, 0), 2)
            cv2.putText(frame, text, (xmin, ymin), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)

        cv2.imshow("Tracking", frame)

        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

cv2.destroyAllWindows()

License

All code is licensed for others under a MIT license (see LICENSE).

imageanalyst's People

Contributors

berglucas avatar

Watchers

 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.