Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Status struct {
Code int `json:"code"`
Msg string `json:"msg"`
} `json:"status"`
Head struct {
Method string `json:"method"`
Version string `json:"version"`
Branch string `json:"branch"`
Commit string `json:"commit"`
Services []struct {
Mltype string `json:"mltype"`
Name string `json:"name"`
Description string `json:"description"`
Mllib string `json:"mllib"`
Predict bool `json:"predict"`
} `json:"services"`
} `json:"head"`
}
Info structure contain informations fetched by the GetInfo function
type PredictRequest ¶
type PredictRequest struct {
// General parameters
Service string `json:"service,omitempty"`
Data []string `json:"data,omitempty"`
Parameters struct {
Input struct {
// Image - image
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
CropWidth int `json:"crop_width,omitempty"`
CropHeight int `json:"crop_height,omitempty"`
BW bool `json:"bw,omitempty"`
MeanTF float64 `json:"mean,omitempty"`
Mean []int `json:"mean,omitempty"`
STD float64 `json:"std,omitempty"`
// CSV - csv
Ignore []string `json:"ignore,omitempty"`
Separator string `json:"separator,omitempty"`
ID string `json:"id,omitempty"`
Scale bool `json:"scale,omitempty"`
MinVals []float64 `json:"min_vals,omitempty"`
MaxVals []float64 `json:"max_vals,omitempty"`
// MISSING: categoricals_mapping
// Text - txt
Count int `json:"count,omitempty"`
MinCount int `json:"min_count,omitempty"`
MinWordLength int `json:"min_word_length,omitempty"`
TFIDF bool `json:"tfidf,omitempty"`
Sentences bool `json:"sentences,omitempty"`
Characters bool `json:"characters,omitempty"`
Sequence int `json:"sequence,omitempty"`
ReadForward bool `json:"read_forward,omitempty"`
Alphabet string `json:"alphabet,omitempty"`
Sparse bool `json:"sparse,omitempty"`
Segmentation bool `json:"segmentation,omitempty"`
} `json:"input,omitempty"`
Output struct {
Best int `json:"best,omitempty"`
Template string `json:"template,omitempty"`
Network *struct {
URL string `json:"url,omitempty"`
HTTPMethod string `json:"http_method,omitempty"`
ContentType string `json:"content_type,omitempty"`
} `json:"network,omitempty"`
Measure []float64 `json:"measure,omitempty"`
ConfidenceThreshold float64 `json:"confidence_threshold,omitempty"`
Bbox bool `json:"bbox,omitempty"`
Mask bool `json:"mask,omitempty"`
Rois string `json:"rois,omitempty"`
Index bool `json:"index,omitempty"`
BuildIndex bool `json:"build_index,omitempty"`
Search bool `json:"search,omitempty"`
MultiboxRois bool `json:"multibox_rois,omitempty"`
CTC bool `json:"ctc,omitempty"`
BlankLabel int `json:"blank_label,omitempty"`
} `json:"output,omitempty"`
Mllib struct {
// Caffe / Caffe2
GPU bool `json:"gpu,omitempty"`
GPUID []int `json:"gpuid,omitempty"`
ExtractLayer string `json:"extract_layer,omitempty"`
// Net or TF
TestBatchSize int `json:"test_batch_size,omitempty"`
// Tensorflow
InputLayer string `json:"inputlayer,omitempty"`
OutputLayer string `json:"outputlayer,omitempty"`
} `json:"mllib,omitempty"`
} `json:"parameters,omitempty"`
}
PredictRequest hold data for the prediction request
type PredictResult ¶
type PredictResult struct {
Status struct {
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
} `json:"status,omitempty"`
Head struct {
Method string `json:"method,omitempty"`
Service string `json:"service,omitempty"`
Time float64 `json:"time,omitempty"`
} `json:"head,omitempty"`
Body struct {
Predictions []struct {
Classes []struct {
Prob float64 `json:"prob,omitempty"`
Last bool `json:"last,omitempty"`
Bbox struct {
Ymax float64 `json:"ymax,omitempty"`
Xmax float64 `json:"xmax,omitempty"`
Ymin float64 `json:"ymin,omitempty"`
Xmin float64 `json:"xmin,omitempty"`
} `json:"bbox,omitempty"`
Mask struct {
Format string `json:"format,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Data []int `json:"data,omitempty"`
} `json:"mask,omitempty"`
Cat string `json:"cat,omitempty"`
}
URI string `json:"uri,omitempty"`
} `json:"predictions,omitempty"`
} `json:"body,omitempty"`
}
PredictResult struct storing predictions result
func Predict ¶
func Predict(host string, predictRequest *PredictRequest) (result PredictResult, err error)
Predict perform a /predict call and return a PredictResult structure
type ServiceInfo ¶
type ServiceInfo struct {
Status struct {
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
} `json:"status,omitempty"`
Body struct {
Mllib string `json:"mllib,omitempty"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
Jobs []struct {
Job int `json:"job,omitempty"`
Status string `json:"status,omitempty"`
} `json:"jobs,omitempty"`
} `json:"body,omitempty"`
}
ServiceInfo structure contain informations fetched by the GetServiceInfo function
func GetServiceInfo ¶
func GetServiceInfo(host string, service string) (info *ServiceInfo, err error)
GetServiceInfo fetch service informations using the /services/<service_name> endpoint It takes the host and the service name as input, and return a *ServiceInfo structure.
type ServiceRequest ¶
type ServiceRequest struct {
// General parameters
Name string
Mllib string `json:"mllib,omitempty"`
Type string `json:"type,default=supervised"`
Description string `json:"description,omitempty"`
// Model
Model struct {
Repository string `json:"repository,omitempty"`
Templates string `json:"templates,omitempty"`
Init string `json:"init,omitempty"`
Weights string `json:"weights,omitempty"`
CreateRepository bool `json:"create_repository,omitempty"`
IndexPreload bool `json:"index_preload,omitempty"`
Extensions []string `json:"extensions,omitempty"`
} `json:"model,omitempty"`
Parameters struct {
Input struct {
// Input
Connector string `json:"connector,omitempty"`
// Input - image
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
BW bool `json:"bw,omitempty"`
MeanTS float64 `json:"mean,omitempty"`
Mean []float64 `json:"mean,omitempty"`
STD float64 `json:"std,omitempty"`
Segmentation bool `json:"segmentation,omitempty"`
MultiLabel bool `json:"multi_label,omitempty"`
RootFolder string `json:"root_folder,omitempty"`
CTC bool `json:"ctc,omitempty"`
UnchangedData bool `json:"unchanged_data,omitempty"`
Bbox bool `json:"bbox,omitempty"`
// Input - CSV
Label string `json:"label,omitempty"`
Ignore []string `json:"ignore,omitempty"`
LabelOffset int `json:"label_offset,omitempty"`
Separator string `json:"separator,omitempty"`
ID string `json:"id,omitempty"`
Scale bool `json:"scale,omitempty"`
Categoricals []string `json:"categoricals,omitempty"`
DB bool `json:"db,omitempty"`
// Input - TXT
Sentences bool `json:"sentences,omitempty"`
Characters bool `json:"characters,omitempty"`
Sequence int `json:"sequence,omitempty"`
ReadForward bool `json:"read_forward,omitempty"`
Alphabet string `json:"alphabet,omitempty"`
Sparse bool `json:"sparse,omitempty"`
} `json:"input,omitempty"`
Mllib struct {
// Caffe and Caffe2
Nclasses int `json:"nclasses,omitempty"`
Ntargets int `json:"ntargets,omitempty"`
GPU bool `json:"gpu,omitempty"`
GPUID []int `json:"gpuid,omitempty"`
Template string `json:"template,omitempty"`
LayersMLP []int `json:"layers,omitempty"`
LayersConvnet []string `json:"layers,omitempty"`
Activation string `json:"activation,omitempty"`
Dropout float64 `json:"dropout,omitempty"`
Regression bool `json:"regression,omitempty"`
Autoencoder bool `json:"autoencoder,omitempty"`
CropSize int `json:"crop_size,omitempty"`
Rotate bool `json:"rotate,omitempty"`
Mirror bool `json:"mirror,omitempty"`
Finetuning bool `json:"finetuning,omitempty"`
DB bool `json:"db,omitempty"`
ScalingTemperature float64 `json:"scaling_temperature,omitempty"`
Loss string `json:"loss,omitempty"`
// Noise - images only
Prob float64 `json:"prob,omitempty"`
AllEffects bool `json:"all_effects,omitempty"`
Decolorize bool `json:"decolorize,omitempty"`
HistEQ bool `json:"hist_eq,omitempty"`
Inverse bool `json:"inverse,omitempty"`
GaussBlur bool `json:"gauss_blur,omitempty"`
Posterize bool `json:"posterize,omitempty"`
Erode bool `json:"erode,omitempty"`
Saltpepper bool `json:"saltpepper,omitempty"`
Clahe bool `json:"clahe,omitempty"`
ConvertToHSV bool `json:"convert_to_hsv,omitempty"`
ConvertToLAB bool `json:"convert_to_lab,omitempty"`
// Distort - images only
Brightness bool `json:"brightness,omitempty"`
Contrast bool `json:"contrast,omitempty"`
Saturation bool `json:"saturation,omitempty"`
HUE bool `json:"HUE,omitempty"`
RandomOrdering bool `json:"random ordering,omitempty,omitempty"`
// TensorFlow
InputLayer string `json:"inputlayer,omitempty"`
OutputLayer string `json:"outputlayer,omitempty"`
// Memory
Datatype string `json:"datatype,omitempty"`
MaxBatchSize int `json:"maxBatchSize,omitempty"`
MaxWorkspaceSize int `json:"maxWorkspaceSize,omitempty"`
} `json:"mllib,omitempty"`
Output struct {
StoreConfig bool `json:"store_config,omitempty"`
} `json:"output,omitempty"`
} `json:"parameters,omitempty"`
}
ServiceRequest hold data for the service creation request See: https://deepdetect.com/api/#create-a-service
type Status ¶
type Status struct {
Status struct {
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
} `json:"status,omitempty"`
}
Status struct storing requests execution results
func CreateService ¶
func CreateService(host string, service *ServiceRequest) (result *Status, err error)
CreateService create a service using the /services endpoint, it takes the host and a *ServiceRequest as input and return a *CreationResult structure.