fix bug confidence
This commit is contained in:
parent
b006af4e1f
commit
924d23dad0
|
@ -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);",
|
||||
|
|
|
@ -90,17 +90,22 @@
|
|||
<div style="width: 500px;position: absolute;right:0;top: 250px;" id='form' class="hidden">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading text-bold">
|
||||
List management
|
||||
Quản lý mẫu
|
||||
<i class="fa fa-remove pull-right" style="cursor: pointer;" onclick="_close();"></i>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<img src="" class="img-thumbnail" id="FaceImage" style="width: 150px;height: 150px;">
|
||||
<div class='feature-img'>
|
||||
<img src="" class="img-thumbnail" id="closest-img" style="width: 100px;height:100px;">
|
||||
<br>
|
||||
<i id="closest-name"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Type</div>
|
||||
<div class="col-md-4 text-right">Danh sách</div>
|
||||
<div class="col-md-8">
|
||||
<select style="width: 100%;height: 26px;" name="Type">
|
||||
<option value="wl">White list</option>
|
||||
|
@ -118,34 +123,34 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Name</div>
|
||||
<div class="col-md-4 text-right">Tên</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Gender</div>
|
||||
<div class="col-md-4 text-right">Giới tính</div>
|
||||
<div class="col-md-8">
|
||||
<select style="width: 100%;height: 26px;" name="Gender">
|
||||
<option value="Male">Male</option>
|
||||
<option value="Female">Female</option>
|
||||
<option value="Male">Nam</option>
|
||||
<option value="Female">Nữ</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Birthday</div>
|
||||
<div class="col-md-4 text-right">Ngày sinh</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Birthday" id="birthday">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Telephone</div>
|
||||
<div class="col-md-4 text-right">Điện thoại</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Telephone">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Department</div>
|
||||
<div class="col-md-4 text-right">Đơn vị</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Address">
|
||||
</div>
|
||||
|
@ -154,8 +159,8 @@
|
|||
</div>
|
||||
<div class="text-center">
|
||||
<input type="hidden" value="" name="CaptureLogsID">
|
||||
<button onclick="_save(this);" data-href='{Url::to(["/list-management/create"])}'>Save</button>
|
||||
<button onclick="_close();">Cancel</button>
|
||||
<button onclick="_save(this);" data-href='{Url::to(["/list-management/create"])}'>Lưu</button>
|
||||
<button onclick="_close();">Hủy</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
'class' => 'table table-striped table-bordered',
|
||||
'style' => 'background:#fff;min-width:700px;'
|
||||
],
|
||||
'rowOptions' => \app\helpers\CaptureLogsGrid::rows(),
|
||||
'rowOptions' => \app\helpers\CaptureLogsGrid::rowsControlLogs(),
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'id',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
// comment out the following two lines when deployed to production
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
//defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
//defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
|
||||
|
|
|
@ -23,6 +23,9 @@ function _form(e) {
|
|||
$("#form").removeClass("hidden");
|
||||
$("input[name='CaptureLogsID']").val($(e).attr("data-id"));
|
||||
$("#FaceImage").attr("src", $(e).attr("data-img"));
|
||||
var confidence = JSON.parse($(e).attr("data-confidence"));
|
||||
$("#closest-img").attr("src", confidence.img);
|
||||
$("#closest-name").html(confidence.name + " [" + confidence.score + "]");
|
||||
}
|
||||
|
||||
function _close() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user