Git Product home page Git Product logo

Comments (8)

shubham0204 avatar shubham0204 commented on June 27, 2024

The imageDir.listFiles() method would throw a NullPointerException maybe because the imageDir is itself null. As you said you have created the images directory correctly, make sure you have created this directory in the device's internal storage and not the external storage.

from facerecognition_with_facenet_android.

shubham0204 avatar shubham0204 commented on June 27, 2024

You may rebuild the project to check if the issue is solved. See this commit.

from facerecognition_with_facenet_android.

vedant-creator avatar vedant-creator commented on June 27, 2024

I have no external sd card in my device, filepath which received in logcat was /storage/emaluated/0/images
i created folders in it as jeff_bezos and tested if it was a valid directory with isdirectory() it returned a true value, so I am not sure why .listfiles() method is returning null value

from facerecognition_with_facenet_android.

vedant-creator avatar vedant-creator commented on June 27, 2024

Okay i will try to rebuild it again

from facerecognition_with_facenet_android.

vedant-creator avatar vedant-creator commented on June 27, 2024

I tried the latest commit, still facing the same issue, I have added the logs for directory check and file path

 val imagesDir = File( Environment.getExternalStorageDirectory()!!.absolutePath + "/images" )
            val imagesSubDir1 = File( Environment.getExternalStorageDirectory()!!.absolutePath + "/images/vedant" )
            Log.w("fullpath", "" + imagesDir)
            if(imagesSubDir1.isDirectory){
                Log.w("fullpath", "yes" )
            }
            val imageSubDirs = imagesDir.listFiles()
            Log.w("fullpath", "" + imageSubDirs)
            if ( imageSubDirs == null ) {
                Toast.makeText( this , "Could not read images. Make sure you've have a folder as described in the README" ,
                        Toast.LENGTH_LONG ).show()
                return

Logcat output:

2020-09-17 21:34:51.211 16013-16013/com.ml.quaterion.facenetdetection W/fullpath: /storage/emulated/0/images
2020-09-17 21:34:51.211 16013-16013/com.ml.quaterion.facenetdetection W/fullpath: yes
2020-09-17 21:34:51.211 16013-16013/com.ml.quaterion.facenetdetection W/fullpath: null

from facerecognition_with_facenet_android.

shubham0204 avatar shubham0204 commented on June 27, 2024

@vedant-creator, thanks for the logs. I'll go through the issue once again and revert back to you. Also, please share your device's Android version so that I can resolve any issues with the API quickly.

from facerecognition_with_facenet_android.

vedant-creator avatar vedant-creator commented on June 27, 2024

I am using Android 10
Thank you for the efforts i hope the issue get solved

from facerecognition_with_facenet_android.

vedant-creator avatar vedant-creator commented on June 27, 2024

Hey @shubham0204 thanks for your support
I have solved the issue, in android 10 or API level above 29
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
android:requestLegacyExternalStorage="true"
needs to be added in manifest file

from facerecognition_with_facenet_android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.