README.md 1.2 KB
Newer Older
J
Jiawei Wang 已提交
1 2 3 4 5 6 7 8 9 10
## Image Classification

([简体中文](./README_CN.md)|English)

The example uses the ResNet50_vd model to perform the imagenet 1000 classification task.

### Get model config and sample dataset
```
sh get_model.sh
```
M
MRXLT 已提交
11 12 13 14 15 16 17

### Install preprocess module

```
pip install paddle_serving_app
```

D
dongdaxiang 已提交
18
### HTTP Service
J
Jiawei Wang 已提交
19 20 21

launch server side
```
D
dongdaxiang 已提交
22
python image_classification_service.py ResNet50_vd_model cpu 9696 #cpu inference service
J
Jiawei Wang 已提交
23 24
```
```
D
dongdaxiang 已提交
25
python image_classification_service.py ResNet50_vd_model gpu 9696 #gpu inference service
J
Jiawei Wang 已提交
26 27 28 29 30
```


client send inference request
```
D
dongdaxiang 已提交
31
curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"image": "https://paddle-serving.bj.bcebos.com/imagenet-example/daisy.jpg"}], "fetch": ["score"]}' http://127.0.0.1:9696/image/prediction
J
Jiawei Wang 已提交
32
```
D
dongdaxiang 已提交
33 34

### RPC Service
J
Jiawei Wang 已提交
35 36 37

launch server side
```
D
dongdaxiang 已提交
38
python -m paddle_serving_server.serve --model ResNet50_vd_model --port 9696 #cpu inference service
J
Jiawei Wang 已提交
39 40 41
```

```
D
dongdaxiang 已提交
42
python -m paddle_serving_server_gpu.serve --model ResNet50_vd_model --port 9696 --gpu_ids 0 #gpu inference service
J
Jiawei Wang 已提交
43 44 45 46 47 48
```

client send inference request
```
python image_rpc_client.py ResNet50_vd_client_config/serving_client_conf.prototxt
```
D
dongdaxiang 已提交
49
*the port of server side in this example is 9696