npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tensorspace

v0.6.1

Published

Neural network 3D visualization framework

Downloads

68

Readme

TensorSpace is a neural network 3D visualization framework built using TensorFlow.js, Three.js and Tween.js. TensorSpace provides Keras-like APIs to build deep learning layers, load pre-trained models, and generate a 3D visualization in the browser. From TensorSpace, it is intuitive to learn what the model structure is, how the model is trained and how the model predicts the results based on the intermediate information. After preprocessing the model, TensorSpace supports to visualize pre-trained model from TensorFlow, Keras and TensorFlow.js.

Table of Content

Motivation

TensorSpace is a neural network 3D visualization framework designed for not only showing the basic model structure, but also presenting the processes of internal feature abstractions, intermediate data manipulations and final inference generations.

By applying TensorSpace API, it is more intuitive to visualize and understand any pre-trained models built by TensorFlow, Keras, TensorFlow.js, etc. TensorSpace introduces a way for front end developers to be involved in the deep learning ecosystem. As an open source library, TensorSpace team welcomes any further development on visualization applications.

  • Interactive -- Use Layer API to build interactive model in browsers.
  • Intuitive -- Visualize the information from intermediate inferences.
  • Integrative -- Support pre-trained models from TensorFlow, Keras, TensorFlow.js.

Getting Started

1. Install TensorSpace

Install in the Basic Case

  • Step 1: Download Dependencies

Download dependencies build files TensorFlow.js (tf.min.js), Three.js (three.min.js), Tween.js (tween.min.js), TrackballControls (TrackballControls.js).

  • Step 2: Download TensorSpace

Download TensorSpace build file tensorspace.min.js from Github, NPM, TensorSpace official website or CDN:

<!-- Replace "VERSION" with the version you want to use. -->
<script src="https://cdn.jsdelivr.net/npm/tensorspace@VERSION/dist/tensorspace.min.js"></script>
  • Step 3: Include Build Files

Include all build files in web page.

<script src="tf.min.js"></script>
<script src="three.min.js"></script>
<script src="tween.min.js"></script>
<script src="TrackballControls.js"></script>
<script src="tensorspace.min.js"></script>

Install in the Progressive Framework

  • Step 1: Install TensorSpace

    • Option 1: NPM
    npm install tensorspace
    • Option 2: Yarn
    yarn add tensorspace
  • Step 2: Use TensorSpace

import * as TSP from 'tensorspace';

Checkout this Angular example for more information.

2. Preprocess the Pre-trained Model

Before applying TensorSpace to visualize the pre-trained model, there is an important pipeline - TensorSpace model preprocessing ( Checkout this article for more information about TensorSpace preprocessing ). We can use TensorSpace Converter to quickly complete the TensorSpace Preprocessing.

For example, if we have a tf.keras model in hand, we can use the following TensorSpace-Converter conversion script to convert a tf.keras model to the TensorSpace compatible format:

$ tensorspacejs_converter \
    --input_model_from="tensorflow" \
    --input_model_format="tf_keras" \
    --output_layer_names="padding_1,conv_1,maxpool_1,conv_2,maxpool_2,dense_1,dense_2,softmax" \
    ./PATH/TO/MODEL/tf_keras_model.h5 \
    ./PATH/TO/SAVE/DIR

Note:

3. Using TensorSpace to Visualize the Model

If TensorSpace is installed successfully and the pre-trained deep learning model is preprocessed, let's create an interactive 3D TensorSpace model.

For convenience, we will use the the resources from this repository's HelloWorld directory, which includes preprocessed TensorSpace compatible LeNet model and sample input data ("5") as an example to illustrate this step. All source code can be found in helloworld.html.

First, we need to new a TensorSpace model instance:

let container = document.getElementById( "container" );
let model = new TSP.models.Sequential( container );

Next, based on the LeNet structure: Input + Padding2D + 2 X (Conv2D & Maxpooling) + 3 X (Dense), build the Topology of the TensorSpace model:

model.add( new TSP.layers.GreyscaleInput() );
model.add( new TSP.layers.Padding2d() );
model.add( new TSP.layers.Conv2d() );
model.add( new TSP.layers.Pooling2d() );
model.add( new TSP.layers.Conv2d() );
model.add( new TSP.layers.Pooling2d() );
model.add( new TSP.layers.Dense() );
model.add( new TSP.layers.Dense() );
model.add( new TSP.layers.Output1d({
    outputs: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
}) );

Last, we should load our preprocessed TensorSpace compatible model and use init() method to create the TensorSpace model:

model.load({
    type: "tensorflow",
    url: './PATH/TO/MODEL/model.json'
});
model.init(function(){
    console.log("Hello World from TensorSpace!");
});

We can get the following Fig. 3 model in the browser if everything looks good.

We provide a extracted file which is a handwritten "5" as the input of our model: (online demo)

model.init(function() {
    model.predict( image_5 );
});

We put the predict( image_5 ) method in the callback function of init() to ensure the prediction is after the initialization complete.

Click the CodePen logo to try it in CodePen:   

Example

  • LeNet [ TensorFlow.js model ]

➡ Live Demo

  • AlexNet [ TensorFlow model ]

➡ Live Demo

  • Yolov2-tiny [ TensorFlow model ]

➡ Live Demo

  • ResNet-50 [ Keras model ]

➡ Live Demo

  • Vgg16 [ Keras model ]

➡ Live Demo

  • ACGAN [ Keras model ]

➡ Live Demo

  • MobileNetv1 [ Keras model ]

➡ Live Demo

  • Inceptionv3 [ Keras model ]

➡ Live Demo

  • LeNet Training Visualization [ TensorFlow.js dynamic model ]

Visualize the LeNet Training Process with TensorSpace.js and TensorFlow.js.

➡ Live Demo

View models locally

As some models above are extremely large, view them locally may be a good choice.

  • Step 1: clone TensorSpace Repo
git clone https://github.com/tensorspace-team/tensorspace.git
  • Step 2:

Open "html" file in examples folder in local web server.

Documentation

Contributors

Thanks goes to these wonderful people (emoji key):

| syt123450💻 🎨 📖 💡 | Chenhua Zhu💻 🎨 💡 | YaoXing Liu💻 🎨 💡 | Qi(Nora)💻 🎨 | Dylan Schiemann📝 | BoTime💻 📖 💡 | Kamidi Preetham📖 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | Wade Penistone📖 |

Contact

If you have any issue or doubt, feel free to contact us by:

License

Apache License 2.0