Ask Your Question
0

Android saving enormous Mat object (Java)

asked 2015-10-12 09:29:51 -0600

DanielQ gravatar image

I'm writting andorid app where I use KNearest. I wrote code to train model, but every restart app, I must train data again, so I would like to save train data - Mat(1000, 40 000, CvType.CV_32FC1); I try to convert this Mat to byte[] and save it to SharedPreferences but I got outOfMemory exception...

Have you any suggestion to speed up or save data? Thx for help.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-10-13 02:59:47 -0600

CvKNearest extends CvStatModel hence it has save and load-methods. Why don't you simply use those methods? Do you have to update your trained model? That would be a problem...

edit flag offensive delete link more

Comments

paper napkin maths: 1000 * 40000 * 16 = 640 mb if saved as xml...

berak gravatar imageberak ( 2015-10-14 00:57:42 -0600 )edit

I convert each image (to train) to binary, and save it to file, but it is 140 MB... Maybe I should use lower size each image (now, I have 200x200 px). PS. I wrote app to hand sign recognioton.

DanielQ gravatar imageDanielQ ( 2015-10-15 13:34:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-10-12 09:29:51 -0600

Seen: 241 times

Last updated: Oct 13 '15