Git Product home page Git Product logo

imjoy's Introduction

Powered by ImJoy License ImJoy Version Build Site Join the chat at https://gitter.im/imjoy-dev/community image.sc forum

ImJoy - Deep Learning Made Easy!


New: We now provide ImJoy Docs, so you can now easily make interactive documentation for your ImJoy plugins.

New: Kaibu is a web application for visualizing and annotating multi-dimensional images, we provide interactive documentation for the developers to use it.

New: ImageJ.JS is our recent effort to make ImageJ running in the browser and integrated with ImJoy.


ImJoy is a plugin powered hybrid computing platform for deploying deep learning applications such as advanced image analysis tools.

ImJoy runs on mobile and desktop environment cross different operating systems, plugins can run in the browser, localhost, remote and cloud servers.

With ImJoy, delivering Deep Learning tools to the end users is simple and easy thanks to its flexible plugin system and sharable plugin URL. Developer can easily add rich and interactive web interfaces to existing Python code.

Checkout the documentation for how to get started and more details for how to develop ImJoy plugins: ImJoy Docs

Key Features of ImJoy

  • Minimal and flexible plugin powered web application

  • Server-less progressive web application with offline support

  • Support mobile devices

  • Rich and interactive user interface powered by web technologies

    • use any existing web design libraries
    • Rendering multi-dimensional data in 3D with webGL, Three.js etc.
  • Easy-to-use workflow composition

  • Isolated workspaces for grouping plugins

  • Self-contained plugin prototyping and development

    • Built-in code editor, no extra IDE is needed for development
  • Powerful and extendable computational backends for browser, local and cloud computing

    • Support Javascript, native Python and web Python
    • Concurrent plugin execution through asynchronous programming
    • Run Python plugins in the browser with Webassembly
    • Browser plugins are isolated with secured sandboxes
    • Support async/await syntax for Python3 and Javascript
    • Support Conda virtual environments and pip packages for Python
    • Support libraries hosted on Github or CDNs for javascript
    • Easy plugin deployment and sharing through GitHub or Gist
    • Deploying your own plugin repository to Github
  • Native support for n-dimensional arrays and tensors

    • Support ndarrays from Numpy for data exchange

ImJoy greatly accelerates the development and dissemination of new tools. You can develop plugins in ImJoy, deploy the plugin file to Github, and share the plugin URL through social networks. Users can then use it by a single click, even on a mobile phone

Quick Start

The easiest way to try ImJoy is to start with a plugin running directly in the browser.

For example, you can install our Image Recognition plugin with this link. Clicking the link will open the ImJoy Web App and show a dialog to confirm the installation of the plugin. Once installed, you can launch the plugin by clicking the button Image Recognition in the plugin menu on the left. The demo plugin will run a trained deep neural network model (MobileNet) to perform image classification (e.g. identifying an elephant in an image).

This plugin uses your browser as its computational backend, so all computation is done locally, no data will be sent to a remote server.

Besides running plugins in the browser, ImJoy provides the flexibility to keep the GUI locally in your browser, and perform computational tasks with Python. These computations can be performed on your computer utilising the full power of the local GPU/CPU. The computational backend can also be launched on remote servers including cloud servers on Amazon, Google Compute, or an institutional computing cluster.

Previously, running Python plugins would require installation of the Plugin Engine. However, now we have added experimental support for running Python plugins via the servers provided by MyBinder.org. You can try for example the DeepBindScan plugin without any installation.

To learn more details about ImJoy, please go to ImJoy Docs.

Repositories

Currently, ImJoy consists of the following repositories:

Documentation, questions and feedback

  1. We provide a detailed ImJoy Docs. This includes a section with frequently asked questions.
  2. For further help and questions for how to use ImJoy and process data with ImJoy, you can post on image.sc.
  3. To report bugs or suggest enhancements for ImJoy itself, please file a GitHub issue.

Acknowledgements

This is a non-exhaustive list of the open-source tools and libraries we used in ImJoy:

  • Joy.js (This is where the name ImJoy comes from!)
  • Jailed (This helps ImJoy to isolate plugins)
  • Vue.js (The main ImJoy App is written in Vue.js)
  • vue-grid-layout (For window management)
  • python-socketio (This how the plugin engine talk with the ImJoy app)
  • pyodide (Enables web python mode with WebAssembly)
  • conda (The plugin engine uses Conda for managing virtual env. and packages)
  • docsify (The ImJoy documentation is created with docsify)

