Browse Source

[完善]文件转化

非煤矿业企业安全风险监测预警系统
邵佳豪 2 years ago
parent
commit
02d11704e9
  1. 10908
      package-lock.json
  2. 1
      package.json
  3. 31
      src/app/system-management/host-config/host-config.component.ts
  4. 148
      src/assets/file/config_arm.yaml

10908
package-lock.json generated

File diff suppressed because it is too large Load Diff

1
package.json

@ -24,6 +24,7 @@
"ngx-cookie-service": "^13.1.2", "ngx-cookie-service": "^13.1.2",
"rxjs": "~7.4.0", "rxjs": "~7.4.0",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"yaml": "^2.2.1",
"zone.js": "~0.11.4" "zone.js": "~0.11.4"
}, },
"devDependencies": { "devDependencies": {

31
src/app/system-management/host-config/host-config.component.ts

@ -36,7 +36,7 @@ interface Camera {
} }
import yaml from 'js-yaml'; import yaml from 'js-yaml';
// declare var yaml: any; import * as YAML from 'yaml';
@Component({ @Component({
selector: 'app-host-config', selector: 'app-host-config',
@ -592,7 +592,7 @@ sources:`;
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
} }
//整理配置文件数据 //整理配置文件数据
disposalData() { async disposalData() {
let copyListOfData = JSON.parse(JSON.stringify(this.listOfData)); let copyListOfData = JSON.parse(JSON.stringify(this.listOfData));
copyListOfData = copyListOfData.filter((item, i) => { copyListOfData = copyListOfData.filter((item, i) => {
return item.isEnabled; return item.isEnabled;
@ -880,6 +880,7 @@ ${newstr}class-id=0
console.log(this.hostData); console.log(this.hostData);
//如果之前保存过文件 //如果之前保存过文件
if (this.hostData.configFiles && this.hostData.configFiles.length !== 0) { if (this.hostData.configFiles && this.hostData.configFiles.length !== 0) {
console.log('走这里了吗')
let config_arm = this.hostData.configFiles.find( let config_arm = this.hostData.configFiles.find(
(item) => item.name == 'config_arm.yaml' (item) => item.name == 'config_arm.yaml'
).content; ).content;
@ -891,6 +892,8 @@ ${newstr}class-id=0
//修改config_arm.yaml文件 //修改config_arm.yaml文件
//更改connet_oil //更改connet_oil
let config_armObj = yaml.load(config_arm); let config_armObj = yaml.load(config_arm);
// let config_armObj = YAML.parse(config_arm);
// for (const key in config_armObj.connet_oil.roi[0]) { // for (const key in config_armObj.connet_oil.roi[0]) {
// delete config_armObj.connet_oil.roi[0][key]; // delete config_armObj.connet_oil.roi[0][key];
// } // }
@ -910,10 +913,10 @@ ${newstr}class-id=0
// arr2.push(Number(99)); // arr2.push(Number(99));
// }); // });
// config_armObj.connet_grounder.roi[0][key2] = [arr2]; // config_armObj.connet_grounder.roi[0][key2] = [arr2];
config2 = yaml.dump(config_armObj); // let yyy = JSON.parse(JSON.stringify(config_armObj, null, 2))
config2 = yaml.dump(config_armObj, { lineWidth: -1, indent: 3, noArrayIndent: true });
console.log(555, config_armObj); // config2 =JSON.parse(JSON.stringify(YAML.stringify(config_armObj)) )
console.log(6666, yaml.dump(config_armObj)); console.log(888, config2)
} else { } else {
//使用模板 //使用模板
config2 = `# The all in one config file. config2 = `# The all in one config file.
@ -1217,6 +1220,22 @@ ${newstr}class-id=0
sessionStorage.setItem('config3', config3); sessionStorage.setItem('config3', config3);
sessionStorage.setItem('config4', config4); sessionStorage.setItem('config4', config4);
} }
// 读取文本文件内容
async readFile(file) {
const reader = new FileReader()
const promise = new Promise((resolve, reject) => {
reader.onload = function () {
resolve(reader.result)
}
reader.onerror = function (e) {
reader.abort()
reject(e)
}
})
reader.readAsText(file, 'UTF-8') // 将文件读取为文本
return promise
}
//黄海配置文件 //黄海配置文件
config() { config() {

148
src/assets/file/config_arm.yaml

@ -0,0 +1,148 @@
# The all in one config file.
debug: false #when the debug is on, osd.
video_record: 10 #time to record into the .ts video
sources:
config: 'config/source.yaml'
tracker:
config: 'config/dstest_tracker_config.txt'
analytics:
config: 'config/config_nvdsanalytics.txt'
## 通用模型 ##
# 1:人物检测
peoplenet:
enable: true
apply_on: -1
interval: 1
batch_size: 16
topk: 5
roi-top-offset: 0
roi-bottom-offset: 0
detected-min-w: 20
detected-min-h: 200
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/peoplenet/weights/resnet34_peoplenet_int8.etlt_b16_gpu0_int8.engine'
threshold: 0.3
# 2:车辆检测
trafficcam:
enable: true
apply_on: 0
interval: 1
batch_size: 16
topk: 5
roi-top-offset: 0
roi-bottom-offset: 0
detected-min-w: 100
detected-min-h: 100
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/trafficcam/weights/resnet18_trafficcamnet_pruned.etlt_b16_gpu0_int8.engine'
# 3:人物倚靠行为
actionnet:
enable: false
apply_on: 1
# roi:
# - 'fuel_island-4':
# - [200, 0, 450, 500]
# - 'fuel_island-5':
# - [930, 93, 940, 987]
# - 'fuel_island-6':
# - [1174, 151, 746, 929]
# - 'fuel_island-7':
# - [1450, 300, 460, 650]
interval: 1
batch_size: 32
# 4:烟火检测
fire_smoke_net:
enable: true
apply_on: -1
interval: 1
batch_size: 16
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/fire_smoke_net/weights/yolov4_cspdarknet_tiny_fp16.etlt_b16_gpu0_fp16.engine'
threshold: 0.95
# 5:抽烟打电话检测
smoking_calling_net:
enable: true
apply_on: -1
interval: 1
batch_size: 2
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/smoking_calling_net/weights/resnet50_smoking_calling_net_fp16.etlt_b2_gpu0_fp16.engine'
## 油站专用模型 ##
# 1:身份判别:工装、反光衣、便衣
idnet:
enable: true
apply_on: -1
interval: 1
batch_size: 2
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/idnet/weights/resnet50_idnet_fp16.etlt_b2_gpu0_fp16.engine'
# 2:卸油区物体识别:油罐车、灭火器、手推车、三角木、取样桶、隔离锥、卸油管
oilnet:
enable: false
apply_on: 2
interval: 1
batch_size: 2
roi-top-offset: 0
roi-bottom-offset: 0
detected-min-w: 20
detected-min-h: 20
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/oilnet/weights/yolov4_cspdarknet_tiny_fp16.etlt_b2_gpu0_fp16.engine'
threshold: 0.5
# 3:卸油管是否连接判定
connet_oil:
enable: true
apply_on: 2
roi:
- 'oil_tube-0':
# - [719,509,136,206]
- [719,509,436,286]
interval: 1
batch_size: 2
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/connet_oil/weights/resnet50_connet_oil_fp16.etlt_b2_gpu0_fp16.engine'
# 4:静电接地仪器是否连接判定
connet_grounder:
enable: true
apply_on: 2
roi:
- 'grounder-0':
- [782,378,271,149]
interval: 1
batch_size: 2
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/connet_grounder/weights/resnet50_connet_grounder_fp16.etlt_b2_gpu0_fp16.engine'
# 5:散装桶加油
bulk_oil_net:
enable: False
apply_on: 2
interval: 1
batch_size: 2
model_engine_file: '/opt/nvidia/deepstream/deepstream-6.0/sources/project/models/bulk_oil_net/weights/yolov4_cspdarknet_tiny_fp16.etlt_b2_gpu0_fp16.engine'
threshold: 0.2
# 模型阈值通用设定
rule_threshold:
object_occurence_interval_second: 3
object_disappear_interval_second: 10
on_car_parking_interval_second: 1800
on_fire_smoke_interval_second: 5
on_helmet_interval_second: 5
threshold_relying_sitting: 0.4 #rolling mean confidence
threshold_smoking_calling: 0.3 #rolling mean confidence
threshold_connecting: 0.667 #rolling mean confidence
threshold_identity: 0.1 #only to filter out people net error
threshold_helmet: 0 #num of helmet detected on a person
enable_seconday_model: False # secondary model (双模型)
threshold_secondary_model: 0.5
secondary_model_window: 50
secondary_model_path: '/opt/app/xgboost'
Loading…
Cancel
Save