活动识别API不可靠? [英] Activity Recognition API unreliable?

查看:79
本文介绍了活动识别API不可靠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在项目中使用活动识别来检测用户何时处于车载"状态.(驱动)问题是几乎不可能使用它,因为mostProbableActivity经常报告车载"即使我已经坐在办公桌旁很长一段时间,或者只是在家里走来走去.知道API是如何得出结论的,这真是太好了.

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.

这是每30秒记录一次MostProbableActivity的日志,以显示我的意思.坐在我的办公桌上,经过4分钟后,我翻了几次电话,结果是最有可能的车载"结果.

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));
        }

}

通过此链接:

活动识别API

我可以看到其他人也有类似的经历,但是有些人声称它可以正常工作.

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

我认为这是API的置信度算法中的错误.很容易得出这样的结论:电话没有朝着任何方向移动,也没有在显然不是车辆中最可能"的道路上移动.

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?

最诚挚的问候

托马斯

推荐答案

请记住,这是一项能耗非常低的服务,因此它不能一直关注设备传感器.那样会很快耗尽电池,以至于无法使用.请确保阅读文档以了解约束.

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.

这篇关于活动识别API不可靠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