elimu-ai / ml-authentication

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

TrainingThread crashes if model file is missing #326

Closed sladomic closed 7 years ago

sladomic commented 7 years ago
01-08 03:18:56.616 1188-1188/? E/org.literacyapp.authentication.TrainingHelper: Model file: /storage/emulated/0/.literacyapp/ai/model/vgg_faces.pb doesn't exist. Please copy it manually. Find the download link in the file /storage/emulated/0/.literacyapp/ai/model/download_link.txt
01-08 03:18:56.629 1188-1188/? I/org.literacyapp.authentication.TrainingHelper: trainClassifier
01-08 03:18:56.630 1188-1188/? D/org.literacyapp.dao.converter.CalendarConverter: convertToEntityProperty
01-08 03:18:56.631 1188-1188/? D/org.literacyapp.dao.converter.CalendarConverter: calendar.getTime(): Sun Jan 08 03:03:26 GMT+03:00 2017
01-08 03:18:56.631 1188-1188/? I/org.literacyapp.authentication.TrainingHelper: Count of StudentImageCollectionEvents where MeanFeatureVector is null: 1
01-08 03:18:56.634 1188-1188/? E/JobService: Error while executing job: 0
01-08 03:18:56.634 1188-1188/? D/AndroidRuntime: Shutting down VM

                                                 --------- beginning of crash
01-08 03:18:56.637 1188-1188/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: org.literacyapp, PID: 1188
                                                 Theme: themes:{}
                                                 java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.literacyapp.model.StudentImageFeature.getFeatureVector()' on a null object reference
                                                     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: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.literacyapp.model.StudentImageFeature.getFeatureVector()' on a null object reference
                                                     at org.literacyapp.authentication.TrainingHelper.trainClassifier(TrainingHelper.java:224)
                                                     at org.literacyapp.service.FaceRecognitionTrainingJobService.onStartJob(FaceRecognitionTrainingJobService.java:22)
                                                     at android.app.job.JobService$JobHandler.handleMessage(JobService.java:126)
                                                     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) 

Solution:

Add "if (!TextUtils.isEmpty(featureVectorString)"

sladomic commented 7 years ago

rejected --> already fixed in newest version