Giter Club home page Giter Club logo

fabrik's Introduction

Join the chat at https://gitter.im/Cloud-CV/Fabrik Build Status Coverage Status Documentation Status

Fabrik is an online collaborative platform to build, visualize and train deep learning models via a simple drag-and-drop interface. It allows researchers to collectively develop and debug models using a web GUI that supports importing, editing and exporting networks to popular frameworks like Caffe, Keras, and TensorFlow.

This app is presently under active development and we welcome contributions. Please check out our issues thread to find things to work on, or ping us on Gitter.

Installation Instructions

Setting up Fabrik on your local machine is very easy. You can setup Fabrik using two methods:

Using Docker

Docker Installation

If you haven't installed Docker already:

To install Docker for Windows click here.

To install Docker for Mac click here.

Fabrik Installation

  1. Get the source code on to your machine via git.

    git clone https://github.com/Cloud-CV/Fabrik.git && cd Fabrik
    
  2. Rename settings/dev.sample.py as dev.py.

    cp settings/dev.sample.py settings/dev.py
    
  3. Build and run the Docker containers. This might take a while. You should now be able to access Fabrik at http://0.0.0.0:8000.

    docker-compose up --build
    

Setup Authentication for Docker Environment

  1. Go to Github Developer Applications and create a new application. here

  2. For local deployments,the following should be used in the options:

  3. Github will provide you with a Client ID and a Secret Key. Save these.

  4. Create a superuser in django service of docker container

    docker-compose run django python manage.py createsuperuser
    

    Note: Before creating the superuser, make sure that django service of docker image is running. This can be done by executing docker-compose up followed by Ctrl + C to save docker configuration.

  5. Open http://0.0.0.0:8000/admin and login with the credentials from step 4.

  6. Setting up Social Accounts in django admin

    • Under Social Accounts, open Social applications and click on Add Social Application.

    • Choose the Provider of social application as Github and name it Github.

    • Add the sites available to the right side, so github is allowed for the current site.

    • Copy and paste your Client ID and Secret Key into the apppropriate fields and Save.

  7. Go to Sites tab and update the Domain name to 0.0.0.0:8000.

