人脸属性FAQ

[问题一]没有调用接口的prepare()方法可以直接使用faceCompare()方法吗?
可以的,在faceCompare()方法中会默认启动引擎,如果引擎已经启动则不会再次启动,开发者可以放心使用。

[问题二]release()方法是什么时候调用?
release()方法会卸载引擎中已经加载的模型,请在应用不再使用人脸属性时及时卸载模型,释放资源。
FaceComparator faceComparator = new FaceComparator(getApplicationContext());
for(……) {
   JSONObject jsonObject = faceComparator.faceCompare(frame1, frame2, null);
   FaceCompareResult result = faceComparator.convertResult(jsonObject);
   //do something
}
faceComparator.release();

[问题三]如何判断手机是否支持人脸属性能力?
如下:例如在Activity的onCreate()方法中:
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  ......
  VisionBase.init(this, new ConnectionCallback() {
    @Override
    public void onServiceConnect() {
      FaceAttributesDetector detect = new FaceAttributesDetector(mContext);
      int prepare = compare.prepare();
      if (prepare == 0) {
        //支持
      } else {
        //不支持
      }
    }
    @Override
    public void onServiceDisconnect() {
    }
  });
  ......
}