全部删除 完成
展开
AestheticsScoreDetector aestheticsScoreDetector = new AestheticsScoreDetector(MainActivity.this);
Frame frame = new Frame();
frame.setBitmap(bitmap);
JSONObject jsonObject = aestheticsScoreDetector.detect(frame,null);
AestheticsScore aestheticsScores = aestheticsScoreDetector.convertResult(jsonObject);
float score = aestheticsScores.getScore();
{
"resultCode":0,
"aestheticsScore":"{\"score\":91.11328125}",
"aestheticsScoreList":"{\"HFSCore\":[0.0],
\"OSPScores\":[0.9111328,0.07788086,0.18347168,0.017211914,0.33032227,-0.4152832,0.1586914,-0.7949219,0.15930176,0.8881836,-0.048034668,-0.06555176],
\"score\":91.11328}"
}
可以的,在faceCompare()方法中会默认启动引擎,如果引擎已经启动则不会再次启动,开发者可以放心使用。
release()方法会卸载在NPU芯片中已经加载的模型,请在应用不再使用美学评分时及时卸载模型,释放资源。