fix bug confidence
This commit is contained in:
@@ -64,26 +64,26 @@ class CaptureLogsGrid {
|
||||
public static function confidence() {
|
||||
return function($model) {
|
||||
$confidence = json_decode($model->confidence, true);
|
||||
$person1_html = $person2_html = "";
|
||||
$person1 = \app\models\ListManagement::findOne($confidence['id1']);
|
||||
if ($person1) {
|
||||
$images = json_decode($person1->image, true);
|
||||
$person1_html = "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $images[0]['url'], [
|
||||
"class" => "img-thumbnail",
|
||||
"style" => "width: 100px;height:100px;"
|
||||
]) . "<br>" . $person1->name . " [" . $confidence['percent1'] . "]" . "</div>";
|
||||
}
|
||||
if ($confidence['id2'] !== "0" && $confidence['id2'] != $confidence['id1']) {
|
||||
$person2 = \app\models\ListManagement::findOne($confidence['id2']);
|
||||
if ($person2) {
|
||||
$images = json_decode($person2->image, true);
|
||||
$person2_html = "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $images[0]['url'], [
|
||||
"class" => "img-thumbnail",
|
||||
"style" => "width: 100px;height:100px;"
|
||||
]) . "<br>" . $person2->name . " [" . $confidence['percent2'] . "]" . "</div>";
|
||||
}
|
||||
}
|
||||
return $person1_html . $person2_html;
|
||||
// $person1_html = $person2_html = "";
|
||||
// $person1 = \app\models\ListManagement::findOne($confidence['id1']);
|
||||
// if ($person1) {
|
||||
// $images = json_decode($person1->image, true);
|
||||
// $person1_html = "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $images[0]['url'], [
|
||||
// "class" => "img-thumbnail",
|
||||
// "style" => "width: 100px;height:100px;"
|
||||
// ]) . "<br>" . $person1->name . " [" . $confidence['percent1'] . "]" . "</div>";
|
||||
// }
|
||||
// if ($confidence['id2'] !== "0" && $confidence['id2'] != $confidence['id1']) {
|
||||
// $person2 = \app\models\ListManagement::findOne($confidence['id2']);
|
||||
// if ($person2) {
|
||||
// $images = json_decode($person2->image, true);
|
||||
// $person2_html = "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $images[0]['url'], [
|
||||
// "class" => "img-thumbnail",
|
||||
// "style" => "width: 100px;height:100px;"
|
||||
// ]) . "<br>" . $person2->name . " [" . $confidence['percent2'] . "]" . "</div>";
|
||||
// }
|
||||
// }
|
||||
return $confidence['percent1']; //$person1_html . $person2_html;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -95,6 +95,30 @@ class CaptureLogsGrid {
|
||||
}
|
||||
|
||||
public static function rows() {
|
||||
return function($model, $index, $widget, $grid) {
|
||||
$confidence = json_decode($model->confidence, true);
|
||||
$person = \app\models\ListManagement::findOne($confidence['id1']);
|
||||
$images = false;
|
||||
if ($person) {
|
||||
$images = json_decode($person->image, true);
|
||||
}
|
||||
return [
|
||||
"ondblclick" => "_form(this);",
|
||||
"style" => "cursor: pointer;",
|
||||
"data" => [
|
||||
"id" => $model->id,
|
||||
"img" => "/data/uploads/face/" . $model->image,
|
||||
"confidence" => json_encode([
|
||||
"name" => $person ? $person->name : "",
|
||||
"score" => $confidence['percent1'],
|
||||
"img" => isset($images[0]) ? "/data/uploads/face/" . $images[0]['url'] : ""
|
||||
])
|
||||
]
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
public static function rowsControlLogs() {
|
||||
return function($model, $index, $widget, $grid) {
|
||||
return [
|
||||
"ondblclick" => "_form(this);",
|
||||
|
||||
Reference in New Issue
Block a user