Comments (12)
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
output
from mai-vsr-diggers.
It's okay. Thank you for trying my code ☺
from mai-vsr-diggers.
from mai-vsr-diggers.
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.
I am sorry for asking again in a short time notice, any update?
from mai-vsr-diggers.
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.
Thank you so much, it works!!!
from mai-vsr-diggers.
well, there are 3 things different from me:
- normalization before input to model.
- stack the image 10 times for 10 frames, but think it is just for reference
- clipping
ok, I got it. again thank you for being supportive.
from mai-vsr-diggers.
well, there are 3 things different from me:
- normalization before input to model.
- stack the image 10 times for 10 frames, but think it is just for reference
- 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.
ok, and one last thing why clipping is required?
from mai-vsr-diggers.
is it for the 0~255 range?
from mai-vsr-diggers.
oh, I see. It's for that range. sorry for my stupid question.
from mai-vsr-diggers.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mai-vsr-diggers.