mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
This parameter allows us to rescale the input of the models because some of them need values between [0, 1] and other between [-1, 1].
96 lines
2.2 KiB
Go
96 lines
2.2 KiB
Go
package vision
|
|
|
|
import (
|
|
"github.com/photoprism/photoprism/internal/ai/tensorflow"
|
|
"github.com/photoprism/photoprism/pkg/media/http/scheme"
|
|
)
|
|
|
|
// Default computer vision model configuration.
|
|
var (
|
|
NasnetModel = &Model{
|
|
Type: ModelTypeLabels,
|
|
Name: "NASNet",
|
|
Version: "Mobile",
|
|
Resolution: 224,
|
|
Meta: &tensorflow.ModelInfo{
|
|
TFVersion: "1.12.0",
|
|
Tags: []string{"photoprism"},
|
|
Input: &tensorflow.PhotoInput{
|
|
Name: "input_1",
|
|
Height: 224,
|
|
Width: 224,
|
|
Interval: &tensorflow.Interval{
|
|
Start: -1.0,
|
|
End: 1.0,
|
|
},
|
|
Channels: 3,
|
|
OutputIndex: 0,
|
|
},
|
|
Output: &tensorflow.ModelOutput{
|
|
Name: "predictions/Softmax",
|
|
NumOutputs: 1000,
|
|
OutputIndex: 0,
|
|
OutputsLogits: false,
|
|
},
|
|
},
|
|
}
|
|
NsfwModel = &Model{
|
|
Type: ModelTypeNsfw,
|
|
Name: "Nsfw",
|
|
Version: "",
|
|
Resolution: 224,
|
|
Meta: &tensorflow.ModelInfo{
|
|
TFVersion: "1.12.0",
|
|
Tags: []string{"serve"},
|
|
Input: &tensorflow.PhotoInput{
|
|
Name: "input_tensor",
|
|
Height: 224,
|
|
Width: 224,
|
|
Channels: 3,
|
|
OutputIndex: 0,
|
|
},
|
|
Output: &tensorflow.ModelOutput{
|
|
Name: "nsfw_cls_model/final_prediction",
|
|
NumOutputs: 5,
|
|
OutputIndex: 0,
|
|
OutputsLogits: false,
|
|
},
|
|
},
|
|
}
|
|
FacenetModel = &Model{
|
|
Type: ModelTypeFace,
|
|
Name: "FaceNet",
|
|
Version: "",
|
|
Resolution: 160,
|
|
Meta: &tensorflow.ModelInfo{
|
|
TFVersion: "1.7.1",
|
|
Tags: []string{"serve"},
|
|
Input: &tensorflow.PhotoInput{
|
|
Name: "input",
|
|
Height: 160,
|
|
Width: 160,
|
|
Channels: 3,
|
|
OutputIndex: 0,
|
|
},
|
|
Output: &tensorflow.ModelOutput{
|
|
Name: "embeddings",
|
|
NumOutputs: 512,
|
|
OutputIndex: 0,
|
|
OutputsLogits: false,
|
|
},
|
|
},
|
|
}
|
|
CaptionModel = &Model{
|
|
Type: ModelTypeCaption,
|
|
Resolution: 224,
|
|
Service: Service{
|
|
Uri: "http://photoprism-vision:5000/api/v1/vision/caption",
|
|
FileScheme: scheme.Https,
|
|
RequestFormat: ApiFormatUrl,
|
|
ResponseFormat: ApiFormatVision,
|
|
},
|
|
}
|
|
DefaultModels = Models{NasnetModel, NsfwModel, FacenetModel, CaptionModel}
|
|
DefaultThresholds = Thresholds{Confidence: 10}
|
|
)
|