Giter Club home page Giter Club logo

Comments (6)

GregFrench avatar GregFrench commented on August 16, 2024 2

Hi Francesco,

It worked! Thanks for your help! I'm building a small open source web app using the pre trained model and weights to enable users to do super resolution in the browser. I will let you know when it's ready so you can check it out. Cheers.

from image-super-resolution.

cfrancesco avatar cfrancesco commented on August 16, 2024 1

I'm guessing that the problems might stem from the fact that only the weights are saved, not the entire model. Looking at the checkpoint callback, we have save_weights_only=True

        checkpoint_PSNR = ModelCheckpoint(
            self.checkpoint_paths['PSNR'],
            save_weights_only=True,
            verbose=self.verbose,
            save_best_only=True,
            monitor='PSNR',
            mode='max',
        )

I'd suggest you to try to load the model, load the weights and then dump the model to a .h5 file with model.save()

Let me know if this helps!

from image-super-resolution.

talvasconcelos avatar talvasconcelos commented on August 16, 2024

Hi @GregFrench i'm trying to use this on tfjs too but i can't seem to make it work. Getting this error:
Error: Error when checking : expected LR to have 4 dimension(s), but got array with shape [128,128,4]

I'm trying to upscale 128x128 images. Could you share a bit more about your process?

from image-super-resolution.

GregFrench avatar GregFrench commented on August 16, 2024

For processing the images in Tensorflow.js I used the same code in JavaScript that the Python implementation was using:

let tensor = tf.fromPixels(url).toFloat().div(tf.scalar(255)).expandDims();

let prediction = await model.predict(tensor).clipByValue(0, 1).mul(tf.scalar(255)).data();

Where url = the URL of the image or image data from a web form.

I hope that helps!

from image-super-resolution.

talvasconcelos avatar talvasconcelos commented on August 16, 2024

Lifesaver.... had to some workarounds because i'm on node, not on browser, but super!!

Users load the model on the browser? how long does it take?

from image-super-resolution.

GregFrench avatar GregFrench commented on August 16, 2024

I just timed it and it took 5 minutes to load the model in the browser. You can check out the implementation here using create react app and GitHub pages: https://github.com/GregFrench/super-resolution.

The app also crashes when trying to process images over 150x150 pixels due to some WebGL issue that I was never able to figure out the cause of. So it seems like it is probably best to run inference on the model through a server rather than a browser which is a little disappointing.

from image-super-resolution.

Related Issues (20)

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.