FirebaseExtended / mlkit-material-android

ML Kit Showcase App with Material Design

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False prediction from custom tflite model using ML kit

abdou31 opened this issue · comments

  • Android device: Samsung A3 2016
  • Android OS version: 8.0
  • Google Play Services version: N/A
  • Firebase/Play Services SDK version: 15.0.0

I have trained my own model that detects eye region with landmarks and I have converted it to frozen inference graph and from the inference to tflite model.
I integrated the tflite model on Android Studio.
I have followed ML kit instructions :
https://firebase.google.com/docs/ml-kit/android/use-custom-models

The result ( outputs ) that should I get is 80 values ( 40 couples x and y ) => 40 points(x,y).
For e.g , this is a prediction from model .ckpt before converting:

[0.33135968 0.19592011 0.34212315 0.17297666 0.36624995 0.16413747 0.3894139 0.17440952 0.39828074 0.1978043 0.3891497 0.22268474 0.36345637 0.22974193 0.3401759 0.2193309 0.30167252 0.20411113 0.3167112 0.19134495 0.33793524 0.18388326 0.3642417 0.18049955 0.3903508 0.18533507 0.40906873 0.1957745 0.42142123 0.21091096 0.40550107 0.21829814 0.38345626 0.22071144 0.35900232 0.22142673 0.3363348 0.21877256 0.3161971 0.2133534 0.62843406 0.21482795 0.6389724 0.1914106 0.6628249 0.1835615 0.6858679 0.19583184 0.6946868 0.22111627 0.6840309 0.24444285 0.66027373 0.25241333 0.6351568 0.24192403 0.60499936 0.22642238 0.6210091 0.21289764 0.6423563 0.2042976 0.6685919 0.20277795 0.69201195 0.20948553 0.70882106 0.22015369 0.71931773 0.23518339 0.7076659 0.24166131 0.69054717 0.24350837 0.6694564 0.24258481 0.64537776 0.23927754 0.62199306 0.23511863]

related to this picture:
image

I have tested this image on Android Studio with tflite model converted from the same model that I have tested it on python
I have got values and I have printed those values with Log.i function, but those values are differents

Observed Results:

2019-08-01 15:39:42.164 9148-9148/com.example.irisdetection I/Float results: point_0(0.2407, 0.1825)
2019-08-01 15:39:42.175 9148-9148/com.example.irisdetection I/Float results: point_1(0.2489, 0.162)
2019-08-01 15:39:42.179 9148-9148/com.example.irisdetection I/Float results: point_2(0.279, 0.1487)
2019-08-01 15:39:42.182 9148-9148/com.example.irisdetection I/Float results: point_3(0.3079, 0.1533)
2019-08-01 15:39:42.185 9148-9148/com.example.irisdetection I/Float results: point_4(0.3247, 0.1684)
2019-08-01 15:39:42.188 9148-9148/com.example.irisdetection I/Float results: point_5(0.3234, 0.1951)
2019-08-01 15:39:42.192 9148-9148/com.example.irisdetection I/Float results: point_6(0.2901, 0.2037)
2019-08-01 15:39:42.195 9148-9148/com.example.irisdetection I/Float results: point_7(0.2535, 0.1995)
2019-08-01 15:39:42.200 9148-9148/com.example.irisdetection I/Float results: point_8(0.2031, 0.2285)
2019-08-01 15:39:42.203 9148-9148/com.example.irisdetection I/Float results: point_9(0.2183, 0.2082)
2019-08-01 15:39:42.207 9148-9148/com.example.irisdetection I/Float results: point_10(0.2423, 0.1852)
2019-08-01 15:39:42.224 9148-9148/com.example.irisdetection I/Float results: point_11(0.2715, 0.1725)
2019-08-01 15:39:42.227 9148-9148/com.example.irisdetection I/Float results: point_12(0.3015, 0.166)
2019-08-01 15:39:42.230 9148-9148/com.example.irisdetection I/Float results: point_13(0.33, 0.1637)
2019-08-01 15:39:42.235 9148-9148/com.example.irisdetection I/Float results: point_14(0.3488, 0.1725)
2019-08-01 15:39:42.240 9148-9148/com.example.irisdetection I/Float results: point_15(0.3373, 0.1837)
2019-08-01 15:39:42.244 9148-9148/com.example.irisdetection I/Float results: point_16(0.3082, 0.1855)
2019-08-01 15:39:42.247 9148-9148/com.example.irisdetection I/Float results: point_17(0.2814, 0.1942)
2019-08-01 15:39:42.251 9148-9148/com.example.irisdetection I/Float results: point_18(0.2493, 0.2056)
2019-08-01 15:39:42.255 9148-9148/com.example.irisdetection I/Float results: point_19(0.2222, 0.2196)
2019-08-01 15:39:42.258 9148-9148/com.example.irisdetection I/Float results: point_20(0.6712, 0.1122)
2019-08-01 15:39:42.264 9148-9148/com.example.irisdetection I/Float results: point_21(0.6758, 0.0811)
2019-08-01 15:39:42.267 9148-9148/com.example.irisdetection I/Float results: point_22(0.7053, 0.0666)
2019-08-01 15:39:42.270 9148-9148/com.example.irisdetection I/Float results: point_23(0.7441, 0.0746)
2019-08-01 15:39:42.273 9148-9148/com.example.irisdetection I/Float results: point_24(0.7659, 0.1031)
2019-08-01 15:39:42.276 9148-9148/com.example.irisdetection I/Float results: point_25(0.7623, 0.1336)
2019-08-01 15:39:42.280 9148-9148/com.example.irisdetection I/Float results: point_26(0.7318, 0.148)
2019-08-01 15:39:42.283 9148-9148/com.example.irisdetection I/Float results: point_27(0.6929, 0.144)
2019-08-01 15:39:42.287 9148-9148/com.example.irisdetection I/Float results: point_28(0.6469, 0.1264)
2019-08-01 15:39:42.290 9148-9148/com.example.irisdetection I/Float results: point_29(0.6645, 0.1132)
2019-08-01 15:39:42.293 9148-9148/com.example.irisdetection I/Float results: point_30(0.6939, 0.0993)
2019-08-01 15:39:42.296 9148-9148/com.example.irisdetection I/Float results: point_31(0.7263, 0.0982)
2019-08-01 15:39:42.299 9148-9148/com.example.irisdetection I/Float results: point_32(0.764, 0.109)
2019-08-01 15:39:42.303 9148-9148/com.example.irisdetection I/Float results: point_33(0.7946, 0.1228)
2019-08-01 15:39:42.306 9148-9148/com.example.irisdetection I/Float results: point_34(0.8153, 0.1406)
2019-08-01 15:39:42.310 9148-9148/com.example.irisdetection I/Float results: point_35(0.8017, 0.1358)
2019-08-01 15:39:42.313 9148-9148/com.example.irisdetection I/Float results: point_36(0.7718, 0.1278)
2019-08-01 15:39:42.317 9148-9148/com.example.irisdetection I/Float results: point_37(0.7368, 0.1244)
2019-08-01 15:39:42.320 9148-9148/com.example.irisdetection I/Float results: point_38(0.7025, 0.1201)
2019-08-01 15:39:42.324 9148-9148/com.example.irisdetection I/Float results: point_39(0.6678, 0.1303)

Relevant Code:
For the code, you can get from here

How can I solve this problem?