elimu-ai / ml-authentication

😶‍🌫️ Android application for authenticating the current student using face recognition
MIT License
16 stars 16 forks source link

Show descriptive error message when vgg_faces.pb is missing from device [1h] #234

Closed jo-elimu closed 7 years ago

jo-elimu commented 7 years ago
12-07 17:22:00.333 359-359/org.literacyapp I/org.literacyapp.authentication.TrainingHelper: Number of StudentImages, where the features haven't been extracted yet: 12
12-07 17:22:00.365 359-359/org.literacyapp I/native: tensorflow_jni.cc:107 Loading Tensorflow.
12-07 17:22:00.365 359-359/org.literacyapp I/native: tensorflow_jni.cc:109 Making new SessionOptions.
12-07 17:22:00.365 359-359/org.literacyapp I/native: tensorflow_jni.cc:112 Got config, 0 devices
12-07 17:22:00.366 359-359/org.literacyapp I/native: tensorflow_jni.cc:115 Session created.
12-07 17:22:00.366 359-359/org.literacyapp I/native: tensorflow_jni.cc:118 Graph created.
12-07 17:22:00.368 359-359/org.literacyapp I/native: tensorflow_jni.cc:122 Acquired AssetManager.
12-07 17:22:00.368 359-359/org.literacyapp I/native: tensorflow_jni.cc:124 Reading file to proto: /storage/emulated/0/.literacyapp/ai/model/vgg_faces.pb
12-07 17:22:00.368 359-359/org.literacyapp I/native: jni_utils.cc:82 Opening file: /storage/emulated/0/.literacyapp/ai/model/vgg_faces.pb
12-07 17:22:00.368 359-359/org.literacyapp I/native: stat_summarizer.cc:33 StatSummarizer found 0 nodes
12-07 17:22:00.368 359-359/org.literacyapp I/native: tensorflow_jni.cc:129 Creating session.
12-07 17:22:00.368 359-359/org.literacyapp I/native: tensorflow_jni.cc:138 Tensorflow graph loaded from: /storage/emulated/0/.literacyapp/ai/model/vgg_faces.pb
12-07 17:22:00.368 359-359/org.literacyapp I/native: tensorflow_jni.cc:143 Initialization done in 2ms
12-07 17:22:00.374 359-359/org.literacyapp I/org.literacyapp.authentication.TrainingHelper: StudentImage has been loaded from file asdf...
12-07 17:22:00.391 359-359/org.literacyapp E/cv::error(): OpenCV Error: Assertion failed (ssize.area() > 0) in void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int), file /Volumes/Linux/builds/master_pack-android/opencv/modules/imgproc/src/imgwarp.cpp, line 3229
12-07 17:22:00.392 359-359/org.literacyapp E/org.opencv.imgproc: imgproc::resize_11() caught cv::Exception: /Volumes/Linux/builds/master_pack-android/opencv/modules/imgproc/src/imgwarp.cpp:3229: error: (-215) ssize.area() > 0 in function void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int)
12-07 17:22:00.392 359-359/org.literacyapp E/JobService: Error while executing job: 0
12-07 17:22:00.393 359-359/org.literacyapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                             Process: org.literacyapp, PID: 359
                                                             Theme: themes:{}
                                                             java.lang.RuntimeException: CvException [org.opencv.core.CvException: cv::Exception: /Volumes/Linux/builds/master_pack-android/opencv/modules/imgproc/src/imgwarp.cpp:3229: error: (-215) ssize.area() > 0 in function void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int)
                                                             ]
                                                                 at android.app.job.JobService$JobHandler.handleMessage(JobService.java:130)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                 at android.os.Looper.loop(Looper.java:148)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:5461)
                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                              Caused by: CvException [org.opencv.core.CvException: cv::Exception: /Volumes/Linux/builds/master_pack-android/opencv/modules/imgproc/src/imgwarp.cpp:3229: error: (-215) ssize.area() > 0 in function void cv::resize(cv::InputArray, cv::OutputArray, cv::Size, double, double, int)
                                                             ]
                                                                 at org.opencv.imgproc.Imgproc.resize_1(Native Method)
                                                                 at org.opencv.imgproc.Imgproc.resize(Imgproc.java:2716)
                                                                 at ch.zhaw.facerecognitionlibrary.Recognition.TensorFlow.getFeatureVector(TensorFlow.java:132)
                                                                 at org.literacyapp.authentication.TrainingHelper.getSvmVector(TrainingHelper.java:101)
                                                                 at org.literacyapp.authentication.TrainingHelper.extractFeatures(TrainingHelper.java:67)
                                                                 at org.literacyapp.service.FaceRecognitionTrainingJobService.onStartJob(FaceRecognitionTrainingJobService.java:16)
                                                                 at android.app.job.JobService$JobHandler.handleMessage(JobService.java:126)
                                                                    ... 6 more
sladomic commented 7 years ago

Does the model file exist "vgg_faces.pb"?

jo-elimu commented 7 years ago

@sladomic I suspect this is because I have not yet copied vgg_faces.pb to the SD card.

Can you modify the code to show a descriptive message when the file is missing, and instructions on how to add it? To help future developers experiencing the same.

sladomic commented 7 years ago

So this was an intended negative test? :P Ok, will add it