Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to store numpy.ndarray' object has no attribute 'save'

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'

like image 853
gohar shah Avatar asked Dec 04 '25 10:12

gohar shah


1 Answers

Try using

cv2.imwrite(path,img_to_save)

to save

like image 88
Shag Avatar answered Dec 07 '25 01:12

Shag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!