Coder Social home page Coder Social logo

renato145 / fastexplorer Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 2.43 MB

Utility to visualize fastai models via javascript

Home Page: https://renato145.github.io/fastexplorer/

License: Apache License 2.0

Jupyter Notebook 70.15% Python 29.22% Makefile 0.62%

fastexplorer's Introduction

Fast Explorer

Work in progress

A utility to visualize models.

Main idea:

  • Use this library to attach a learner and initialize a proxy server.
  • Connect a javascript client via fastexplorer-js.
  • Send back and forth relevant information to be visualized.

This will allow to use tools like d3, react and threejs to visualize NN information.

Install

pip install git+https://github.com/renato145/fastexplorer.git

How to use

# all_slow
%reload_ext autoreload
%autoreload 2

Load you Learner as usual and import fastexplorer:

from fastai.vision.all import *
from fastexplorer.all import *

path = untar_data(URLs.PETS)
files = get_image_files(path/"images")
def label_func(f): return f[0].isupper()
dls = ImageDataLoaders.from_name_func(path, files, label_func, item_tfms=Resize(224))
learn = cnn_learner(dls, resnet34, metrics=accuracy)

When ready, start serving the server:

#srv
learn.fastexplorer(True)
INFO:root:To visualize the model information, go to:
INFO:root:https://renato145.github.io/fastexplorer-js
INFO:     Started server process [4507]
INFO:uvicorn.error:Started server process [4507]
INFO:     Waiting for application startup.
INFO:uvicorn.error:Waiting for application startup.
INFO:     Application startup complete.
INFO:uvicorn.error:Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:uvicorn.error:Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     Shutting down
INFO:uvicorn.error:Shutting down
INFO:     Waiting for application shutdown.
INFO:uvicorn.error:Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:uvicorn.error:Application shutdown complete.
INFO:     Finished server process [4507]
INFO:uvicorn.error:Finished server process [4507]

Finally, go to https://renato145.github.io/fastexplorer-js/ to visualize the model:

Also, you can visualize the Loss Landscape:

Note that the original work calculates the landscape using the whole dataset which can take a lot of time. In this library, I am using just one batch of data to calculate the landscape (this will probably change once I find a faster way to calculate it).

fastexplorer's People

Contributors

renato145 avatar

Watchers

James Cloos avatar  avatar paper2code - bot 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.