Compare commits
1 commit
develop
...
feature/pe
Author | SHA1 | Date | |
---|---|---|---|
|
19fd87df5b |
8 changed files with 28 additions and 22 deletions
|
@ -49,7 +49,7 @@ func resetAction(ctx *cli.Context) error {
|
||||||
tables.Drop()
|
tables.Drop()
|
||||||
|
|
||||||
log.Infoln("restoring default schema")
|
log.Infoln("restoring default schema")
|
||||||
entity.MigrateDb()
|
entity.MigrateDb(true)
|
||||||
|
|
||||||
if conf.AdminPassword() != "" {
|
if conf.AdminPassword() != "" {
|
||||||
log.Infoln("restoring initial admin password")
|
log.Infoln("restoring initial admin password")
|
||||||
|
|
|
@ -236,7 +236,7 @@ func (c *Config) SetDbOptions() {
|
||||||
func (c *Config) InitDb() {
|
func (c *Config) InitDb() {
|
||||||
c.SetDbOptions()
|
c.SetDbOptions()
|
||||||
entity.SetDbProvider(c)
|
entity.SetDbProvider(c)
|
||||||
entity.MigrateDb()
|
entity.MigrateDb(c.Experimental())
|
||||||
|
|
||||||
entity.Admin.InitPassword(c.AdminPassword())
|
entity.Admin.InitPassword(c.AdminPassword())
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ var DeprecatedTables = Deprecated{
|
||||||
"subjects_dev7",
|
"subjects_dev7",
|
||||||
"subjects_dev8",
|
"subjects_dev8",
|
||||||
"subjects_dev9",
|
"subjects_dev9",
|
||||||
|
"subjects_dev10",
|
||||||
"markers_dev1",
|
"markers_dev1",
|
||||||
"markers_dev2",
|
"markers_dev2",
|
||||||
"markers_dev3",
|
"markers_dev3",
|
||||||
|
@ -32,6 +33,7 @@ var DeprecatedTables = Deprecated{
|
||||||
"markers_dev7",
|
"markers_dev7",
|
||||||
"markers_dev8",
|
"markers_dev8",
|
||||||
"markers_dev9",
|
"markers_dev9",
|
||||||
|
"markers_dev10",
|
||||||
"faces_dev1",
|
"faces_dev1",
|
||||||
"faces_dev2",
|
"faces_dev2",
|
||||||
"faces_dev3",
|
"faces_dev3",
|
||||||
|
@ -41,4 +43,5 @@ var DeprecatedTables = Deprecated{
|
||||||
"faces_dev7",
|
"faces_dev7",
|
||||||
"faces_dev8",
|
"faces_dev8",
|
||||||
"faces_dev9",
|
"faces_dev9",
|
||||||
|
"faces_dev10",
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ func (list Types) Drop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateDefaultFixtures creates default database entries for test and production.
|
// CreateDefaultFixtures inserts default fixtures for test and production.
|
||||||
func CreateDefaultFixtures() {
|
func CreateDefaultFixtures() {
|
||||||
CreateUnknownAddress()
|
CreateUnknownAddress()
|
||||||
CreateDefaultUsers()
|
CreateDefaultUsers()
|
||||||
|
@ -133,16 +133,19 @@ func CreateDefaultFixtures() {
|
||||||
CreateUnknownLens()
|
CreateUnknownLens()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MigrateDb creates all tables and inserts default entities as needed.
|
// MigrateDb creates database tables and inserts default fixtures as needed.
|
||||||
func MigrateDb() {
|
func MigrateDb(dropDeprecated bool) {
|
||||||
DeprecatedTables.Drop()
|
if dropDeprecated {
|
||||||
|
DeprecatedTables.Drop()
|
||||||
|
}
|
||||||
|
|
||||||
Entities.Migrate()
|
Entities.Migrate()
|
||||||
Entities.WaitForMigration()
|
Entities.WaitForMigration()
|
||||||
|
|
||||||
CreateDefaultFixtures()
|
CreateDefaultFixtures()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetTestFixtures drops database tables for all known entities and re-creates them with fixtures.
|
// ResetTestFixtures re-creates registered database tables and inserts test fixtures.
|
||||||
func ResetTestFixtures() {
|
func ResetTestFixtures() {
|
||||||
Entities.Migrate()
|
Entities.Migrate()
|
||||||
Entities.WaitForMigration()
|
Entities.WaitForMigration()
|
||||||
|
|
|
@ -23,7 +23,7 @@ type Face struct {
|
||||||
ID string `gorm:"type:VARBINARY(42);primary_key;auto_increment:false;" json:"ID" yaml:"ID"`
|
ID string `gorm:"type:VARBINARY(42);primary_key;auto_increment:false;" json:"ID" yaml:"ID"`
|
||||||
FaceSrc string `gorm:"type:VARBINARY(8);" json:"Src" yaml:"Src,omitempty"`
|
FaceSrc string `gorm:"type:VARBINARY(8);" json:"Src" yaml:"Src,omitempty"`
|
||||||
FaceHidden bool `json:"Hidden" yaml:"Hidden,omitempty"`
|
FaceHidden bool `json:"Hidden" yaml:"Hidden,omitempty"`
|
||||||
SubjUID string `gorm:"type:VARBINARY(42);index;" json:"SubjUID" yaml:"SubjUID,omitempty"`
|
SubjUID string `gorm:"type:VARBINARY(42);index;default:'';" json:"SubjUID" yaml:"SubjUID,omitempty"`
|
||||||
Samples int `json:"Samples" yaml:"Samples,omitempty"`
|
Samples int `json:"Samples" yaml:"Samples,omitempty"`
|
||||||
SampleRadius float64 `json:"SampleRadius" yaml:"SampleRadius,omitempty"`
|
SampleRadius float64 `json:"SampleRadius" yaml:"SampleRadius,omitempty"`
|
||||||
Collisions int `json:"Collisions" yaml:"Collisions,omitempty"`
|
Collisions int `json:"Collisions" yaml:"Collisions,omitempty"`
|
||||||
|
@ -40,7 +40,7 @@ var Faceless = []string{""}
|
||||||
|
|
||||||
// TableName returns the entity database table name.
|
// TableName returns the entity database table name.
|
||||||
func (Face) TableName() string {
|
func (Face) TableName() string {
|
||||||
return "faces_dev10"
|
return "faces"
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFace returns a new face.
|
// NewFace returns a new face.
|
||||||
|
|
|
@ -26,7 +26,7 @@ const (
|
||||||
// Marker represents an image marker point.
|
// Marker represents an image marker point.
|
||||||
type Marker struct {
|
type Marker struct {
|
||||||
MarkerUID string `gorm:"type:VARBINARY(42);primary_key;auto_increment:false;" json:"UID" yaml:"UID"`
|
MarkerUID string `gorm:"type:VARBINARY(42);primary_key;auto_increment:false;" json:"UID" yaml:"UID"`
|
||||||
FileUID string `gorm:"type:VARBINARY(42);index;" json:"FileUID" yaml:"FileUID"`
|
FileUID string `gorm:"type:VARBINARY(42);index;default:'';" json:"FileUID" yaml:"FileUID"`
|
||||||
MarkerType string `gorm:"type:VARBINARY(8);default:'';" json:"Type" yaml:"Type"`
|
MarkerType string `gorm:"type:VARBINARY(8);default:'';" json:"Type" yaml:"Type"`
|
||||||
MarkerSrc string `gorm:"type:VARBINARY(8);default:'';" json:"Src" yaml:"Src,omitempty"`
|
MarkerSrc string `gorm:"type:VARBINARY(8);default:'';" json:"Src" yaml:"Src,omitempty"`
|
||||||
MarkerName string `gorm:"type:VARCHAR(255);" json:"Name" yaml:"Name,omitempty"`
|
MarkerName string `gorm:"type:VARCHAR(255);" json:"Name" yaml:"Name,omitempty"`
|
||||||
|
@ -36,7 +36,7 @@ type Marker struct {
|
||||||
SubjSrc string `gorm:"type:VARBINARY(8);index:idx_markers_subj_uid_src;default:'';" json:"SubjSrc" yaml:"SubjSrc,omitempty"`
|
SubjSrc string `gorm:"type:VARBINARY(8);index:idx_markers_subj_uid_src;default:'';" json:"SubjSrc" yaml:"SubjSrc,omitempty"`
|
||||||
subject *Subject `gorm:"foreignkey:SubjUID;association_foreignkey:SubjUID;association_autoupdate:false;association_autocreate:false;association_save_reference:false"`
|
subject *Subject `gorm:"foreignkey:SubjUID;association_foreignkey:SubjUID;association_autoupdate:false;association_autocreate:false;association_save_reference:false"`
|
||||||
FaceID string `gorm:"type:VARBINARY(42);index;" json:"FaceID" yaml:"FaceID,omitempty"`
|
FaceID string `gorm:"type:VARBINARY(42);index;" json:"FaceID" yaml:"FaceID,omitempty"`
|
||||||
FaceDist float64 `gorm:"default:-1" json:"FaceDist" yaml:"FaceDist,omitempty"`
|
FaceDist float64 `gorm:"default:-1;" json:"FaceDist" yaml:"FaceDist,omitempty"`
|
||||||
face *Face `gorm:"foreignkey:FaceID;association_foreignkey:ID;association_autoupdate:false;association_autocreate:false;association_save_reference:false"`
|
face *Face `gorm:"foreignkey:FaceID;association_foreignkey:ID;association_autoupdate:false;association_autocreate:false;association_save_reference:false"`
|
||||||
EmbeddingsJSON json.RawMessage `gorm:"type:MEDIUMBLOB;" json:"-" yaml:"EmbeddingsJSON,omitempty"`
|
EmbeddingsJSON json.RawMessage `gorm:"type:MEDIUMBLOB;" json:"-" yaml:"EmbeddingsJSON,omitempty"`
|
||||||
embeddings Embeddings `gorm:"-"`
|
embeddings Embeddings `gorm:"-"`
|
||||||
|
@ -46,9 +46,9 @@ type Marker struct {
|
||||||
W float32 `gorm:"type:FLOAT;" json:"W" yaml:"W,omitempty"`
|
W float32 `gorm:"type:FLOAT;" json:"W" yaml:"W,omitempty"`
|
||||||
H float32 `gorm:"type:FLOAT;" json:"H" yaml:"H,omitempty"`
|
H float32 `gorm:"type:FLOAT;" json:"H" yaml:"H,omitempty"`
|
||||||
Q int `json:"Q" yaml:"Q,omitempty"`
|
Q int `json:"Q" yaml:"Q,omitempty"`
|
||||||
Size int `gorm:"default:-1" json:"Size" yaml:"Size,omitempty"`
|
Size int `gorm:"default:-1;" json:"Size" yaml:"Size,omitempty"`
|
||||||
Score int `gorm:"type:SMALLINT" json:"Score" yaml:"Score,omitempty"`
|
Score int `gorm:"type:SMALLINT;" json:"Score" yaml:"Score,omitempty"`
|
||||||
Thumb string `gorm:"type:VARBINARY(128);index" json:"Thumb" yaml:"Thumb,omitempty"`
|
Thumb string `gorm:"type:VARBINARY(128);index;default:'';" json:"Thumb" yaml:"Thumb,omitempty"`
|
||||||
MatchedAt *time.Time `sql:"index" json:"MatchedAt" yaml:"MatchedAt,omitempty"`
|
MatchedAt *time.Time `sql:"index" json:"MatchedAt" yaml:"MatchedAt,omitempty"`
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
|
@ -56,7 +56,7 @@ type Marker struct {
|
||||||
|
|
||||||
// TableName returns the entity database table name.
|
// TableName returns the entity database table name.
|
||||||
func (Marker) TableName() string {
|
func (Marker) TableName() string {
|
||||||
return "markers_dev10"
|
return "markers"
|
||||||
}
|
}
|
||||||
|
|
||||||
// BeforeCreate creates a random UID if needed before inserting a new row to the database.
|
// BeforeCreate creates a random UID if needed before inserting a new row to the database.
|
||||||
|
|
|
@ -21,11 +21,11 @@ type Subjects []Subject
|
||||||
// Subject represents a named photo subject, typically a person.
|
// Subject represents a named photo subject, typically a person.
|
||||||
type Subject struct {
|
type Subject struct {
|
||||||
SubjUID string `gorm:"type:VARBINARY(42);primary_key;auto_increment:false;" json:"UID" yaml:"UID"`
|
SubjUID string `gorm:"type:VARBINARY(42);primary_key;auto_increment:false;" json:"UID" yaml:"UID"`
|
||||||
SubjType string `gorm:"type:VARBINARY(8);default:''" json:"Type,omitempty" yaml:"Type,omitempty"`
|
SubjType string `gorm:"type:VARBINARY(8);default:'';" json:"Type,omitempty" yaml:"Type,omitempty"`
|
||||||
SubjSrc string `gorm:"type:VARBINARY(8);default:''" json:"Src,omitempty" yaml:"Src,omitempty"`
|
SubjSrc string `gorm:"type:VARBINARY(8);default:'';" json:"Src,omitempty" yaml:"Src,omitempty"`
|
||||||
SubjSlug string `gorm:"type:VARBINARY(255);index;default:''" json:"Slug" yaml:"-"`
|
SubjSlug string `gorm:"type:VARBINARY(255);index;default:'';" json:"Slug" yaml:"-"`
|
||||||
SubjName string `gorm:"type:VARCHAR(255);unique_index;default:''" json:"Name" yaml:"Name"`
|
SubjName string `gorm:"type:VARCHAR(255);unique_index;default:'';" json:"Name" yaml:"Name"`
|
||||||
SubjAlias string `gorm:"type:VARCHAR(255);default:''" json:"Alias" yaml:"Alias"`
|
SubjAlias string `gorm:"type:VARCHAR(255);default:'';" json:"Alias" yaml:"Alias"`
|
||||||
SubjBio string `gorm:"type:TEXT;" json:"Bio" yaml:"Bio,omitempty"`
|
SubjBio string `gorm:"type:TEXT;" json:"Bio" yaml:"Bio,omitempty"`
|
||||||
SubjNotes string `gorm:"type:TEXT;" json:"Notes,omitempty" yaml:"Notes,omitempty"`
|
SubjNotes string `gorm:"type:TEXT;" json:"Notes,omitempty" yaml:"Notes,omitempty"`
|
||||||
SubjFavorite bool `gorm:"default:false" json:"Favorite" yaml:"Favorite,omitempty"`
|
SubjFavorite bool `gorm:"default:false" json:"Favorite" yaml:"Favorite,omitempty"`
|
||||||
|
@ -42,7 +42,7 @@ type Subject struct {
|
||||||
|
|
||||||
// TableName returns the entity database table name.
|
// TableName returns the entity database table name.
|
||||||
func (Subject) TableName() string {
|
func (Subject) TableName() string {
|
||||||
return "subjects_dev10"
|
return "subjects"
|
||||||
}
|
}
|
||||||
|
|
||||||
// BeforeCreate creates a random UID if needed before inserting a new row to the database.
|
// BeforeCreate creates a random UID if needed before inserting a new row to the database.
|
||||||
|
|
|
@ -8,7 +8,7 @@ var CropSize = crop.Sizes[crop.Tile160]
|
||||||
var ClusterCore = 4
|
var ClusterCore = 4
|
||||||
var ClusterMinScore = 15
|
var ClusterMinScore = 15
|
||||||
var ClusterMinSize = 95
|
var ClusterMinSize = 95
|
||||||
var ClusterRadius = 0.58
|
var ClusterRadius = 0.69
|
||||||
var MatchRadius = 0.46
|
var MatchRadius = 0.46
|
||||||
var SampleThreshold = 2 * ClusterCore
|
var SampleThreshold = 2 * ClusterCore
|
||||||
var OverlapThreshold = 42
|
var OverlapThreshold = 42
|
||||||
|
|
Loading…
Reference in a new issue