zhangmeng
2019-12-20 94a88b93081043439b20db4adf33721b1e0d6f07
support hotupdate
23个文件已删除
4个文件已修改
2610 ■■■■■ 已修改文件
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.mod 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.go 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modulemake.sh 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modulepull.sh 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modulepush.sh 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proc/gpu.go 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proc/master.go 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proc/proc.go 202 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proc/reaper.go 195 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proc/sdk.go 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
proc/single.go 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sdkconfig.yaml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/cache/cache.go 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/common.go 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/ipcreciever.go 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/ipcsender.go 170 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/facetrack.go 247 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/fdetect.go 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/fextract.go 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/flow.go 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/humantrack.go 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/interface.go 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/plugin.go 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/vdetect.go 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/ydetect.go 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/torule.go 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -7,3 +7,4 @@
*.jpg
data/
runtime/
libs/
go.mod
@@ -3,33 +3,10 @@
go 1.12
require (
    basic.com/dbapi.git v0.0.0-20190803074805-04f05c8ca762
    basic.com/libgowrapper/sdkstruct.git v0.0.0-20191211011351-89daaec8738e
    basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48
    basic.com/pubsub/protomsg.git v0.0.0-20191213031824-8f12ebe28c26
    basic.com/ruleForSdk.git v0.0.0-20190808095604-936797ef5da3
    basic.com/valib/deliver.git v0.0.0-20190830083657-47adbbbb6651
    basic.com/valib/godraw.git v0.0.0-20191122082247-26e9987cd183
    basic.com/libgowrapper/sdkstruct.git v0.0.0-20191220011601-e0b3d1f0183c
    basic.com/valib/gogpu.git v0.0.0-20190711044327-62043b070865
    basic.com/valib/gopherdiscovery.git v0.0.0-20190605034340-15d89d8b4e28
    basic.com/valib/gosdk.git v0.0.0-20191127014622-8e01cb7623bf
    basic.com/valib/shm.git v0.0.0-20190829074754-ad2e00879627 // indirect
    github.com/ajg/form v1.5.1 // indirect
    github.com/amoghe/distillog v0.0.0-20180726233512-ae382b35b717
    github.com/disintegration/imaging v1.6.2
    github.com/fatih/color v1.7.0 // indirect
    github.com/gogo/protobuf v1.2.1
    github.com/golang/snappy v0.0.1
    github.com/knetic/govaluate v3.0.0+incompatible // indirect
    github.com/llgcode/draw2d v0.0.0-20190810100245-79e59b6b8fbc // indirect
    github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e // indirect
    github.com/mattn/go-colorable v0.1.2 // indirect
    github.com/natefinch/lumberjack v2.0.0+incompatible
    github.com/phachon/go-logger v0.0.0-20180912060440-89ff8a2898f6
    github.com/pierrec/lz4 v2.0.5+incompatible
    github.com/spf13/viper v1.4.0
    github.com/yireyun/go-queue v0.0.0-20180809062148-5e6897360dac
    golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect
    golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed
    nanomsg.org/go-mangos v1.4.0 // indirect
    github.com/spf13/viper v1.6.1
    golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
)
main.go
@@ -2,17 +2,16 @@
import (
    "analysis/logo"
    "analysis/proc"
    "analysis/util"
    "strconv"
    "analysis/app/master"
    "analysis/app/slave"
    "context"
    "flag"
    "os"
    "os/signal"
    "golang.org/x/sys/unix"
    "basic.com/valib/gogpu.git"
    // "net/http"
@@ -27,41 +26,26 @@
    gpu     int
    shm     bool
    ruleIPC string
    soFile  string
    configPath string
)
const (
    master = `master`
    slave  = `slave`
    single = `single`
    roleMaster = `master`
    roleSlave  = `slave`
)
func init() {
    flag.BoolVar(&logit, "logit", false, "use logger,default flase")
    flag.StringVar(&role, "role", single, "run process role master/slave/single, default single")
    flag.StringVar(&role, "role", roleMaster, "run process role master/slave, default single")
    flag.StringVar(&runType, "sdk", util.FeatAll, "run sdk type, face/facedetect/facecompare/yolo,etc.")
    flag.StringVar(&id, "id", util.FakeSdkID, "sdk id as ipc label")
    flag.IntVar(&gpu, "gpu", -1, "gpu index")
    flag.BoolVar(&shm, "shm", false, "use shm for performance")
    flag.StringVar(&soFile, "so-file", "./", "libcffmpeg.so path")
    flag.StringVar(&configPath, util.ConfigPath, "", "sdk config file path")
    // 人脸识别参数
    flag.IntVar(&util.SFI.DetectThrd, util.FaceDetectThread, util.SFI.DetectThrd, "face detect max thread count")
    flag.IntVar(&util.SFI.DetectNum, util.FaceDetectNum, util.SFI.DetectNum, "face detect min face count")
    flag.IntVar(&util.SFI.DetectAngle, util.FaceDetectAngle, util.SFI.DetectAngle, "face detect face angle")
    flag.IntVar(&util.SFI.PropThrd, util.FacePropertyThread, util.SFI.PropThrd, "face property max thread count")
    flag.IntVar(&util.SFI.ExtractThrd, util.FaceExtractThread, util.SFI.ExtractThrd, "face extract max thread count")
    flag.IntVar(&util.SFI.TrackInterval, util.FaceTrackInterval, util.SFI.TrackInterval, "face track needed interval")
    flag.IntVar(&util.SFI.SampleSize, util.FaceTrackSample, util.SFI.SampleSize, "face track sample size")
    flag.BoolVar(&logit, util.LogIt, false, "use logger,default flase")
    flag.BoolVar(&shm, util.SHM, false, "use shm for performance")
    // 车辆信息
    // 授权服务路径
    flag.StringVar(&util.SCI.LicenseServerPath, util.CarSDKLicense, util.SCI.LicenseServerPath, "car detect lic server bin path")
    flag.IntVar(&util.SCI.MaxImageWidth, util.CarMaxImageWidth, util.SCI.MaxImageWidth, "car detect image width")
    flag.IntVar(&util.SCI.MaxImageHeight, util.CarMaxImageHeight, util.SCI.MaxImageHeight, "car detect image height")
    // cloud plate
    flag.StringVar(&util.SCI.Model, util.CarSDKModel, util.SCI.Model, "cloud palte detector model")
    flag.IntVar(&gpu, util.GPU, -1, "gpu index")
    // 指定获取配置信息从sqlite,有最高优先级, master使用
    flag.StringVar(&util.FSI.IP, util.FetchSrvIP, util.FSI.IP, "fetch server ip, like camera info")
@@ -86,19 +70,6 @@
}
func setParamters() {
    util.FillParams(util.FaceDetectThread, strconv.Itoa(util.SFI.DetectThrd))
    util.FillParams(util.FaceDetectNum, strconv.Itoa(util.SFI.DetectNum))
    util.FillParams(util.FaceDetectAngle, strconv.Itoa(util.SFI.DetectAngle))
    util.FillParams(util.FacePropertyThread, strconv.Itoa(util.SFI.PropThrd))
    util.FillParams(util.FaceExtractThread, strconv.Itoa(util.SFI.ExtractThrd))
    util.FillParams(util.FaceTrackInterval, strconv.Itoa(util.SFI.TrackInterval))
    util.FillParams(util.FaceTrackSample, strconv.Itoa(util.SFI.SampleSize))
    util.FillParams(util.CarSDKLicense, util.SCI.LicenseServerPath)
    util.FillParams(util.CarSDKModel, util.SCI.Model)
    util.FillParams(util.CarMaxImageWidth, strconv.Itoa(util.SCI.MaxImageWidth))
    util.FillParams(util.CarMaxImageHeight, strconv.Itoa(util.SCI.MaxImageHeight))
    util.FillParams(util.FetchSrvIP, util.FSI.IP)
    util.FillParams(util.FetchSrvPort, strconv.Itoa(util.FSI.HTTPort))
    util.FillParams(util.FetchSrvHeartbeatPort, strconv.Itoa(util.FSI.HBPort))
@@ -106,23 +77,13 @@
    util.FillParams(util.RuleIPC, util.ToRuleIPC)
    util.SetParams("-so-file=" + soFile)
    util.SetParams("-gpu=" + strconv.Itoa(gpu))
    util.FillParams(util.GPU, strconv.Itoa(gpu))
    if logit {
        util.SetParams("-logit")
        util.FillParams(util.LogIt, "true")
    }
    if shm {
        util.SetParams("-shm")
        util.FillParams(util.SHM, "true")
    }
    // util.FillParams("gpu", strconv.Itoa(gpu))
    // if logit {
    //     util.FillParams("logit", "true")
    // }
    // if shm {
    //     util.FillParams("shm", "true")
    // }
}
func main() {
@@ -143,26 +104,42 @@
    runLogger()
    if configPath == "" || len(configPath) == 0 {
        logo.Infoln("!!!!!! SDK CONFIG PATH MUST EXIST !!!!!!")
        return
    }
    logo.Infoln(os.Args)
    ctx, cancel := context.WithCancel(context.Background())
    ret := false
    if role == single {
        ret = proc.SingleRole(ctx, runType, id, gpu, shm)
    } else if role == master {
    if role == roleMaster {
        setParamters()
        ret = proc.MasterRole(ctx)
    } else if role == slave {
        ret = proc.SingleRole(ctx, runType, id, gpu, shm)
        ret = master.Run(ctx, configPath)
    } else if role == roleSlave {
        ret = slave.Run(ctx, configPath, runType, id, gpu, shm)
    }
    if ret {
        c := make(chan os.Signal, 1)
        signal.Notify(c, os.Interrupt, os.Kill, unix.SIGTERM)
        <-c
        // c := make(chan os.Signal, 1)
        // signal.Notify(c, os.Interrupt, os.Kill, unix.SIGTERM)
        // <-c
        select {}
    }
    cancel()
    logo.Close()
}
// const (
//     configFilePath = "/opt/vasystem/config/"
//     configFileName = "sdkconfig"
//     configFileType = "yaml"
// )
// viper.SetConfigType(configFileType)
// viper.SetConfigName(configFileName)
// viper.AddConfigPath(configFilePath)
// viper.AddConfigPath("./")
// envString := ""
modulemake.sh
@@ -9,12 +9,12 @@
cur_dir=`pwd`
src=$cur_dir"/libgowrapper"
runtime_dir=$cur_dir"/runtime"
runtime_dir=$cur_dir"/libs"
# runtime_dir not exist, then create
if [ ! -d $runtime_dir ];then
    mkdir $runtime_dir 
    echo "~~~CREATE RUNTIME LIBRARY DIRECTORY"
    echo "~~~CREATE RUNTIME LIBRARY DIRECTORY $runtime_dir"
fi
cd $src
@@ -36,7 +36,7 @@
    fi
# move to runtime_dir
    cp -fr lib$value.so $runtime_dir
    mv -f lib$value.so $runtime_dir
# move sdk to runtime_dir
    if [ -d `pwd`/sdk/lib ]; then
        cp -fr `pwd`/sdk/lib/* $runtime_dir
modulepull.sh
File was deleted
modulepush.sh
File was deleted
proc/gpu.go
File was deleted
proc/master.go
File was deleted
proc/proc.go
File was deleted
proc/reaper.go
File was deleted
proc/sdk.go
File was deleted
proc/single.go
File was deleted
sdkconfig.yaml
File was deleted
work/cache/cache.go
File was deleted
work/common.go
File was deleted
work/ipcreciever.go
File was deleted
work/ipcsender.go
File was deleted
work/sdk/facetrack.go
File was deleted
work/sdk/fdetect.go
File was deleted
work/sdk/fextract.go
File was deleted
work/sdk/flow.go
File was deleted
work/sdk/humantrack.go
File was deleted
work/sdk/interface.go
File was deleted
work/sdk/plugin.go
File was deleted
work/sdk/vdetect.go
File was deleted
work/sdk/ydetect.go
File was deleted
work/torule.go
File was deleted