add image clarity detection

This commit is contained in:
2025-03-05 17:43:59 +08:00
parent c0d0d784d6
commit d8d98eb31c
22 changed files with 850 additions and 64 deletions

View File

@@ -60,6 +60,17 @@ message ModifyFaceTypeRequest {
message ModifyFaceTypeResponse {
string result = 1;
}
// 模糊图片搜索
message ImageClarityRequest {
bytes image = 1;
}
message ImageClarityResponse {
bool is_blurred = 1;
float confidence = 2;
}
service AiService {
// FaceRecognition
rpc FaceRecognition (FaceRecognitionRequest) returns (FaceRecognitionResponse);
@@ -73,6 +84,8 @@ service AiService {
rpc ModifyFaceName (ModifyFaceNameRequest) returns (ModifyFaceNameResponse);
// ModifyFaceType
rpc ModifyFaceType (ModifyFaceTypeRequest) returns (ModifyFaceTypeResponse);
// FuzzySearch
rpc ImageClarity (ImageClarityRequest) returns (ImageClarityResponse);
}

View File

@@ -19,6 +19,8 @@ type (
FaceLibrary = pb.FaceLibrary
FaceRecognitionRequest = pb.FaceRecognitionRequest
FaceRecognitionResponse = pb.FaceRecognitionResponse
ImageClarityRequest = pb.ImageClarityRequest
ImageClarityResponse = pb.ImageClarityResponse
ModifyFaceNameRequest = pb.ModifyFaceNameRequest
ModifyFaceNameResponse = pb.ModifyFaceNameResponse
ModifyFaceTypeRequest = pb.ModifyFaceTypeRequest
@@ -41,6 +43,8 @@ type (
ModifyFaceName(ctx context.Context, in *ModifyFaceNameRequest, opts ...grpc.CallOption) (*ModifyFaceNameResponse, error)
// ModifyFaceType
ModifyFaceType(ctx context.Context, in *ModifyFaceTypeRequest, opts ...grpc.CallOption) (*ModifyFaceTypeResponse, error)
// FuzzySearch
ImageClarity(ctx context.Context, in *ImageClarityRequest, opts ...grpc.CallOption) (*ImageClarityResponse, error)
}
defaultAiService struct {
@@ -89,3 +93,9 @@ func (m *defaultAiService) ModifyFaceType(ctx context.Context, in *ModifyFaceTyp
client := pb.NewAiServiceClient(m.cli.Conn())
return client.ModifyFaceType(ctx, in, opts...)
}
// FuzzySearch
func (m *defaultAiService) ImageClarity(ctx context.Context, in *ImageClarityRequest, opts ...grpc.CallOption) (*ImageClarityResponse, error) {
client := pb.NewAiServiceClient(m.cli.Conn())
return client.ImageClarity(ctx, in, opts...)
}

View File

@@ -0,0 +1,36 @@
package aiservicelogic
import (
"context"
"schisandra-album-cloud-microservices/app/aisvc/rpc/internal/svc"
"schisandra-album-cloud-microservices/app/aisvc/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type ImageClarityLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewImageClarityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ImageClarityLogic {
return &ImageClarityLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// ImageClarity 图像清晰度检测
func (l *ImageClarityLogic) ImageClarity(in *pb.ImageClarityRequest) (*pb.ImageClarityResponse, error) {
blurred, confidence, err := l.svcCtx.Clarity.Detect(in.Image)
if err != nil {
return nil, err
}
return &pb.ImageClarityResponse{
IsBlurred: blurred,
Confidence: float32(confidence),
}, nil
}

View File

@@ -58,3 +58,9 @@ func (s *AiServiceServer) ModifyFaceType(ctx context.Context, in *pb.ModifyFaceT
l := aiservicelogic.NewModifyFaceTypeLogic(ctx, s.svcCtx)
return l.ModifyFaceType(in)
}
// FuzzySearch
func (s *AiServiceServer) ImageClarity(ctx context.Context, in *pb.ImageClarityRequest) (*pb.ImageClarityResponse, error) {
l := aiservicelogic.NewImageClarityLogic(ctx, s.svcCtx)
return l.ImageClarity(in)
}

View File

@@ -9,6 +9,7 @@ import (
"schisandra-album-cloud-microservices/app/aisvc/model/mysql/query"
"schisandra-album-cloud-microservices/app/aisvc/rpc/internal/config"
"schisandra-album-cloud-microservices/common/caffe_classifier"
"schisandra-album-cloud-microservices/common/clarity"
"schisandra-album-cloud-microservices/common/face_recognizer"
"schisandra-album-cloud-microservices/common/miniox"
"schisandra-album-cloud-microservices/common/redisx"
@@ -25,6 +26,7 @@ type ServiceContext struct {
CaffeNet *gocv.Net
CaffeDesc []string
MinioClient *minio.Client
Clarity *clarity.Detector
}
func NewServiceContext(c config.Config) *ServiceContext {
@@ -42,5 +44,6 @@ func NewServiceContext(c config.Config) *ServiceContext {
CaffeNet: caffeClassifier,
CaffeDesc: caffeDesc,
MinioClient: miniox.NewMinio(c.Minio.Endpoint, c.Minio.AccessKeyID, c.Minio.SecretAccessKey, c.Minio.UseSSL),
Clarity: clarity.NewDetector(clarity.WithConcurrency(8), clarity.WithBaseThreshold(90), clarity.WithEdgeBoost(1.2), clarity.WithSampleScale(1)),
}
}

View File

@@ -699,6 +699,105 @@ func (x *ModifyFaceTypeResponse) GetResult() string {
return ""
}
// 模糊图片搜索
type ImageClarityRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
}
func (x *ImageClarityRequest) Reset() {
*x = ImageClarityRequest{}
mi := &file_aisvc_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ImageClarityRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImageClarityRequest) ProtoMessage() {}
func (x *ImageClarityRequest) ProtoReflect() protoreflect.Message {
mi := &file_aisvc_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImageClarityRequest.ProtoReflect.Descriptor instead.
func (*ImageClarityRequest) Descriptor() ([]byte, []int) {
return file_aisvc_proto_rawDescGZIP(), []int{13}
}
func (x *ImageClarityRequest) GetImage() []byte {
if x != nil {
return x.Image
}
return nil
}
type ImageClarityResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
IsBlurred bool `protobuf:"varint,1,opt,name=is_blurred,json=isBlurred,proto3" json:"is_blurred,omitempty"`
Confidence float32 `protobuf:"fixed32,2,opt,name=confidence,proto3" json:"confidence,omitempty"`
}
func (x *ImageClarityResponse) Reset() {
*x = ImageClarityResponse{}
mi := &file_aisvc_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ImageClarityResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImageClarityResponse) ProtoMessage() {}
func (x *ImageClarityResponse) ProtoReflect() protoreflect.Message {
mi := &file_aisvc_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImageClarityResponse.ProtoReflect.Descriptor instead.
func (*ImageClarityResponse) Descriptor() ([]byte, []int) {
return file_aisvc_proto_rawDescGZIP(), []int{14}
}
func (x *ImageClarityResponse) GetIsBlurred() bool {
if x != nil {
return x.IsBlurred
}
return false
}
func (x *ImageClarityResponse) GetConfidence() float32 {
if x != nil {
return x.Confidence
}
return 0
}
var File_aisvc_proto protoreflect.FileDescriptor
var file_aisvc_proto_rawDesc = []byte{
@@ -762,38 +861,50 @@ var file_aisvc_proto_rawDesc = []byte{
0x79, 0x70, 0x65, 0x22, 0x30, 0x0a, 0x16, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46, 0x61, 0x63,
0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xdf, 0x03, 0x0a, 0x09, 0x41, 0x69, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x46, 0x61, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x67,
0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x2e, 0x61, 0x69, 0x2e, 0x46, 0x61, 0x63, 0x65,
0x52, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x69, 0x2e, 0x46, 0x61, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f,
0x67, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x4d, 0x0a, 0x10, 0x54, 0x66, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x2e, 0x61, 0x69, 0x2e, 0x54, 0x66, 0x43, 0x6c, 0x61, 0x73, 0x73,
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1c, 0x2e, 0x61, 0x69, 0x2e, 0x54, 0x66, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56,
0x0a, 0x13, 0x43, 0x61, 0x66, 0x66, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x61, 0x69, 0x2e, 0x43, 0x61, 0x66, 0x66, 0x65,
0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x69, 0x2e, 0x43, 0x61, 0x66, 0x66, 0x65,
0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46,
0x61, 0x63, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x1b, 0x2e, 0x61, 0x69, 0x2e,
0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x69, 0x2e, 0x51, 0x75, 0x65,
0x72, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46,
0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x2e, 0x61, 0x69, 0x2e, 0x4d, 0x6f, 0x64,
0x69, 0x66, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x69, 0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46, 0x61,
0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47,
0x0a, 0x0e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x12, 0x19, 0x2e, 0x61, 0x69, 0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46, 0x61, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x69,
0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x2b, 0x0a, 0x13, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6c,
0x61, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05,
0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x69, 0x6d, 0x61,
0x67, 0x65, 0x22, 0x55, 0x0a, 0x14, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x72, 0x69,
0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73,
0x5f, 0x62, 0x6c, 0x75, 0x72, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
0x69, 0x73, 0x42, 0x6c, 0x75, 0x72, 0x72, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e,
0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x63,
0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x32, 0xa2, 0x04, 0x0a, 0x09, 0x41, 0x69,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x46, 0x61, 0x63, 0x65, 0x52,
0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x2e, 0x61, 0x69, 0x2e,
0x46, 0x61, 0x63, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x69, 0x2e, 0x46, 0x61, 0x63, 0x65,
0x52, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x54, 0x66, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x2e, 0x61, 0x69, 0x2e, 0x54, 0x66, 0x43,
0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x69, 0x2e, 0x54, 0x66, 0x43, 0x6c, 0x61, 0x73,
0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x56, 0x0a, 0x13, 0x43, 0x61, 0x66, 0x66, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73,
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x61, 0x69, 0x2e, 0x43,
0x61, 0x66, 0x66, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x69, 0x2e, 0x43,
0x61, 0x66, 0x66, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x51, 0x75,
0x65, 0x72, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x1b,
0x2e, 0x61, 0x69, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4c, 0x69, 0x62,
0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x69,
0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72,
0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0e, 0x4d, 0x6f, 0x64,
0x69, 0x66, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x2e, 0x61, 0x69,
0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x69, 0x2e, 0x4d, 0x6f, 0x64, 0x69,
0x66, 0x79, 0x46, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x47, 0x0a, 0x0e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46, 0x61, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x2e, 0x61, 0x69, 0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79,
0x46, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x1a, 0x2e, 0x61, 0x69, 0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x46, 0x61, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x49,
0x6d, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x12, 0x17, 0x2e, 0x61, 0x69,
0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x69, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x43,
0x6c, 0x61, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06,
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -808,7 +919,7 @@ func file_aisvc_proto_rawDescGZIP() []byte {
return file_aisvc_proto_rawDescData
}
var file_aisvc_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_aisvc_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_aisvc_proto_goTypes = []any{
(*FaceRecognitionRequest)(nil), // 0: ai.FaceRecognitionRequest
(*FaceRecognitionResponse)(nil), // 1: ai.FaceRecognitionResponse
@@ -823,6 +934,8 @@ var file_aisvc_proto_goTypes = []any{
(*ModifyFaceNameResponse)(nil), // 10: ai.ModifyFaceNameResponse
(*ModifyFaceTypeRequest)(nil), // 11: ai.ModifyFaceTypeRequest
(*ModifyFaceTypeResponse)(nil), // 12: ai.ModifyFaceTypeResponse
(*ImageClarityRequest)(nil), // 13: ai.ImageClarityRequest
(*ImageClarityResponse)(nil), // 14: ai.ImageClarityResponse
}
var file_aisvc_proto_depIdxs = []int32{
7, // 0: ai.QueryFaceLibraryResponse.faces:type_name -> ai.FaceLibrary
@@ -832,14 +945,16 @@ var file_aisvc_proto_depIdxs = []int32{
6, // 4: ai.AiService.QueryFaceLibrary:input_type -> ai.QueryFaceLibraryRequest
9, // 5: ai.AiService.ModifyFaceName:input_type -> ai.ModifyFaceNameRequest
11, // 6: ai.AiService.ModifyFaceType:input_type -> ai.ModifyFaceTypeRequest
1, // 7: ai.AiService.FaceRecognition:output_type -> ai.FaceRecognitionResponse
3, // 8: ai.AiService.TfClassification:output_type -> ai.TfClassificationResponse
5, // 9: ai.AiService.CaffeClassification:output_type -> ai.CaffeClassificationResponse
8, // 10: ai.AiService.QueryFaceLibrary:output_type -> ai.QueryFaceLibraryResponse
10, // 11: ai.AiService.ModifyFaceName:output_type -> ai.ModifyFaceNameResponse
12, // 12: ai.AiService.ModifyFaceType:output_type -> ai.ModifyFaceTypeResponse
7, // [7:13] is the sub-list for method output_type
1, // [1:7] is the sub-list for method input_type
13, // 7: ai.AiService.ImageClarity:input_type -> ai.ImageClarityRequest
1, // 8: ai.AiService.FaceRecognition:output_type -> ai.FaceRecognitionResponse
3, // 9: ai.AiService.TfClassification:output_type -> ai.TfClassificationResponse
5, // 10: ai.AiService.CaffeClassification:output_type -> ai.CaffeClassificationResponse
8, // 11: ai.AiService.QueryFaceLibrary:output_type -> ai.QueryFaceLibraryResponse
10, // 12: ai.AiService.ModifyFaceName:output_type -> ai.ModifyFaceNameResponse
12, // 13: ai.AiService.ModifyFaceType:output_type -> ai.ModifyFaceTypeResponse
14, // 14: ai.AiService.ImageClarity:output_type -> ai.ImageClarityResponse
8, // [8:15] is the sub-list for method output_type
1, // [1:8] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
@@ -856,7 +971,7 @@ func file_aisvc_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_aisvc_proto_rawDesc,
NumEnums: 0,
NumMessages: 13,
NumMessages: 15,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -25,6 +25,7 @@ const (
AiService_QueryFaceLibrary_FullMethodName = "/ai.AiService/QueryFaceLibrary"
AiService_ModifyFaceName_FullMethodName = "/ai.AiService/ModifyFaceName"
AiService_ModifyFaceType_FullMethodName = "/ai.AiService/ModifyFaceType"
AiService_ImageClarity_FullMethodName = "/ai.AiService/ImageClarity"
)
// AiServiceClient is the client API for AiService service.
@@ -43,6 +44,8 @@ type AiServiceClient interface {
ModifyFaceName(ctx context.Context, in *ModifyFaceNameRequest, opts ...grpc.CallOption) (*ModifyFaceNameResponse, error)
// ModifyFaceType
ModifyFaceType(ctx context.Context, in *ModifyFaceTypeRequest, opts ...grpc.CallOption) (*ModifyFaceTypeResponse, error)
// FuzzySearch
ImageClarity(ctx context.Context, in *ImageClarityRequest, opts ...grpc.CallOption) (*ImageClarityResponse, error)
}
type aiServiceClient struct {
@@ -113,6 +116,16 @@ func (c *aiServiceClient) ModifyFaceType(ctx context.Context, in *ModifyFaceType
return out, nil
}
func (c *aiServiceClient) ImageClarity(ctx context.Context, in *ImageClarityRequest, opts ...grpc.CallOption) (*ImageClarityResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ImageClarityResponse)
err := c.cc.Invoke(ctx, AiService_ImageClarity_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AiServiceServer is the server API for AiService service.
// All implementations must embed UnimplementedAiServiceServer
// for forward compatibility.
@@ -129,6 +142,8 @@ type AiServiceServer interface {
ModifyFaceName(context.Context, *ModifyFaceNameRequest) (*ModifyFaceNameResponse, error)
// ModifyFaceType
ModifyFaceType(context.Context, *ModifyFaceTypeRequest) (*ModifyFaceTypeResponse, error)
// FuzzySearch
ImageClarity(context.Context, *ImageClarityRequest) (*ImageClarityResponse, error)
mustEmbedUnimplementedAiServiceServer()
}
@@ -157,6 +172,9 @@ func (UnimplementedAiServiceServer) ModifyFaceName(context.Context, *ModifyFaceN
func (UnimplementedAiServiceServer) ModifyFaceType(context.Context, *ModifyFaceTypeRequest) (*ModifyFaceTypeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ModifyFaceType not implemented")
}
func (UnimplementedAiServiceServer) ImageClarity(context.Context, *ImageClarityRequest) (*ImageClarityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImageClarity not implemented")
}
func (UnimplementedAiServiceServer) mustEmbedUnimplementedAiServiceServer() {}
func (UnimplementedAiServiceServer) testEmbeddedByValue() {}
@@ -286,6 +304,24 @@ func _AiService_ModifyFaceType_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _AiService_ImageClarity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImageClarityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AiServiceServer).ImageClarity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AiService_ImageClarity_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AiServiceServer).ImageClarity(ctx, req.(*ImageClarityRequest))
}
return interceptor(ctx, in, info, handler)
}
// AiService_ServiceDesc is the grpc.ServiceDesc for AiService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -317,6 +353,10 @@ var AiService_ServiceDesc = grpc.ServiceDesc{
MethodName: "ModifyFaceType",
Handler: _AiService_ModifyFaceType_Handler,
},
{
MethodName: "ImageClarity",
Handler: _AiService_ImageClarity_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "aisvc.proto",