init: tianyan-edge edge agent with Ascend NPU inference backend
- Go main process: stream ingestor, infer client, event uploader, heartbeat, config agent, OTA agent - Python inference server rewritten to use CANN ACL (acl module) replacing ultralytics/PyTorch; supports YOLOv8 raw and YOLOv10 NMS-free output formats via OUTPUT_FORMAT env var - systemd services for edge-agent and edge-infer - build/install/package scripts targeting arm64 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
45
internal/config/config.go
Normal file
45
internal/config/config.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
EdgeID string `yaml:"edge_id"`
|
||||
CloudURL string `yaml:"cloud_url"`
|
||||
EdgeToken string `yaml:"edge_token"`
|
||||
RTSPURLs []string `yaml:"rtsp_urls"`
|
||||
InferSocket string `yaml:"infer_socket"`
|
||||
InferFPS int `yaml:"infer_fps"`
|
||||
InferWorkers int `yaml:"infer_workers"`
|
||||
ConfThreshold float64 `yaml:"conf_threshold"`
|
||||
DedupWindowSec int `yaml:"dedup_window_sec"`
|
||||
Version string `yaml:"version"`
|
||||
}
|
||||
|
||||
func Load(path string) *Config {
|
||||
cfg := &Config{
|
||||
EdgeID: "edge-demo-001",
|
||||
CloudURL: "http://localhost:8004",
|
||||
InferSocket: "/tmp/edge-infer.sock",
|
||||
InferFPS: 5,
|
||||
InferWorkers: 2,
|
||||
ConfThreshold: 0.5,
|
||||
DedupWindowSec: 30,
|
||||
Version: "1.0.0",
|
||||
}
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return cfg
|
||||
}
|
||||
_ = yaml.Unmarshal(data, cfg)
|
||||
if cfg.InferWorkers <= 0 {
|
||||
cfg.InferWorkers = 1
|
||||
}
|
||||
if cfg.DedupWindowSec <= 0 {
|
||||
cfg.DedupWindowSec = 30
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
Reference in New Issue
Block a user