Coder Social home page Coder Social logo

ch-sander / vikus-viewer-script Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cpietsch/vikus-viewer-script

1.0 0.0 0.0 92.69 MB

Scripts to generate sprite sheets and textures for VIKUS Viewer

Home Page: https://vikusviewer.fh-potsdam.de/

JavaScript 100.00%

vikus-viewer-script's Introduction

vikus-viewer-script v2.0

The script in /images will generate textures and spritesheet assets which are needed for the vikus-viewer (repo). The script in /tsne will generate a TSNE layout which can be used as an alternative to the timeline-view in VIKUS Viewer.

Requirements

Usage image script

Install the script as a command line tool without the need of cloning / downloading:

npm install -g vikus-viewer-script

Alternativly you can download or clone this repo and install the required node packages:

git clone https://github.com/cpietsch/vikus-viewer-script
cd vikus-viewer-script
npm install

Note: You can run the script via node bin/textures instead of vikus-viewer-script if you have cloned it.

All your images should be in one folder (lets say "images") and named x.jpg where x is the id of the image corresponding to the id field in data.csv

To generate textures and sprites run the script like this:

vikus-viewer-script "/path/to/your/images/*.jpg"

This will create a data folder for the textures (1024 and 4096) as well as a sprites folder for the spritesheets inside the current folder. You can also define an output folder via the output flag: --output /path/to/output

If your source images are in multiple formats or have multiple file extensions you can use a glob primer like this: vikus-viewer-script "/path/to/your/images/*.+(jpg|jpeg|png)"

You are now finished in preparing the textures and spritesheets!

Copy the folder 1024, 4096 and sprites inside data into your /data folder of your vikus-viewer instance. After a successful run you can delete the tmp folder.

A note for collections of 5000+ items: In the default configuration the script will generate sprites at the maximum dimensions of 256x256px. For faster loading time and collections with a lot of items, you should adjust the resolution of the sprites by running changing the --spriteSize flag to e.g. 90.

Examples:

Create textures

vikus-viewer-script "/path/to/your/images/*.jpg" # on jpg's
vikus-viewer-script "/path/to/your/images/*.+(jpg|jpeg|png)" # on multiple formats
vikus-viewer-script "/path/to/your/images/**/*.jpg" # on all jpg's in subfolders

CLI commands

Usage: vikus-viewer-script "/path/to/large/images/*.jpg" [options]

Commands:
  vikus-viewer-script "/path/to/large/images/*.jpg"  Glob to input images

Options:
  --version         Show version number                                [boolean]
  --output          Path to output folder                    [default: "./data"]
  --skip            Don't regenerate existing textures           [default: true]
  --textureFormat   Texture image format                        [default: "jpg"]
  --textureQuality  Texture image quality (0-100)                  [default: 60]
  --spriteSize      Resolution of images for spritesheets         [default: 256]
  --spriteQuality   Quality of jpg compression for spritesheets (0-100)
                                                                   [default: 70]
  --spriteFormat    spritesheets format (jpg or png)            [default: "jpg"]
  --largeSize       resolution of full sized images              [default: 4096]
  --mediumSize      resolution of images loaded on the fly       [default: 1024]
  -h, --help        Show help                                          [boolean]

Examples:
  vikus-viewer-script "/path/to/large/images/*.jpg"  create VV textures from jpgs

Usage t-SNE/UMAP script

As an alternative to the temporal view, you can create a t-SNE layout based on image similarity. The script creates a tsne.csv which can be put next to the data.csv in the /data folder. Image similarity is calculated via the imagenet activation logit and then run throught t-SNE or UMAP. An additional spacing step ensures no overlaying images in the distribution.

Download or clone this repo, navigate to /similarity and install the required node packages:

cd /similarity
npm i

Run the t-SNE script:

node tsne.js -i /path/to/images

Alternatively Run the UMAP script UMAP is an experimental new version of way to do something similar to the T-SNE projection:

node umap.js -i /path/to/images

/path/to/images should be pointed low res images (made with the texture script) in the 1024px resolution. After you run the script a tsne.csv will be generated. Copy the csv into the data folder of your VIKUS Viewer instance and add an "tsne" entry to the loader section in the config.json file pointing to the tsne.csv file. Have a look at the Van Gogh Example config

vikus-viewer-script's People

Contributors

abbe98 avatar ch-sander avatar cpietsch avatar nrchtct avatar

Stargazers

 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.