https://github.com/simleek/displayarray

A OpenCV interface to display tensors, multiple cameras, and so on.

https://github.com/simleek/displayarray

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.8%) to scientific vocabulary

Keywords

display-tensors numpy python pytorch tensorflow video webcam
Last synced: 6 months ago · JSON representation

Repository

A OpenCV interface to display tensors, multiple cameras, and so on.

Basic Info
  • Host: GitHub
  • Owner: SimLeek
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 31.6 MB
Statistics
  • Stars: 12
  • Watchers: 1
  • Forks: 3
  • Open Issues: 9
  • Releases: 13
Topics
display-tensors numpy python pytorch tensorflow video webcam
Created about 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.rst

displayarray
============

A library for displaying arrays as video in Python.

Display arrays while updating them
----------------------------------

.. figure:: https://i.imgur.com/UEt6iR6.gif
   :alt: 

::

    from displayarray import display
    import numpy as np

    arr = np.random.normal(0.5, 0.1, (100, 100, 3))

    with display(arr) as d:
        while d:
            arr[:] += np.random.normal(0.001, 0.0005, (100, 100, 3))
            arr %= 1.0

Run functions on 60fps webcam or video input
--------------------------------------------

|image0|

(Video Source: https://www.youtube.com/watch?v=WgXQ59rg0GM)

::

    from displayarray import display
    import math as m

    def forest_color(arr):
        forest_color.i += 1
        arr[..., 0] = (m.sin(forest_color.i*(2*m.pi)*4/360)*255 + arr[..., 0]) % 255
        arr[..., 1] = (m.sin((forest_color.i * (2 * m.pi) * 5 + 45) / 360) * 255 + arr[..., 1]) % 255
        arr[..., 2] = (m.cos(forest_color.i*(2*m.pi)*3/360)*255 + arr[..., 2]) % 255

    forest_color.i = 0

    display("fractal test.mp4", callbacks=forest_color, blocking=True, fps_limit=120)

Display tensors as they're running through TensorFlow or PyTorch
----------------------------------------------------------------

.. figure:: https://i.imgur.com/TejCpIP.png
   :alt: 

::

    # see test_display_tensorflow in test_simple_apy for full code.

    ...

    autoencoder.compile(loss="mse", optimizer="adam")

    while displayer:
        grab = tf.convert_to_tensor(
            displayer.FRAME_DICT["fractal test.mp4frame"][np.newaxis, ...].astype(np.float32)
            / 255.0
        )
        grab_noise = tf.convert_to_tensor(
            (((displayer.FRAME_DICT["fractal test.mp4frame"][np.newaxis, ...].astype(
                np.float32) + np.random.uniform(0, 255, grab.shape)) / 2) % 255)
            / 255.0
        )
        displayer.update((grab_noise.numpy()[0] * 255.0).astype(np.uint8), "uid for grab noise")
        autoencoder.fit(grab_noise, grab, steps_per_epoch=1, epochs=1)
        output_image = autoencoder.predict(grab, steps=1)
        displayer.update((output_image[0] * 255.0).astype(np.uint8), "uid for autoencoder output")

Handle input events
-------------------

Mouse events captured whenever the mouse moves over the window:

::

    event:0
    x,y:133,387
    flags:0
    param:None

Code:

::

    from displayarray.input import mouse_loop
    from displayarray import display

    @mouse_loop
    def print_mouse_thread(mouse_event):
        print(mouse_event)

    display("fractal test.mp4", blocking=True)

Installation
------------

displayarray is distributed on `PyPI `__ as a
universal wheel in Python 3.6+ and PyPy.

::

    $ pip install displayarray

Usage
-----

API has been generated `here `_.

See tests and examples for example usage.

License
-------

displayarray is distributed under the terms of both

-  `MIT License `__
-  `Apache License, Version
   2.0 `__

at your option.

.. |image0| image:: https://thumbs.gfycat.com/AbsoluteEarnestEelelephant-size_restricted.gif
   :target: https://gfycat.com/absoluteearnesteelelephant

Owner

  • Login: SimLeek
  • Kind: user

Just having fun and trying to make some smart robots.

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 215
  • Total Committers: 5
  • Avg Commits per committer: 43.0
  • Development Distribution Score (DDS): 0.051
Top Committers
Name Email Commits
SimLeek j****s@g****m 204
SimLeek s****k@g****m 7
John j****e@a****u 2
Nelson Chen c****m@g****m 1
Josh Miklos s****k@g****m 1
Committer Domains (Top 20 + Academic)
asu.edu: 1

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 17
  • Total pull requests: 30
  • Average time to close issues: 8 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 0.88
  • Average comments per pull request: 0.03
  • Merged pull requests: 28
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • SimLeek (15)
  • Ajinkz (1)
  • ldpgh (1)
Pull Request Authors
  • SimLeek (27)
  • nelsonjchen (2)
  • sampanes (1)
Top Labels
Issue Labels
enhancement (7) required feature (1) bug (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 63 last-month
  • Total docker downloads: 133,310
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 2
    (may contain duplicates)
  • Total versions: 15
  • Total maintainers: 1
pypi.org: displayarray

Tool for displaying numpy arrays.

  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 39 Last month
Rankings
Dependent packages count: 10.0%
Average: 17.6%
Downloads: 21.2%
Dependent repos count: 21.7%
Maintainers (1)
Last synced: 6 months ago
pypi.org: svtk

Streaming addons for VTK

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 24 Last month
  • Docker Downloads: 133,310
Rankings
Docker downloads count: 1.1%
Dependent packages count: 10.1%
Average: 21.3%
Dependent repos count: 21.6%
Downloads: 52.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

setup.py pypi
  • docopt ==0.6.2
  • localpubsub ==0.0.4
  • numpy >=1.14.5
  • opencv-python ==4.
  • pyzmq >=22.0.3
  • tensorcom *
.github/workflows/publish.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v1 composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/pythonpackage.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v1 composite