Skip to content

Commit

Permalink
Merge pull request #13 from digitaldogsbody/master
Browse files Browse the repository at this point in the history
Add ability for the TSNE script to use the tfjs-node library
  • Loading branch information
cpietsch authored Jun 19, 2022
2 parents 6e0e941 + 5436a04 commit c1bb9da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion similarity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vikus-viewer-tsne",
"version": "0.1.0",
"version": "0.1.1",
"description": "tsne preprocessing script for vikus-viewer",
"author": "Christopher Pietsch <cpietsch@gmail.com>",
"private": true,
Expand Down
13 changes: 11 additions & 2 deletions similarity/tsne.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var path = require("path");
const glob = require('glob-promise');
const localPath = i => path.relative(process.cwd(), i)
const argv = require('minimist')(process.argv.slice(2));
const tf = require('@tensorflow/tfjs');
// const tf = require('@tensorflow/tfjs');
// const tsne = require('@tensorflow/tfjs-tsne');
const { createCanvas, loadImage } = require('canvas')
const tsnejs = require('./lib/tsne.js');
Expand All @@ -20,6 +20,15 @@ console.log('starting with', process.argv);

const inputPath = argv.i;
const inputFormat = argv.f || 'jpg';
const useTfjsnode = argv.t || false;

var tf
if(useTfjsnode) {
tf = require('@tensorflow/tfjs-node');
}
else {
tf = require('@tensorflow/tfjs');
}

const saveCsv = async (data, filename) => {
const csv = d3.csvFormat(data)
Expand Down Expand Up @@ -180,4 +189,4 @@ run()
// // the embedded data.
// const coordinates = tsneOpt.coordinates();
// coordinates.print();
// })
// })

0 comments on commit c1bb9da

Please sign in to comment.