driver / utils /preprocess.py
Guru-25's picture
new
b8b61aa
raw
history blame contribute delete
276 Bytes
import cv2
import numpy as np
from tensorflow.keras.preprocessing.image import img_to_array
def preprocess_frame(frame, target_size=(224, 224)):
frame = cv2.resize(frame, target_size)
frame = img_to_array(frame) / 255.0
return np.expand_dims(frame, axis=0)