Coder Social home page Coder Social logo

kairosinc / kairos-sdk-android Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 447 KB

The Android client for the Kairos Face Recognition API. Includes example Facial Recognition project and SDK jar library.

Home Page: https://www.kairos.com/face-recognition-api

License: MIT License

Java 100.00%

kairos-sdk-android's People

Contributors

coleca avatar dr-xperience avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kairos-sdk-android's Issues

only matching images ..different images with same face are not recogizing

I am adding image in gallery by getting image from gallery using enroll api.
Now for recognition I am using recognition api.If I pick same image from gallery ,Its giving me result properly.But I pick other image of same person (That is face is same as image i have enrolled) ,its giving me no result found .please help.

java.net.SocketTimeoutException

I'm getting a java.net.SocketTimeoutException. Previous requests and calls done with kairos have been successful. When I'm deleting a user from a particular gallery, all is functioning well. It appears the java.net.SocketTimeoutException appears only when I try to Verify or Enroll images.

What could be the cause?

Handling Network errors

Hi

I tried to enroll a face when the network is turned off (Its works perfect when the network is ON). I get a NullPointerException and app crashes. I've put try-catch around enroll method but I it's still the same. Is there a way to handle this exception?

My Code:


if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
            photo = (Bitmap) data.getExtras().get("data");
            String subjectId = nameInput.getText().toString();
            String galleryId = serialNo;
            String selector = "FULL";
            String multipleFaces = "true";
            String minHeadScale = "0.25";
            try {
                myKairos.enroll(photo,
                        subjectId,
                        galleryId,
                        selector,
                        multipleFaces,
                        minHeadScale,
                        listener);
            } catch (JSONException | UnsupportedEncodingException | NullPointerException e ) {
                e.printStackTrace();
            }
        }

Runtime error

E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: com.vaddi.hemanth.oyna, PID: 11180
                                                                        java.lang.NullPointerException: Attempt to get length of null array
                                                                            at java.lang.StringFactory.newStringFromBytes(StringFactory.java:45)
                                                                            at com.kairos.Kairos$8.onFailure(Kairos.java:464)
                                                                            at com.loopj.android.http.AsyncHttpResponseHandler.handleMessage(AsyncHttpResponseHandler.java:319)
                                                                            at com.loopj.android.http.AsyncHttpResponseHandler$ResponderHandler.handleMessage(AsyncHttpResponseHandler.java:138)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                            at android.os.Looper.loop(Looper.java:154)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Cannot catch JSON response

Enroll request is successful, I see it on Kairos Dashboard. Unfortunately I cannot catch JSON formatted response. I use this class for connection:

public class Connection {
    URL url1 = null;
    HttpURLConnection httpURLConnection= null;
    BufferedReader reader;
    String json=null;
    public String connect(String url){
        try {
            url1= new URL(url);
            httpURLConnection=(HttpURLConnection)url1.openConnection();
            httpURLConnection.connect();
            InputStream in = httpURLConnection.getInputStream();
            reader=new BufferedReader(new InputStreamReader(in));
            StringBuffer buffer= new StringBuffer();
            String line="";
            while((line=reader.readLine())!=null){
                buffer.append(line);
            }
            json=buffer.toString();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            if(httpURLConnection!=null){
                httpURLConnection.disconnect();
            }
            if(reader!=null){
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return json;
    }
}

Call:

        Connection con = new Connection();
        parsedString = con.connect("https://api.kairos.com/enroll");

And this for parsing:

        try {
            JSONObject jsonRootObject = new JSONObject(text);
            JSONArray jsonArray = jsonRootObject.optJSONArray("images");

            for(int i=0; i < jsonArray.length(); i++){
                JSONObject jsonObject = jsonArray.getJSONObject(i);

                String status = jsonObject.optString("status").toString();
                String face_id = jsonObject.optString("face_id").toString();

                toast(status);
                toast(face_id);
            }
        } catch (JSONException e){
            e.printStackTrace();
        }

I get always NullPointerException for the text string.

Run project

How do you run the project? There isn't a build.gradle file.
How should I set up the build.gradle?

only matching images ..different images with same face are not recogizing

In my demo I am adding one image of mine using enroll api with subject id "test".
Now I am again choose same image from gallery and call recognize api ,it's giving me proper response.

But I choose second image of mine (i.e faces of both images are same) but now recognize api giving now search found.pls help about this

Backup Registered Faces

Is there any function to backup registered faces? In case application will be used in another devices.

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.