@@ -19,7 +19,7 @@ import (
|
||||
. "git.andr3h3nriqu3s.com/andr3/fyp/logic/utils"
|
||||
)
|
||||
|
||||
const EPOCH_PER_RUN = 20
|
||||
const EPOCH_PER_RUN = 1
|
||||
const MAX_EPOCH = 100
|
||||
|
||||
func MakeDefenition(db *sql.DB, model_id string, target_accuracy int) (id string, err error) {
|
||||
@@ -36,28 +36,6 @@ func MakeDefenition(db *sql.DB, model_id string, target_accuracy int) (id string
|
||||
return
|
||||
}
|
||||
|
||||
type ModelDefinitionStatus int
|
||||
|
||||
const (
|
||||
MODEL_DEFINITION_STATUS_CANCELD_TRAINING = -4
|
||||
MODEL_DEFINITION_STATUS_FAILED_TRAINING = -3
|
||||
MODEL_DEFINITION_STATUS_PRE_INIT ModelDefinitionStatus = 1
|
||||
MODEL_DEFINITION_STATUS_INIT = 2
|
||||
MODEL_DEFINITION_STATUS_TRAINING = 3
|
||||
MODEL_DEFINITION_STATUS_PAUSED_TRAINING = 6
|
||||
MODEL_DEFINITION_STATUS_TRANIED = 4
|
||||
MODEL_DEFINITION_STATUS_READY = 5
|
||||
)
|
||||
|
||||
type LayerType int
|
||||
|
||||
const (
|
||||
LAYER_INPUT LayerType = 1
|
||||
LAYER_DENSE = 2
|
||||
LAYER_FLATTEN = 3
|
||||
LAYER_SIMPLE_BLOCK = 4
|
||||
)
|
||||
|
||||
func ModelDefinitionUpdateStatus(c *Context, id string, status ModelDefinitionStatus) (err error) {
|
||||
_, err = c.Db.Exec("update model_definition set status = $1 where id = $2", status, id)
|
||||
return
|
||||
@@ -301,7 +279,10 @@ func trainModel(c *Context, model *BaseModel) {
|
||||
}
|
||||
def.epoch += EPOCH_PER_RUN
|
||||
accuracy = accuracy * 100
|
||||
def.acuracy = accuracy
|
||||
def.acuracy = float64(accuracy)
|
||||
|
||||
definitions[i].epoch += EPOCH_PER_RUN
|
||||
definitions[i].acuracy = accuracy
|
||||
|
||||
if accuracy >= float64(def.target_accuracy) {
|
||||
c.Logger.Info("Found a definition that reaches target_accuracy!")
|
||||
@@ -361,11 +342,11 @@ func trainModel(c *Context, model *BaseModel) {
|
||||
continue
|
||||
}
|
||||
|
||||
sort.Sort(definitions)
|
||||
sort.Reverse(definitions)
|
||||
|
||||
acc := definitions[0].acuracy - 20
|
||||
acc := definitions[0].acuracy - 20.0
|
||||
|
||||
c.Logger.Info("Training models, Highest acc", "acc", acc)
|
||||
c.Logger.Info("Training models, Highest acc", "acc", definitions[0].acuracy, "mod_acc", acc)
|
||||
|
||||
toRemove = []int{}
|
||||
for i, def := range definitions {
|
||||
|
||||
Reference in New Issue
Block a user