Compare commits
4 Commits
dev_DTD_ol
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 575bd6ce75 | |||
| 6c7ecf7f26 | |||
| cb889f1084 | |||
| b29904a2b5 |
@@ -3,6 +3,5 @@
|
||||
return [
|
||||
'adminEmail' => 'admin@example.com',
|
||||
"maxLogs" => 100000,
|
||||
"maxPicture" => 5,
|
||||
"version" => "1.0.7"
|
||||
"maxPicture" => 2
|
||||
];
|
||||
|
||||
@@ -78,7 +78,7 @@ class ApiController extends Controller {
|
||||
"Staff" => $post["id"],
|
||||
"Time" => $time,
|
||||
"Image" => $fileName,
|
||||
"Confidence" => json_encode($post["confidence"])
|
||||
"Confidence" => strval($post["confidence"])
|
||||
]);
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "https://dev-dc.beetai.com";
|
||||
@@ -124,30 +124,17 @@ class ApiController extends Controller {
|
||||
$allFeatures = [];
|
||||
foreach ($listManagement as $key => $value) {
|
||||
$features = json_decode($value->image, true);
|
||||
// $f = [];
|
||||
// foreach ($features as $k => $v) {
|
||||
// $f[] = $v['features'];
|
||||
// if (isset($v['features512']))
|
||||
// if (count($v['features512']))
|
||||
// $f[] = $v['features512'];
|
||||
// }
|
||||
// $allFeatures[] = [
|
||||
// "id" => $value->id,
|
||||
// "name" => $this->convert_vi_to_en($value->name),
|
||||
// "features" => $f
|
||||
// ];
|
||||
$feature1 = $feature2 = [];
|
||||
$f = [];
|
||||
foreach ($features as $k => $v) {
|
||||
$feature1[] = $v['features'];
|
||||
$f[] = $v['features'];
|
||||
if (isset($v['features512']))
|
||||
if (count($v['features512']))
|
||||
$feature2[] = $v['features512'];
|
||||
$f[] = $v['features512'];
|
||||
}
|
||||
$allFeatures[] = [
|
||||
"id" => $value->id,
|
||||
"name" => $this->convert_vi_to_en($value->name),
|
||||
"feature1" => $feature1,
|
||||
"feature2" => $feature2
|
||||
"features" => $f
|
||||
];
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
@@ -248,8 +235,6 @@ class ApiController extends Controller {
|
||||
|
||||
public function actionAutoGenFeature() {
|
||||
Yii::$app->response->format = "json";
|
||||
if (!$this->check512())
|
||||
return ["status" => false];
|
||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
if (!$updating) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
@@ -259,21 +244,13 @@ class ApiController extends Controller {
|
||||
]);
|
||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
}
|
||||
$currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true);
|
||||
if ($updating->data === "true") {
|
||||
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
||||
$updating->data = "false";
|
||||
$updating->save();
|
||||
$txt = "\n" . date("H:i:s d/m/Y") . " " . "success";
|
||||
file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
|
||||
return ["status" => false];
|
||||
} else {
|
||||
$txt = "\n" . date("H:i:s d/m/Y") . " " . "updating";
|
||||
file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
|
||||
return ["status" => false];
|
||||
}
|
||||
$txt = "\n" . date("H:i:s d/m/Y") . " " . "updating";
|
||||
file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
|
||||
return ["status" => false];
|
||||
}
|
||||
|
||||
$currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true);
|
||||
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
||||
$txt = "\n" . date("H:i:s d/m/Y") . " " . "success";
|
||||
file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
|
||||
@@ -415,66 +392,31 @@ class ApiController extends Controller {
|
||||
'data' => $post['token']
|
||||
]);
|
||||
}
|
||||
$version = \app\models\SyncUrl::findOne(['key_config' => 'version']);
|
||||
if ($version) {
|
||||
$version->data = $post['version'];
|
||||
$version->save();
|
||||
} else {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => "version",
|
||||
'data' => $post['version']
|
||||
]);
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
return ["status" => true];
|
||||
}
|
||||
}
|
||||
|
||||
public function check512() {
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
])), true);
|
||||
if (!$tempConfig['status'])
|
||||
return false;
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0)
|
||||
return false;
|
||||
|
||||
$checkConfig = json_decode(file_get_contents("http://localhost:4004/ReadConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'path' => $engineConfig['data']['engines'][0]['path']
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
|
||||
if (!$checkConfig['status'])
|
||||
return false;
|
||||
|
||||
$config_json = "";
|
||||
if ($checkConfig['status']) {
|
||||
$config_json = json_decode($checkConfig['data'], true);
|
||||
$check512 = $config_json['feature']['type2']['enable'];
|
||||
if ($check512 !== "0")
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function actionTest() {
|
||||
// $updating = \app\models\SyncUrl::findOne(['key_config' => 'token']);
|
||||
$updating = \app\models\SyncUrl::find()->all();
|
||||
foreach ($updating as $key => $value) {
|
||||
echo $value->key_config . " " . $value->data . "<br>";
|
||||
$check = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
$check->data = "false";
|
||||
$check->save();
|
||||
return var_dump($check);
|
||||
// file_get_contents("http://localhost:2305/update-feature");
|
||||
// return;
|
||||
set_time_limit(0);
|
||||
$lists = ListManagement::find()->all();
|
||||
foreach ($lists as $key => $value) {
|
||||
$extract = false;
|
||||
$images = json_decode($value->image, true);
|
||||
$newImgs = [];
|
||||
foreach ($images as $k => $v) {
|
||||
$v['features512'] = [];
|
||||
$newImgs[] = $v;
|
||||
}
|
||||
$value->image = json_encode($newImgs);
|
||||
$value->save();
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
public function actionReGenFeature() {
|
||||
@@ -486,15 +428,7 @@ class ApiController extends Controller {
|
||||
'data' => "false"
|
||||
]);
|
||||
} else {
|
||||
if ($this->check512()) {
|
||||
$currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true);
|
||||
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
||||
$updating->data = "true";
|
||||
} else {
|
||||
$updating->data = "false";
|
||||
}
|
||||
} else
|
||||
$updating->data = "false";
|
||||
$updating->data = "false";
|
||||
$updating->save();
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
|
||||
@@ -339,7 +339,7 @@ class ConfigController extends Controller {
|
||||
try {
|
||||
file_get_contents("http://localhost:2305/update-feature");
|
||||
} catch (\Exception $exc) {
|
||||
|
||||
// echo $exc->getTraceAsString();
|
||||
}
|
||||
}
|
||||
return Url::to(['/config']);
|
||||
|
||||
@@ -578,8 +578,7 @@ class ListManagementController extends Controller {
|
||||
])), true);
|
||||
foreach ($results as $key => $value) {
|
||||
$images = [];
|
||||
$imagesReverse = array_reverse($value['images']);
|
||||
foreach ($imagesReverse as $k => $v) {
|
||||
foreach ($value['images'] as $k => $v) {
|
||||
if ($k < Yii::$app->params['maxPicture']) {
|
||||
$key = common::generateRandomString();
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
|
||||
@@ -63,62 +63,11 @@ 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 $confidence['percent1']; //$person1_html . $person2_html;
|
||||
};
|
||||
}
|
||||
|
||||
public static function confidenceControlLogs() {
|
||||
return function($model) {
|
||||
$confidence = json_decode($model->confidence, true);
|
||||
return $confidence['percent1'] . ($confidence['percent2'] > 0 ? " [" . $confidence['percent2'] . "]" : "");
|
||||
return number_format($model->confidence, 2);
|
||||
};
|
||||
}
|
||||
|
||||
public static function rows() {
|
||||
return function($model, $index, $widget, $grid) {
|
||||
$confidence = json_decode($model->confidence, true);
|
||||
$person = isset($confidence['id1']) ? \app\models\ListManagement::findOne($confidence['id1']) : false;
|
||||
$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" => isset($confidence['percent1']) ? $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);",
|
||||
|
||||
@@ -118,24 +118,14 @@ class ListManagement extends \yii\db\ActiveRecord {
|
||||
|
||||
public function getAllFeatures() {
|
||||
$features = json_decode($this->image, true);
|
||||
// $f = [];
|
||||
// foreach ($features as $k => $v) {
|
||||
// $f[] = $v['features'];
|
||||
// if (isset($v['features512']))
|
||||
// if (count($v['features512']))
|
||||
// $f[] = $v['features512'];
|
||||
// }
|
||||
$feature1 = $feature2 = [];
|
||||
$f = [];
|
||||
foreach ($features as $k => $v) {
|
||||
$feature1[] = $v['features'];
|
||||
$f[] = $v['features'];
|
||||
if (isset($v['features512']))
|
||||
if (count($v['features512']))
|
||||
$feature2[] = $v['features512'];
|
||||
$f[] = $v['features512'];
|
||||
}
|
||||
return [
|
||||
"feature1" => $feature1,
|
||||
"feature2" => $feature2
|
||||
];
|
||||
return $f;
|
||||
}
|
||||
|
||||
public static function statisticFeatures() {
|
||||
|
||||
@@ -4,5 +4,5 @@ copy.src.target=
|
||||
remote.connection=BiFace-99bab6
|
||||
remote.directory=/BiFace_Server_Lite
|
||||
remote.upload=ON_SAVE
|
||||
run.as=REMOTE
|
||||
run.as=LOCAL
|
||||
url=http://localhost/
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<?php
|
||||
|
||||
use yii\widgets\Breadcrumbs;
|
||||
use dmstr\widgets\Alert;
|
||||
|
||||
?>
|
||||
<div class="content-wrapper">
|
||||
<!-- <section class="content-header">
|
||||
<?=
|
||||
Breadcrumbs::widget(
|
||||
<?=
|
||||
Breadcrumbs::widget(
|
||||
[
|
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
||||
]
|
||||
)
|
||||
?>
|
||||
) ?>
|
||||
</section>-->
|
||||
|
||||
<section class="content" style="padding: 0 0 15px 0;">
|
||||
@@ -22,12 +21,8 @@ use dmstr\widgets\Alert;
|
||||
</div>
|
||||
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right hidden-xs">
|
||||
<b>Version: </b>
|
||||
<?php
|
||||
$version = \app\models\SyncUrl::findOne(['key_config' => 'version']);
|
||||
echo $version ? $version->data : Yii::$app->params["version"];
|
||||
?>
|
||||
<div class="pull-right hidden-xs" style="margin-top: 10px;">
|
||||
<!--<b>Hotline</b> <a href="tel:0912461556">091.246.1556</a>-->
|
||||
</div>
|
||||
<!--<strong>Copyright © 2020 <a href="https://beetinnovators.com/"><img src="/images/BI_Logo.png" width="80px"></a> & <a href="https://tctech.vn/"><img src="/images/TCTech.jpg" width="80px"></a>.</strong> All rights reserved.-->
|
||||
<strong>Copyright © 2020 <a href="https://beetinnovators.com/">BEETINNOVATORS</a>.</strong> All rights reserved.
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
'attribute' => 'confidence',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'format' => "raw",
|
||||
'value' => \app\helpers\CaptureLogsGrid::confidence()
|
||||
],
|
||||
[
|
||||
@@ -90,22 +89,17 @@
|
||||
<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">
|
||||
Quản lý mẫu
|
||||
List management
|
||||
<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">Danh sách</div>
|
||||
<div class="col-md-4 text-right">Type</div>
|
||||
<div class="col-md-8">
|
||||
<select style="width: 100%;height: 26px;" name="Type">
|
||||
<option value="wl">White list</option>
|
||||
@@ -123,34 +117,34 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Tên</div>
|
||||
<div class="col-md-4 text-right">Name</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Giới tính</div>
|
||||
<div class="col-md-4 text-right">Gender</div>
|
||||
<div class="col-md-8">
|
||||
<select style="width: 100%;height: 26px;" name="Gender">
|
||||
<option value="Male">Nam</option>
|
||||
<option value="Female">Nữ</option>
|
||||
<option value="Male">Male</option>
|
||||
<option value="Female">Female</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Ngày sinh</div>
|
||||
<div class="col-md-4 text-right">Birthday</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">Điện thoại</div>
|
||||
<div class="col-md-4 text-right">Telephone</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Telephone">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">Đơn vị</div>
|
||||
<div class="col-md-4 text-right">Department</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Address">
|
||||
</div>
|
||||
@@ -159,8 +153,8 @@
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<input type="hidden" value="" name="CaptureLogsID">
|
||||
<button onclick="_save(this);" data-href='{Url::to(["/list-management/create"])}'>Lưu</button>
|
||||
<button onclick="_close();">Hủy</button>
|
||||
<button onclick="_save(this);" data-href='{Url::to(["/list-management/create"])}'>Save</button>
|
||||
<button onclick="_close();">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
'class' => 'table table-striped table-bordered',
|
||||
'style' => 'background:#fff;min-width:700px;'
|
||||
],
|
||||
'rowOptions' => \app\helpers\CaptureLogsGrid::rowsControlLogs(),
|
||||
'rowOptions' => \app\helpers\CaptureLogsGrid::rows(),
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'id',
|
||||
@@ -62,7 +62,7 @@
|
||||
'attribute' => 'confidence',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\CaptureLogsGrid::confidenceControlLogs()
|
||||
'value' => \app\helpers\CaptureLogsGrid::confidence()
|
||||
],
|
||||
'listManagement.name',
|
||||
'listManagement.gender',
|
||||
|
||||
@@ -23,9 +23,6 @@ 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() {
|
||||
|
||||
Reference in New Issue
Block a user