识别相似度阈值设为99%,未识别到物品增加弹窗

This commit is contained in:
2025-11-06 08:55:57 +08:00
parent 51e4170757
commit 30ce3499eb
3 changed files with 10 additions and 2 deletions
@@ -230,6 +230,14 @@ abstract class GoodsListActivity : ComponentActivity() {
Timber.d("${this.javaClass.simpleName}-searchFood-裁剪bitmap保存文件路径:${file?.absolutePath}")
val foodNameList = FoodModule.queryFood(newBmp)
runOnUiThread {
if (foodNameList.isEmpty()) {
handleGoodsResult(
goodsList = mutableListOf(),
file = file,
name = null
)
return@runOnUiThread
}
viewModel.recognizeGoodsList(foodNameList) { goodsList ->
handleGoodsResult(
goodsList = if (goodsList.size == foodNameList.size) goodsList else mutableListOf(),
@@ -15,7 +15,7 @@ import com.sw.inbound.utils.ext.hideKeyboard
abstract class BaseDialog(
context: Context,
var defWidth: Int = 1500.dp,
var defHeight: Int = 800.dp
var defHeight: Int = 900.dp
) : Dialog(context, R.style.DialogTheme) {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -96,7 +96,7 @@ object FoodModule {
nameScoreList.add(IdNameScore(id = it.id, name = box.get(it.id).name?:"", score = it.score))
}
Timber.tag("FoodModule").d("queryFood数据:${nameScoreList.toJsonString()}")
idScoreList.filter { it.score < 0.2 }.forEach {
idScoreList.filter { it.score < 0.01 }.forEach {
val food = box.get(it.id)
//FoodQueryResult(id = it.id, name = food.name, foodIdx = food.foodIdx, score = it.score)
food.name?.let { key ->