Android Question Firebase ML-Vision Face detection:java.io.FileNotFoundException: AssetsDir/clown_nose.png

vp2020

Member
Licensed User
Hi,

Thank you @DonManfred for this library
Firebase ML Vision

App Starts successfully and barcode or text can be scanned, but when I switch to Face, Contour-Recognition, the app crashes!

the unfiltered log file logged errors:
AssetsDir/clown_nose.png: open failed: ENOENT (No such file or directory),
face_detector_v2_jni.cc:33 Loading models/fssd_25_8bit_v1.tflite
face_detector_v2_jni.cc:41 Unable to open asset: models/fssd_25_8bit_v1.tflite
and others errors.

I confirm that the file 'clown_nose.png' exists at File Folder and can be read, if I pressed Button1.

Have I missed something? Please help!

B4X:
spRegognizers_ItemClick(3, Face Detection)
app passed NULL surface
Using Face Detector Processor
Unable to decode stream: java.io.FileNotFoundException: AssetsDir/clown_nose.png: open failed: ENOENT (No such file or directory)
Considering local module com.google.android.gms.vision.dynamite.face:180000 and remote module com.google.android.gms.vision.dynamite.face:0
Selected local version of com.google.android.gms.vision.dynamite.face
face_detector_v2_jni.cc:33 Loading models/fssd_25_8bit_v1.tflite
face_detector_v2_jni.cc:41 Unable to open asset: models/fssd_25_8bit_v1.tflite
face_detector_v2_jni.cc:33 Loading models/fssd_25_8bit_gray_v1.tflite
face_detector_v2_jni.cc:41 Unable to open asset: models/fssd_25_8bit_gray_v1.tflite
face_detector_v2_jni.cc:33 Loading models/LMprec_600.emd
face_detector_v2_jni.cc:41 Unable to open asset: models/LMprec_600.emd
face_detector_v2_jni.cc:33 Loading models/BCLlefteyeclosed_200.emd
face_detector_v2_jni.cc:41 Unable to open asset: models/BCLlefteyeclosed_200.emd
face_detector_v2_jni.cc:33 Loading models/BCLrighteyeclosed_200.emd
face_detector_v2_jni.cc:41 Unable to open asset: models/BCLrighteyeclosed_200.emd
face_detector_v2_jni.cc:33 Loading models/BCLjoy_200.emd
face_detector_v2_jni.cc:41 Unable to open asset: models/BCLjoy_200.emd
face_detector_v2_jni.cc:33 Loading models/MFT_fssd_fastgray.pb
face_detector_v2_jni.cc:41 Unable to open asset: models/MFT_fssd_fastgray.pb
face_detector_v2_jni.cc:33 Loading models/contours.tfl
face_detector_v2_jni.cc:41 Unable to open asset: models/contours.tfl
face_detector_v2_jni.cc:33 Loading models/blazeface.tfl
face_detector_v2_jni.cc:41 Unable to open asset: models/blazeface.tfl
Could not open 'models/fssd_25_8bit_v1.tflite'.
--------- beginning of crash
Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 19371 (FirebaseMLHandl)

my manifest file:

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.

CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)
AddPermission(android.permission.CAMERA) ' Required to be able to access the camera device.
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE) ' Allows an application to write to external storage.


AddApplicationText(
 <service android:name="com.google.firebase.components.ComponentDiscoveryService" >
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
             <meta-data
                android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
           <meta-data
                    android:name="com.google.firebase.components:com.google.firebase.ml.common.CommonComponentRegistrar"
                    android:value="com.google.firebase.components.ComponentRegistrar" />
           <meta-data
                    android:name="com.google.firebase.components:com.google.firebase.ml.vision.VisionRegistrar"
                    android:value="com.google.firebase.components.ComponentRegistrar" />
</service>
)
 

DonManfred

Expert
Licensed User
Longtime User
Have you tried to put a image with this name into your files folder? clown_nose.png
 
Upvote 0

vp2020

Member
Licensed User
Have you tried to put a image with this name into your files folder? clown_nose.png
Thank you DonManFred for your reply.

Files folder does contain clown_nose.png file,
apk file also does contain clown_nose.png in assets folder.
I seems like assets folder insider the apk file not accessible.

How to solve it? please help!
 

Attachments

  • 屏幕截图 2021-12-09 150513.png
    屏幕截图 2021-12-09 150513.png
    5.6 KB · Views: 49
  • 屏幕截图 2021-12-09 152120.png
    屏幕截图 2021-12-09 152120.png
    17.4 KB · Views: 53
Upvote 0

ppgirl

Member
Licensed User
Longtime User
Hi @vp2020,

I don't know if you fix the issue , the root cause is the ML library need load ".tflite" file without compressed. The android studio has the option and B4A has not.

For "noCompress", As @Erel 's workround is to change the ".tflite" filename to ".zip","mp3" . but it is impossble if you has not library's source code.

build.gradle -
aaptOptions {
noCompress "tflite"
}
 
Upvote 0
Top