Browse Source

add benchmark category

tags/v0.1.8
yuyuanshifu 4 years ago
parent
commit
f8617b362d
4 changed files with 24 additions and 1 deletions
  1. +9
    -0
      models/cloudbrain.go
  2. +2
    -0
      modules/setting/setting.go
  3. +4
    -1
      routers/repo/cloudbrain.go
  4. +9
    -0
      templates/repo/cloudbrain/new.tmpl

+ 9
- 0
models/cloudbrain.go View File

@@ -265,6 +265,15 @@ type ImageInfo struct {
PlaceView string
}

type Categories struct {
Category []*Category `json:"category"`
}

type Category struct {
Id int `json:"id"`
Value string `json:"value"`
}

type CommitImageParams struct {
Ip string `json:"ip"`
TaskContainerId string `json:"taskContainerId"`


+ 2
- 0
modules/setting/setting.go View File

@@ -443,6 +443,7 @@ var (
IsBenchmarkEnabled bool
BenchmarkCode string
BenchmarkServerHost string
BenchmarkCategory string

//snn4imagenet config
IsSnn4imagenetEnabled bool
@@ -1150,6 +1151,7 @@ func NewContext() {
IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false)
BenchmarkCode = sec.Key("BENCHMARKCODE").MustString("https://yangzhx:justfortest123@git.openi.org.cn/yangzhx/detection_benchmark_script.git")
BenchmarkServerHost = sec.Key("HOST").MustString("http://192.168.202.90:3366/")
BenchmarkCategory = sec.Key("CATEGORY").MustString("")

sec = Cfg.Section("snn4imagenet")
IsSnn4imagenetEnabled = sec.Key("ENABLED").MustBool(false)


+ 4
- 1
routers/repo/cloudbrain.go View File

@@ -108,7 +108,6 @@ func CloudBrainNew(ctx *context.Context) {
}

for i, payload := range resultPublic.Payload.ImageInfo {
log.Info(resultPublic.Payload.ImageInfo[i].Place)
if strings.HasPrefix(resultPublic.Payload.ImageInfo[i].Place, "192.168") {
resultPublic.Payload.ImageInfo[i].PlaceView = payload.Place[strings.Index(payload.Place, "/"):len(payload.Place)]
} else {
@@ -131,6 +130,10 @@ func CloudBrainNew(ctx *context.Context) {
ctx.Data["model_path"] = cloudbrain.ModelMountPath
ctx.Data["benchmark_path"] = cloudbrain.BenchMarkMountPath
ctx.Data["is_benchmark_enabled"] = setting.IsBenchmarkEnabled

var categories *models.Categories
json.Unmarshal([]byte(setting.BenchmarkCategory), &categories)
ctx.Data["benchmark_categories"] = categories.Category
ctx.Data["snn4imagenet_path"] = cloudbrain.Snn4imagenetMountPath
ctx.Data["is_snn4imagenet_enabled"] = setting.IsSnn4imagenetEnabled
ctx.HTML(200, tplCloudBrainNew)


+ 9
- 0
templates/repo/cloudbrain/new.tmpl View File

@@ -125,6 +125,15 @@
</select>
</div>

<div class="inline required field cloudbrain_benchmark">
<label>数据集类别</label>
<select class="ui search dropdown" id="cloudbrain_benchmark_category" placeholder="选择数据集类别" style='width:385px' name="benchmark_category">
{{range .benchmark_categories}}
<option name="category" value="{{.Value}}">{{.Value}}</option>
{{end}}
</select>
</div>

<div class="inline required field">
<label>镜像</label>
<select class="ui search dropdown" id="cloudbrain_image" placeholder="选择镜像" style='width:385px' name="image">


Loading…
Cancel
Save