Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activity Recognition API unreliable?

I'm trying to use the activity recognition in a project to detect when the user is "IN-VEHICLE".(Driving) The problem is that it is almost impossibly to use it, as mostProbableActivity often report "IN-VEHICLE" even though I've been sitting at my desk for a long time or just walking around in my house. It would be very nice to know how the API conclude this.

I think this feature has great potential, but as now something is clearly not working.

This is a log of MostProbableActivity taken every 30 seconds to show what I mean. Sitting at my desk, after 4 minutes I turn the phone a couple of times, and this results in a "mostProbable IN-VEHICLE" result.

I've tried different phones and the result is the same. So I don't think it's hardware related.

DetectedActivity [type=STILL, confidence=43]
DetectedActivity [type=STILL, confidence=54]
DetectedActivity [type=STILL, confidence=100]
DetectedActivity [type=STILL, confidence=100]
DetectedActivity [type=STILL, confidence=69]
DetectedActivity [type=STILL, confidence=100]
DetectedActivity [type=STILL, confidence=92]
DetectedActivity [type=TILTING, confidence=100]
DetectedActivity [type=IN_VEHICLE, confidence=49]
DetectedActivity [type=TILTING, confidence=100]
DetectedActivity [type=STILL, confidence=51]
DetectedActivity [type=STILL, confidence=100]
DetectedActivity [type=STILL, confidence=100]
DetectedActivity [type=STILL, confidence=85]
DetectedActivity [type=STILL, confidence=100]
DetectedActivity [type=STILL, confidence=66]
DetectedActivity [type=STILL, confidence=100]

This is the code, nothing special there:

public class ActivitiesIntentService extends IntentService {


    private static final String TAG = "ActivitiesIntentService";


    public ActivitiesIntentService() {
        super(TAG);
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
        Intent i = new Intent(Constants.STRING_ACTION);


        DetectedActivity mostProbableActivity = result.getMostProbableActivity();


        i.putExtra("MOST_PROBABLE_ACTIVITY",mostProbableActivity);



        LocalBroadcastManager.getInstance(this).sendBroadcast(i);


        Log.e(TAG, String.valueOf(mostProbableActivity));
        }

}

From this link:

Activity Recognition API

I can see that others have similar experience, but some claims that it works OK.

I think this is a bug in the confidence algorithm of the API. It should be easy to conclude that the phone isn't moving in any direction, nor on a road so obviously NOT "mostProbable" in a VEHICLE.

Can anyone confirm this problem or do I use it the wrong way?

Best regards

Thomas

like image 941
user857558 Avatar asked Apr 14 '16 19:04

user857558


1 Answers

Bear in mind that this is a very low-energy consumption service, so it can't be looking at the device sensors constantly. That would drain the battery too quickly to be useful. Be sure to read the docs to understand the constraints.

If you want more accurate readings, increase your detection interval. That will give it more data to work with.

Also bear in mind these measurements are to be taken broadly. A possible use case is to estimate how much time the carrier of the device has been engaged in physical activity, or to activate and deactivate components of an app that should be running when the carrier is doing one of the detected activities.

like image 72
Doug Stevenson Avatar answered Oct 14 '22 19:10

Doug Stevenson