This commit is contained in:
Jordon Brooks 2023-08-12 22:14:38 +01:00
parent 93ccce5ec1
commit ed5eb91578
6 changed files with 181 additions and 171 deletions

View file

@ -1,5 +1,9 @@
# DeepEncode.py
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import tensorflow as tf
import numpy as np
import cv2
@ -33,12 +37,16 @@ def predict_frame(uncompressed_frame, model, crf_value, preset_speed_value):
crf_array = np.array([crf_value])
preset_speed_array = np.array([preset_speed_value])
crf_array = np.expand_dims(np.array([crf_value]), axis=-1) # Shape: (1, 1)
preset_speed_array = np.expand_dims(np.array([preset_speed_value]), axis=-1) # Shape: (1, 1)
# Expand dimensions to include batch size
uncompressed_frame = np.expand_dims(uncompressed_frame, 0)
#display_frame = np.clip(cv2.cvtColor(uncompressed_frame[0], cv2.COLOR_BGR2RGB) * 255.0, 0, 255).astype(np.uint8)
#cv2.imshow("uncomp", display_frame)
#cv2.waitKey(10)
#cv2.waitKey(0)
compressed_frame = model.predict({
"compressed_frame": uncompressed_frame,