Using Virtual Environment

  1. First set up a virtualenv. Fabrik runs on Python2.7.

    sudo apt-get install python-pip python-dev python-virtualenv
    virtualenv --system-site-packages ~/Fabrik --python=python2.7
    source ~/Fabrik/bin/activate
    
  2. Clone the repository via git

    git clone --recursive https://github.com/Cloud-CV/Fabrik.git && cd Fabrik
    
  3. Rename settings/dev.sample.py as settings/dev.py and change credentials in settings/dev.py

    cp settings/dev.sample.py settings/dev.py
    
    • Change the hostname to localhost in settings/dev.py line 15. It should now look like this:
    'HOST': os.environ.get("POSTGRES_HOST", 'localhost'), 
    
  4. Install redis server

    sudo apt-get install redis-server
    
    • Change the hostname to localhost in settings/common.py line 115.

      "CONFIG": {
          # replace redis hostname to localhost if running on local system
          "hosts": [("localhost", 6379)],
          "prefix": u'fabrik:',
          },
      
    • Replace celery result backend in settings/common.py line 122 with localhost.

      CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
      
    • Change celery broker URL and result backend hostname to localhost in ide/celery_app.py, line 8.

      app = Celery('app', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0', include=['ide.tasks'])
      
  5. If you already have Caffe, Keras and TensorFlow installed on your computer, skip this step.

  • For Linux users

    • Install Caffe, Keras and Tensorflow

      cd Fabrik/requirements
      yes Y | sh caffe_tensorflow_keras_install.sh
      
    • Open your ~/.bashrc file and append this line to the end

      export PYTHONPATH=~/caffe/caffe/python:$PYTHONPATH
      
    • Save, exit and then run

      source ~/.bash_profile
      cd ..
      
  • For Mac users

  1. Install dependencies
  • For developers:

    pip install -r requirements/dev.txt
    
  • For others:

    pip install -r requirements/common.txt
    
  1. Install postgres >= 9.5
  • Setup postgres database

    • Start postgresql by typing sudo service postgresql start

    • Now login as user postgres by running sudo -u postgres psql and type the commands below:

      CREATE DATABASE fabrik;
      CREATE USER admin WITH PASSWORD 'fabrik';
      ALTER ROLE admin SET client_encoding TO 'utf8';
      ALTER ROLE admin SET default_transaction_isolation TO 'read committed';
      ALTER ROLE admin SET timezone TO 'UTC';
      ALTER USER admin CREATEDB;
      
    • Exit psql by typing in \q and hitting enter.

  • Migrate

    python manage.py makemigrations caffe_app
    python manage.py migrate
    
  1. Install node modules

    npm install
    npm install --save-dev json-loader
    sudo npm install -g [email protected]
    
    • Run the command below in a separate terminal for hot-reloading, i.e. see the changes made to the UI in real time.
    webpack --progress --watch --colors
    
  2. Start celery worker

    celery -A ide worker --app=ide.celery_app  --loglevel=info
    

    The celery worker needs to be run in parallel to the django server in a separate terminal.

  3. Start django application

    python manage.py runserver
    

    You should now be able to access Fabrik at http://localhost:8000.

Setup Authentication for Virtual Environment

  1. Go to Github Developer Applications and create a new application. here

  2. For local deployments, the following should be used in the options:

  3. Github will provide you with a client ID and secret Key, save these.

  4. Create a superuser in django

    python manage.py createsuperuser
    
  5. Start the application

    python manage.py runserver
    
  6. Open http://localhost:8000/admin

  7. Login with the credentials from step 4.

  8. Setting up Social Accounts in django admin :

    • Under Social Accounts open Social applications, click on Add Social Application.

    • Choose the Provider of social application as Github & name it Github.

    • Add the sites available to the right side, so github is allowed for the current site. This should be localhost:8000 for local deployment.

    • Copy and paste your Client ID and Secret Key into the appropriate fields and Save.

  9. From the django admin home page, go to Sites under the Sites category and update Domain name to localhost:8000.

Note: For testing, you will only need one authentication backend. However, if you want to try out Google's authentication, then, you will need to follow the same steps as above, but switch out the Github for Google.

Usage

python manage.py runserver

Example

  • Use example/tensorflow/GoogleNet.pbtxt for TensorFlow import
  • Use example/caffe/GoogleNet.prototxt for Caffe import
  • Use example/keras/vgg16.json for Keras import

Tested models

The model conversion between currently supported frameworks is tested on some models.

Models Caffe Keras Tensorflow
Inception V3
Inception V4
ResNet 101
VGG 16
GoogLeNet × ×
SqueezeNet × ×
DenseNet × ×
AllCNN × ×
AlexNet
FCN32 Pascal × ×
YoloNet
Pix2Pix × ×
VQA
Denoising Auto-Encoder ×

Note: For models that use a custom LRN layer (Alexnet), Keras expects the custom layer to be passed when it is loaded from json. LRN.py is located in keras_app/custom_layers. Alexnet import for Keras

Documentation

License

This software is licensed under GNU GPLv3. Please see the included License file. All external libraries, if modified, will be mentioned below explicitly.

fabrik's People

Contributors

abhigyan7 avatar adamstafa avatar arun-jain avatar deshraj avatar gauravgupta22 avatar gautamjajoo avatar gitter-badger avatar idealadarsh avatar jatana avatar jinsu-l avatar jpjpjpopop avatar khknopp avatar mihaaaelllla avatar nu11us avatar omarito2412 avatar palashtanejapro avatar pavan-simplr avatar radiantly avatar ram81 avatar rpalakkal avatar seventeen-iterator avatar sotanishy avatar souravsingh avatar tendstofortytwo avatar thatbrguy avatar utsavgarg avatar virajprabhu avatar yashdusing avatar yusrilia avatar zerozerojedenjeden 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  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

fabrik's Issues

Unable to import json file of keras models

When importing the json file of a keras model, the API throws a ValueError. There seems to be some trouble in loading the JSON data in the correct format. Following is a screen-shot of the error log:
json_import

Add models to the Fabrik Model Zoo

We want to make the Fabrik ModelZoo a rich collection of models from all streams of deep learning research (vision, speech, text) and want to add models from both frameworks that are currently well supported by this project (Caffe and Keras).

For people looking to get started with contributing to this project, this is a very good starting point. To add a model to the model zoo, please do the following:

  • Add the model prototxt/json to the example/<framwork> folder depending on the model being from caffe or keras
  • Add the entry to the models drop-down list on the front-end
  • Test if loading the model and exporting it to both or at least one framework is working fine

Display parameters of the model being visualized

We should display the number of parameters(weights of the model) the model contains somewhere on the screen. These parameter values should change whenever a new layer is added or some existing layer is changed.

Model Sharing

We want to have a feature to generate a shareable link to a network built by a user that another user can view, edit. We will need to store the link and prototxt in our database when the user clicks share, and look up and regenerate the network from DB when another user tries to access the link.

Eventually we want to also allow collaborative editing of networks with real time updates.

@deshraj @dexter1691.

TypeError after deleting layer: Cannot read property 'info' of undefined

Whenever a layer is added in workspace and later deleted, I find this exception being thrown through the Chrome Console.

First traceback is while rendering the tooltip of hoveredLayer which would be undefined since it was deleted (I guess?):

Uncaught TypeError: Cannot read property 'info' of undefined
    at Tooltip.render (bundle.js:44344)
    at bundle.js:16503
    at measureLifeCyclePerf (bundle.js:15783)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (bundle.js:16502)
    at ReactCompositeComponentWrapper._renderValidatedComponent (bundle.js:16529)
    at ReactCompositeComponentWrapper._updateRenderedComponent (bundle.js:16453)
    at ReactCompositeComponentWrapper._performComponentUpdate (bundle.js:16431)
    at ReactCompositeComponentWrapper.updateComponent (bundle.js:16352)
    at ReactCompositeComponentWrapper.receiveComponent (bundle.js:16254)
    at Object.receiveComponent (bundle.js:8423)

Next, when I hover on another layer, it throws a new exception:

bundle.js:28035 Uncaught TypeError: Cannot read property 'info' of undefined
    at Content.changeHoveredLayer (bundle.js:28035)
    at Canvas.hoverLayerEvent (bundle.js:28862)
    at onMouseEnter (bundle.js:33113)
    at Object.ReactErrorUtils.invokeGuardedCallback (bundle.js:6822)
    at executeDispatch (bundle.js:6607)
    at Object.executeDispatchesInOrder (bundle.js:6630)
    at executeDispatchesAndRelease (bundle.js:6028)
    at executeDispatchesAndReleaseTopLevel (bundle.js:6039)
    at Array.forEach (<anonymous>)
    at forEachAccumulated (bundle.js:6921)

Dropout can't be used without RELU

I have found a bug while working on a fix for #38
If your network has RELUs before Dropout you will not have any trouble (Ex: AlexNet)
However in S2VT they use Dropout without RELUs, now this causes an error at jsonToPrototxt.py at line: 322
The reason for this is that the variable "inplace" is only set inside the RELU's context, and in this network
there are no RELUs so this causes a:
local variable 'inplace' referenced before assignment

I'm going to fix this as part of #38

Automatically parse Caffe Prototxt file to support all the different layers

Caffe has all the layers and it's layer parameters defined in a prototxt definition. Instead of adding support for layers one by one inside IDE, it will be nice to automatically parse the definition from the master branch of caffe and add support for those layers.

Requirements: Understanding caffe's codebase written in C++, Understanding the prototxt structure and familiarily with automated tasks in Javascript to automatically build the layer support into IDE.

  • We can first start by parsing the protobuf definitions to identify all the supported layer parameters.
  • Identify the mapping between layer and layer parameters
  • Identify number of input / output for each layer
  • Add them into IDE

Benefits: Doing this will ensure that we don't need to actively maintain the IDE repo to in sync with the caffe branch.

Imported caffe model can't be exported as Tensorflow model

I imported the example GoogleNet caffe model and when I tried to export it, the following error was thrown.

Error encountered: Layer not found: blob140
Internal Server Error: /tensorflow/export
Traceback (most recent call last):
  File "/home/sudar/anaconda2/lib/python2.7/site-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "/home/sudar/anaconda2/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/sudar/anaconda2/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/sudar/anaconda2/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/sudar/anaconda2/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/sudar/Desktop/cloudcv/Fabrik/tensorflow_app/views/export_graphdef.py", line 40, in exportToTensorflow
    net = __import__ (str(randomId))
ImportError: No module named 20170403111133ncyxt
[03/Apr/2017 11:11:37] "POST /tensorflow/export HTTP/1.1" 500 49731

TensorFlow in requirements.

I don't think TensorFlow should be part of the requirements.txt. Users could install this separately (or a build script can be written for the same - e.g. a Makefile) since TensorFlow wasn't completely registered under pip (pip installable) until their initial version release. This can also help new users of Fabrik to opt for GPU-tensorflow (which requires NVIDIA CUDA and CuDNN installed).

The layer parameter doesn't displayed.

When I drag and drop any layer, the parameter is shown well.
But if new layer is dragged and dropped, that it doesn't display parameter.
Except for the first layer, the other layers don't show the parameters.

2017-11-20 16-42-06

2017-11-20 16-42-12

Keras support

We want to support Keras as an additional backend.

Export: Since our intermediate backend representation is prototxt, we can use this to export.

Import: Keras exposes a model.to_json() function, we will have to write logic to parse the json to prototxt.

Add a title pane

We should add a title pane with the model name – this should be an editable field which:

  • defaults to untitled if the user is building a model from scratch
  • takes the name of whatever the model file is called if loading from zoo / importing from any framework
  • Should go into DB – when a shared link is opened, the same name should show up.

ResNet model not working

I tried importing the prototxt file from here:
https://github.com/terrychenism/ResNeXt

And it doesn't seem to work because a few layers are not supported
1.) BatchNorm
2.) Element Wise
3.) Scale

