I have the following storing prediction data a larger NumPy array and sending it server. I tried Zlib compression but it's affecting the application performance.
def forward_data(frame,count):
global m1, m2, model_split_arg
source = cv2.imdecode(np.fromstring(base64.b64decode(frame), dtype=np.uint8), 1)
image = img_to_array(source)
image = image.reshape((1, image.shape[0], image.shape[1], image.shape[2]))
preds = m1.predict(preprocess_input(image))
preds.save()
buf = io.BytesIO()
np.savez_compressed(buf, preds)
Error: preds.save() AttributeError: 'numpy.ndarray' object has no attribute 'save'
Try using
cv2.imwrite(path,img_to_save)
to save
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With