We thank all the authors for offering these excellent work to the open-source community.

Support ImJoy

Please star the ImJoy GitHub repository to support ImJoy.

If you use ImJoy in your project, please add one of the badges to your code repository or website: Powered by ImJoy Launch ImJoy, see how to add an ImJoy badge.

We would like ImJoy to be a community driven framework, everyone is welcome to contribute your idea, feedback, plugins and code to the project.

If you are interested in contributing to the project, please read our guideline here.

Citation

Please cite our paper on Nature Methods (https://www.nature.com/articles/s41592-019-0627-0, free access: https://rdcu.be/bYbGO ):

Ouyang, W., Mueller, F., Hjelmare, M. et al. ImJoy: an open-source computational platform for the deep learning era. Nat Methods (2019) doi:10.1038/s41592-019-0627-0

Code of Conduct

Help us keep the ImJoy community open and inclusive. Please read and follow our Code of Conduct.

License

MIT License

imjoy's People

Contributors

gitter-badger avatar gywgithub avatar martinhjelmare avatar muellerflorian avatar oeway avatar steffen-wolf avatar thewtex avatar truatpasteurdotfr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imjoy's Issues

Add Black code formatter

This issue is targeting the ImJoy-Engine repo.

  • https://github.com/python/black
  • The process will look like this:
    1. developer adds some code.
    2. developer runs black on code.
    3. developer commits code
    4. (optional pre-commit hook that runs black)
    5. developer makes a PR.
    6. CI runs black and checks that no changes were needed. If changes were needed, exits with 1.

Todo

  • Add black code formatter and format repo code.
  • Add CI check for black to keep code black.

Add prettier code formatter

Outline

  • https://prettier.io/
  • We add it to package.json.
  • We should check and configure compatibility with eslint.
  • We provide an optional pre-commit-hook.
  • There are editor plugins for most editors.
  • We add CI check.
  • We provide a script to easily run prettier on the correct files locally, as we do in CI.
    • Commandline will be something like this:
    :~/Dev/ImJoy/web$ prettier --write "{src,tests}/**/**(.js|.vue)"
    
    • Replace --write with --check for CI checking.
    • Make sure to exclude plugin html which includes python.

Todo

  • Add prettier to package.json.
  • Configure eslint compatibility.
  • Add script to format and check format.
  • Add CI check.
  • Format all relevant files.

Only one root element in <window>

Right now, we use plugin file parser is for vuejs, and it enforces the rule that there can only be one root element in the template, as a result, for window plugin in ImJoy, we have to also use a single root element.

The following won't work:

<window>
  <p> line 1</p>
  <p> line 2</p>
</window>

Instead, you should use a

to wrap these nodes:

<window>
  <div>
    <p> line 1</p>
    <p> line 2</p>
  </div>
</window>

The question is, should we add a <div> by default?

Warn the developer when the api_version is outdated

We use the field api_version in <config> to make sure the api functions and the way plugin is parsed can be upgraded or warned when a certain api function is deprecated or changed.

The core of ImJoy will read the api_version of the plugin and use that version to load plugin, and this essentially give backward compatibility but still allow us to evolve the api.

To ensure quicker trasisson to new api, it would be better to do the api check and warn the developer when the api version do not match the master api version. This will make sure the api are upgraded.

Offline support using service workers

Related to #2 , would be really useful to have offline support through service worker without using the plugin engine.

Not only the html/js/css files from the main app, but also those files set as requirements for every plugins needs to be cached in the service worker.

Support `requirements` and `env` for javascript plugins

requirements and env are currently used for Python Plugins, however, these two interfaces can be also used by javascript plugins.

  • requirements can be used for defining the required js dependencies, they can be listed as an array or urls and downloaded into the browser database, such that javascript plugins can run offline.

  • env can be used to define the supported browsers, by matching agent strings or just with browser name. This is essential to tell when a plugin is not tested on mobile but ran on mobile device, ImJoy can decide whether to display such plugins or give a warning to the user.

Add linters

This task is part of https://github.com/oeway/ImJoy-Engine.

  • Static code analysis catches bugs in CI or even in the developer's editor. We should add flake8 and pylint to facilitate this.
  • Fix lint errors and cherry-pick them separately into PRs, first.
  • Add flake8, pydocstyle and pylint to lint requirements file.
  • Run flake8, pydocstyle and pylint in tox lint env.
  • Add config files with needed config and exceptions.

Engine failed to launch plugin

After upgrading the engine to v0.7.65, a plugin failed:

Screen Shot 2019-05-12 at 3 10 38 PM

<config lang="json">
{
  "name": "xxxxxxx",
  "type": "native-python",
  "version": "0.3.3",
  "api_version": "0.1.3",
  "description": "[TODO: describe this plugin with one sentence.]",
  "tags": ["CPU"],
  "ui": "",
  "inputs": null,
  "outputs": null,
  "flags": ["allow-detach", "single-instance"],
  "icon": "extension",
  "env": "",
  "requirements": "",
  "cmd": "python",
  "dependencies": []
}
</config>

Improvements in ImJoy UI

  • Better visual separation between different plugins in plugin menu
  • Allow to change default font size of ImJoy
  • Allow plugin window to be resized

Unit test for plugins and integration with CI?

Would be nice to have a docker image and some scripts to run unit test for plugins, at least for those published on the official plugin repository. It would help us to test not only the plugins itself, but also verfy the new upgrades of ImJoy whether it break all the plugins.

Support Python plugins without plugin engine

With webassembly, it's now possible to run python plugins without the plugin engine. Supporting python plugins which does not rely on the plugin engine would essentially free the users from installing the plugin engine and increase the security level. Python plugins running in the web browser should be more reproducible than those native python plugins, since the browser provide a more unified environment.

Caching API calls

Should we provide an internal caching mechanism to cache results of api calls? Especially when accessing the api functions remotely, the call can be expensive, it would be nice to optionally make an api function result being cached.

We can basically generate a signature with its parameters when encoding the arguments and store the recent results inside the browser. The missing part is:

  1. How to mark cachable functions? We need a way to specify which function should be cached, maybe when export the api functions, or add an api function to allow dynamically enable and disable caching
  2. How do we store the cache? An naive implementation would be use an object and store the result in memory.
  3. How to manage the life cycle of the cache, and the overall cache size, when to make it invalid?

Importantly, the caching should be optional and disabled by default.

@MartinHjelmare what's your thought on this?

Support cross-repository plugin dependency

Currently, one plugin depend on an other plugin can be illustrated with the field dependencies in <config> block. However, it does not handle cross-repository dependencies.

Plugins can described with the following format: REPO_URL@COMMIT_HASH_TAG:PLUGIN_NAME@TAG. The REPO_URL and TAG are optional:

  1. if no REPO_URL specified, use the same repository url as the one is referring to. : should be remove if no REPO_URL specified.
  2. if no tag specified, use the default tag or without a tag. @ should be remove if no TAG specified.

Plugin update notification

When loading ImJoy, it would be nice to compare the versions of all the installed plugins and notify the user if updates for plugins are available.

Support test api for plugins

Since tests are important to verify and guarantee whether a certain plugin is functioning, or on the other hand check if changes in ImJoy breaks certain plugins. Right now there is no way to do it automatically, but this could be solved by introducing a test function to the plugin interface.

Here is what I propose:

  1. each plugin should (must?) define an api function called test() along with setup() in the plugin class.
  2. the test() function should accept no argument except self for python, and it should bootstrap itself, generate/simulate/download data, run other functions defined in the plugin, verify the result and throw error (with error message).
  3. add a test button on the code editor toolbar to allow developers quickly run this test function during developing.
  4. setup Travis to do automatic test all the plugins hosted on oeway/ImJoy-Plugins and oeway/ImJoy-Demo-Plugins with the latest version of ImJoy.

Support plugin installation env targets (GPU/CPU/Windows/Mac etc.)

Would be good to have an option for the user to choose when installing a plugin, depends on the option chose by the user, the plugin can run in different modes and have different dependencies.

For example, for a deep learning based plugin, one may want to have two type of environments: GPU and CPU.

For doing that, the developer can define the env as a dictionary: {"cpu": "conda create -n seg-cpu python=3.6 tensorflow", "gpu": "conda create -n seg-cpu python=3.6 tensorflow-gpu"} or an array: ["gpu", "cpu"]. The same for dependencies.

The selected env should be exposed through api such that the plugin code could access it and decide what to do in different modes.

Bugs in the code editor

Since recent changes for supporting unit test, the Monaco editor becomes buggy. At least two problems are identified:

  1. reported by @muellerflorian "cmd-Z is doing strange things sometimes. it deletes things that were not affected, moves stuff around and pastes fragments are different locations."
  2. Ctrl+V does not work on windows (@muellerflorian ) and Linux ( @oeway ).

Issue the close event to the plugin when closing the browser tab

Currently when closing the browser, the close event is not passed to the plugins, and it would make more sense to issue this event.

One thing need to be decide for resumable plugins is how do we differentiate that the user want to actually restart the plugin or just detach tempoarary. Perhaps we can pass this to the onClose handler functions, and allow the plugins to decide what to do.

Make a default/recommended virtual environment for Python plugins

ImJoy support creating virtual env through conda, which makes plugins work with their own env without interfere each other. However, on the other side, it diverge the dependencies of the plugins, and since each virtual env have a significant storage footprint, it takes too much storage space when the user install many different plugins which create their own env.

One way to improve is to propose a default and recommended virtual env, and we recommended all new plugins to develop and test in this default env instead of creating a new one. That would be benificial for the user to have a minimal installation in terms of size.

If only for this reason, we could just recommend to use the latest anaconda environment as the default env.

Another thing to consider is to have a virtual env compatible with the web python plugins, since for web python plugins, we can only choose those libraries provided by pyodide, we can therefore make the default env inline with pyodide.

api.setConfig/getConfig does not work

Reported by @muellerflorian , it can be reproduced with the following steps:

  1. create a webworker plugin
  2. save and run with:
class ImJoyPlugin {
  async setup() {
  }
  async run(my) {
    console.log('running in the plugin ', my)
    await api.setConfig('a', 5)
    const a = await api.getConfig('a')
    console.log(a)
  }
}
  1. when clicking the plugin menu, it output null which should be 5

Unified Virtual File System

Currently, there are two different ways to handle loading/saving files for plugins with or without the plugin engine. For Javascript plugins, file can use browser file dialog to load file and trigger downloads for exporting files. There is no way to persist files in javascript plugins without user interaction. So it would be nice to have a virtual file system which can be fully accessed from javascript.

For Python plugins, files can be directly accessed from the file system. When file urls are generated from the file system, other plugins have to handle differently for files from url or a file object. A virtual file system could potentially unify these different types of files.

Among those different solutions, BrowserFS looks promising for ImJoy.

Chrome crashes after reloading a web python plugin for a few times

How to reproduce: install a web python plugin and then reload for 2~3 times, the memory usage of ImJoy.io continuous increases and then crash.

Possibly because the pyodide enviroment is not released correctly when the plugin iframe is closed, and there is a memory leak in Chrome.

For the same plugin, firefox do not seem to crash.

Support Fiji/ImageJ backend in the Plugin Engine

We have been thinking about extending the support to Fiji/ImageJ, to take advantage of the current advancement of the Fiji/ImageJ world. On the other hand, we will be able to add web interface to Fiji/ImageJ scripts easily.

Specifically, the goal is to support a new ImJoy plugin type written in any/most of the supported Fiji scripting languages, these plugins will be able to interact with ImJoy and other plugins through the api object.

Implementing the Fiji/ImageJ backend will be similar as the ImJoy Python Engine. The easiest way to support ImageJ backend is to port this worker template file to ImageJ ( as javaWorkerTemplate.py in Jython). We also need to add socketio client to imagej.

For each ImJoy plugin with type=imagej, we will launch a subprocess from the plugin engine. It will be just a command like ./ImageJ-linux64 -Xss2m -- /path/to/javaWorkerTemplate.py.

Transfer large object within webworker plugins

Currently, when large objects are returned within a webworker plugin, the entire app crashes.

This can be improved by passing a list of buffers in the PostMessage call: PostMesage(aMessage, transferList). Like that, large object will just transfers ownership between objects without duplicating the object.

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.