We should add the support for these layers specially because ResNet is now a standard model that people use a lot.

Extending Webpack

task runner which runs our various tasks of compiling JS, bundling it and reloading browser on change.

Setup Docker containers

Current Scenario

Currently setting up Fabrik on a local machine for development requires running a lot of commands. We want to setup the docker containers so that setting up Fabrik is not pain.

Deliverables

A basic setup that fulfills the following requirements:

  • Different containers for Postgres, NodeJS and Django
  • Add instructions in README

Please comment for if you have questions.

Document whether this tool can be used for text

Thanks for this tool!

Could you put a section outlining what is in-scope and out-of-scope in the README?

It's unclear to me for example whether I can use this to create LSTMs, seq2seq, or in general handle text.

Also what the input to the models are, i.e. what plumbing is required when I have the output from the tool in order to get data in and out from the model would be good to outline in the README.

Add RNN / LSTM examples for Keras in ModelZoo

Keras supports recurrent layers like LSTM / RNN / GRU etc. Right now model zoo for Fabrik doesn't contain any examples of network that uses these layers.

We should add a few examples to demonstrate the capability of using recurrent layers in a network and to test how import / export works for these layers.

[UI/UX] Not easy to know if Fabrik is exporting model or not

I suggest that when the user clicks the "export" button, the system will show a dialog
or some other UI components which is easy to seize the user's attention. Since the position of "progress circle" is assigned to the top-right which is not very intuitive for the users, I think this design is not very well. Also, if the "progress circle" can show the progress to the user, it will be better.

