From 2480bf49eadff7a4cb023e1ca1a709cca8bed5a4 Mon Sep 17 00:00:00 2001
From: yuyuanshifu <747342561@qq.com>
Date: Tue, 16 Mar 2021 20:28:05 +0800
Subject: [PATCH 1/2] add benchmark category
---
models/cloudbrain.go | 9 +++++++++
modules/setting/setting.go | 2 ++
routers/repo/cloudbrain.go | 5 ++++-
templates/repo/cloudbrain/new.tmpl | 9 +++++++++
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/models/cloudbrain.go b/models/cloudbrain.go
index 9784a58b5..f053552db 100755
--- a/models/cloudbrain.go
+++ b/models/cloudbrain.go
@@ -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"`
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 65fddc7a0..9926c154e 100755
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -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)
diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go
index 30542e26e..c710f8c5b 100755
--- a/routers/repo/cloudbrain.go
+++ b/routers/repo/cloudbrain.go
@@ -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)
diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl
index ddbe087d3..28e33cec2 100755
--- a/templates/repo/cloudbrain/new.tmpl
+++ b/templates/repo/cloudbrain/new.tmpl
@@ -125,6 +125,15 @@
+
+
+
+
+