jolibrain / deepdetect

Deep Learning API and Server in C++14 support for Caffe, PyTorch,TensorRT, Dlib, NCNN, Tensorflow, XGBoost and TSNE
https://www.deepdetect.com/
Other
2.51k stars 561 forks source link

SENet models predict error results #546

Closed intgogo closed 5 years ago

intgogo commented 5 years ago

I did the test like the "image classifier" example said with the pretrained SE-ResNeXt-50 model,but the results were all wrong.

beniz commented 5 years ago

Hi, can you give more details, i.e. exact service creation and predict calls ? Thanks.

intgogo commented 5 years ago

@beniz thank you! Create service:

curl -X PUT "http://localhost:8182/services/resnext50" -d '{ "mllib":"caffe", "description":"image classification service", "type":"supervised", "parameters":{ "input":{ "connector":"image" }, "mllib":{ "template":"se_resnext_50", "nclasses":1000 ,"gpu":true,"gpuid":0,"weights":"SE-ResNeXt-50.caffemodel"} }, "model":{ "templates":"../../../templates/caffe/", "repository":"../../../models/SE-ResNeXt-50" } }'

Image predict:

curl -X POST "http://localhost:8182/predict" -d '{ "service":"resnext50", "parameters":{ "input":{ "width":224, "height":224 }, "output":{ "best":3 } }, "data":["../../../ambulance.jpg"] }'

Results:

{"status":{"code":200,"msg":"OK"},
"head":{"method":"/predict","service":"resnext50","time":91.0},
"body":{"predictions":[{"classes":[{"prob":0.30143848061561587,"cat":"n02114548 white wolf, Arctic wolf, Canis lupus tundrarum"},{"prob":0.1699993908405304,"cat":"n06794110 street sign"},{"last":true,"prob":0.14141684770584107,"cat":"n02114367 timber wolf, grey wolf, gray wolf, Canis lupus"}],"uri":"../../../ambulance.jpg"}]}}
beniz commented 5 years ago

Thanks, this is due to missing mean values for the model, add

"input":{ "connector":"image","mean":[104,117,123]}

to your PUT /services call.

These mean values appear in the template deploy.prototxt file and we should somehow add them to the table of models in the README as well.

A full set of ready-to-use model tarballs is under construction, that will include all these types of parameters, these difficulties should go away soon.