Giter Club home page Giter Club logo

Comments (12)

Feynman1999 avatar Feynman1999 commented on July 22, 2024 1

here is a demo for testing with just one img(broadcast to 10 for tflite), you can try it in your machine

# 180*320 img

import tensorflow as tf
import numpy as np
import cv2

read_1 = cv2.imread("test.png")
read_1= tf.convert_to_tensor(read_1)
read_1 = tf.cast(read_1, tf.float32)

read_1 = read_1 / 255. # 0~1

# 10 frames
inputs = tf.concat([read_1 for i in range(10)], axis=-1)
inputs = tf.expand_dims(inputs, axis=0)
print(inputs.shape)https://ibb.co/wKFtn18

vsr_model_path = './model_none.tflite'

interpreter = tf.lite.Interpreter(model_path=vsr_model_path)

input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
print(input_details, '\n',output_details)

interpreter.resize_tensor_input(input_details[0]['index'], [1, 180, 320, 30], strict=False)
interpreter.allocate_tensors()
interpreter.set_tensor(input_details[0]['index'], inputs)
interpreter.invoke()

output_data = interpreter.get_tensor(output_details[0]['index'])

print(type(output_data))

output1 = np.clip(output_data[0, :, :, 0:3], a_min=0, a_max=1)

output1 = (output1*255).astype(np.uint8)

cv2.imwrite("res.png", output1)

input

https://ibb.co/wKFtn18

output

https://ibb.co/whvSdr4

from mai-vsr-diggers.

Feynman1999 avatar Feynman1999 commented on July 22, 2024 1

It's okay. Thank you for trying my code ☺

from mai-vsr-diggers.

Feynman1999 avatar Feynman1999 commented on July 22, 2024

from mai-vsr-diggers.

uu95 avatar uu95 commented on July 22, 2024

thank you so much, I have a deadline of 10 December, if possible please update me as early as possible. Sorry for asking so much.

from mai-vsr-diggers.

uu95 avatar uu95 commented on July 22, 2024

I am sorry for asking again in a short time notice, any update?

from mai-vsr-diggers.

Feynman1999 avatar Feynman1999 commented on July 22, 2024

i guess there is something wrong with the tf.image.decode_jpeg in your code? May lose some details?

By the way, you need do clip( min: 0, max:1 ) for output which is not done in tflite model

from mai-vsr-diggers.

uu95 avatar uu95 commented on July 22, 2024

Thank you so much, it works!!!

from mai-vsr-diggers.

uu95 avatar uu95 commented on July 22, 2024

well, there are 3 things different from me:

  1. normalization before input to model.
  2. stack the image 10 times for 10 frames, but think it is just for reference
  3. clipping
    ok, I got it. again thank you for being supportive.

from mai-vsr-diggers.

Feynman1999 avatar Feynman1999 commented on July 22, 2024

well, there are 3 things different from me:

  1. normalization before input to model.
  2. stack the image 10 times for 10 frames, but think it is just for reference
  3. clipping
    ok, I got it. again thank you for being supportive.

yes, I repeat one frame 10 times for fast implementation and you can use consecutive 10 different frames in real world scene.

from mai-vsr-diggers.

uu95 avatar uu95 commented on July 22, 2024

ok, and one last thing why clipping is required?

from mai-vsr-diggers.

uu95 avatar uu95 commented on July 22, 2024

is it for the 0~255 range?

from mai-vsr-diggers.

uu95 avatar uu95 commented on July 22, 2024

oh, I see. It's for that range. sorry for my stupid question.

from mai-vsr-diggers.

Related Issues (5)

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.