Code Monkey home page Code Monkey logo

Comments (6)

reiinakano avatar reiinakano commented on June 4, 2024 1

TensorFlow.js is just a later version of deeplearn.js renamed. Results won't actually change (in theory), although maybe it'll be more efficient and run on more platforms, who knows.

from fast-style-transfer-deeplearnjs.

mikeemoo avatar mikeemoo commented on June 4, 2024 1

Extracted the code from StyleSight into a simple standalone file:

https://gist.github.com/mikeemoo/b4affe711d56bd9828e8db7ce73ae13c

import { loadStyle, predict } from "./net";

const img = new Image();
img.onload = async () => {
  loadStyle("udnie").then(async style => {
    const result = predict(img, style);
    const data = await result.data();
    const [height, width] = result.shape;
    ... do whatever
});
img.src = "...jpg";

Seems extremely slow at the moment, though! Crashes my little laptop with anything bigger than a couple of hundred pixels.

from fast-style-transfer-deeplearnjs.

mikeemoo avatar mikeemoo commented on June 4, 2024

I'm just posting here to register my interest in this - I know nothing about tensorflow or deeplearn so won't be able to help, but very interested in playing with the result.

from fast-style-transfer-deeplearnjs.

cvalenzuela avatar cvalenzuela commented on June 4, 2024

This might be relevant to see: https://github.com/zaidalyafeai/Fast-Style-Transfer-Keras-TF.js

Althought the repo says:

This is done using tensorflow.js check the file fast-style.html. Note that I have and editted version of the source package tf.min.js. It containts many custom layers like corpping and upsampling that are yet to be implemented in tf.js. Make sure to use that file.

from fast-style-transfer-deeplearnjs.

DanRuta avatar DanRuta commented on June 4, 2024

I got this working with tensorflowjs over here https://github.com/DanRuta/StyleSight, on a separate demo project.

One thing I couldn't get working the same was the GPU -> GPU output rendering, to skip sending the values through the CPU first. I couldn't find the new way to do it, if there is still one.

If it'd be helpful to anyone, I could isolate it into a separate repo, without anything unrelated, like build tools, libraries, or frameworks.

from fast-style-transfer-deeplearnjs.

DanRuta avatar DanRuta commented on June 4, 2024

Nice one! :) Yep, that happens for me, also. I've noticed GPU memory leaks on several tensorflowjs projects (not just my own), so maybe there's an issue with tfjs.

As for the speed, I think it may be a little faster with GPU -> GPU output rendering, but even so, the model is quite complex. Even with a small resolution input, I don't get more than a few frames per second, on a 1080.

from fast-style-transfer-deeplearnjs.

Related Issues (15)

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.