Layer boxes UI Enhancements

It would be nice to show layer details on hover (instead of the user having to click the layer box) - this is a nice example.

No border and border-radius for boxes also seems to look nicer.

Needed improvement in layer insertion UI widget

I use a computer with 1366x768 resolution monitor. The drop-down menu for inserting a new layer overflows out of the screen. I am not able to add layers like embed, lstm etc. This has to be made scrollable at least for the moment.

Import all the models from Caffe ModelZoo into IDE

We should try to successfully import all the models from Caffe ModelZoo to see if some layers are not working.
Consequently fix or add the missing the layers into the IDE.

https://github.com/BVLC/caffe/wiki/Model-Zoo

For GSOC participants:
This seems like a very good starting point to see how IDE works. Here is what you have to do

  • Choose one of the models from the link above and create an issue for it. Cross reference it here for others to see.
  • We will assign the issue to you
  • If the model is working. Add a unit test for it so that any later changes to the projects ensure compatibility with those models.
  • If the model isn't working, try to discuss with the mentors and fix the issue!

We are maintaining the list of models tested by contributors here:
https://github.com/Cloud-CV/IDE/wiki/Models

When exporting multiple times error

I found a bug.

-Step to reproduce the problem

  1. The model is loaded.

  2. Export the model once.

  3. Export the model again.

Then. An error occurs.

The error message is:
bundle.js:44086 Uncaught TypeError: Cannot read property '0' of undefined
at bundle.js:44086
at Array.forEach ()
at Tooltip.render (bundle.js:44081)
at bundle.js:16306
at measureLifeCyclePerf (bundle.js:15586)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (bundle.js:16305)
at ReactCompositeComponentWrapper._renderValidatedComponent (bundle.js:16332)
at ReactCompositeComponentWrapper._updateRenderedComponent (bundle.js:16256)
at ReactCompositeComponentWrapper._performComponentUpdate (bundle.js:16234)
at ReactCompositeComponentWrapper.updateComponent (bundle.js:16155)

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.