We start Deployment and Test from HRNet_Contrast_W48, a semantic segmentaion model in PaddleSeg.
Setup development host and deployment target device according to NCSDK documents. Make sure basic IMGDNN test pass and tutorial example could be deployed successfully.
- Install PaddlePaddle
- Compile PaddlePaddle prediction model into PowerVR deployment packages.
- Clone this repository.
- Download cityspace evaluate dataset from sftp server to EvalDatasetPath directory. The structure of the evaluation dataset is as follows:
cityscapes
|
|--leftImg8bit
| |--val
|
|--gtFine
| |--val
- Copy python/engine/backend/pvr_grpc/* to GRPCServerPath directory on target devices;
- Copy PowerVR deployment package to DeploymentModelPath;
- Set base_name field in $GRPCServerPath/pvr_service_config.yml, e.g
field | description | values |
---|---|---|
base_name | path to vm file | $DeploymentModelPath/HRNet_Contrast_W48-AX2185-d16b16w16-ncsdk_2_8-arrch64_linux_gnu.ro |
- Launch the gRPC server
python PVRInferServer.py
Create a config file in Yaml, some fields are described below. Also refer to configs/image_segmentation/HRNet_Contrast_W48.yaml
field | description | values |
---|---|---|
Global.mode | test mode | evaluation,inference |
Dataloader.dataset.name | dataset class name to be instantialize | CityScapesDataset |
Dataloader.dataset.image_root | directory of input mages of CityScapes dataset | string |
Dataloader.dataset.label_path | directory of ground truth of CityScapes dataset | string |
Dataloader.sampler.batch_size | set the batch size of inupt | integer |
Infer.infer_imgs | path to test image or directory | string |
Infer.batch_size | batch size of inference | interger |
Infer.PostProcess.save_path | path to inference results of test image or directory | string |
Metric.Eval.mIou.num_classes | number of semantic categories | interger |
To inference with Paddle backend, the Pretrained Model need to be downloaded and exported to a prediction model before deployment. Besides, fields below need to be set.
field | description | values |
---|---|---|
Model.backend | backend used to inference | paddle |
Model.Paddle.path | path to Paddle model | string |
Model.Paddle.base_name | base name of model files | string |
To run all test code on target device, set the fields below
field | description | values |
---|---|---|
Model.backend | backend used to inference | powervr |
Model.PowerVR.base_name | path to vm file | string |
Model.PowerVR.input_name | network input name | string |
Model.PowerVR.output_shape | shape of output tensor | list |
To run test code on host and run inference on target device, set the fields below
field | description | values |
---|---|---|
Model.backend | backend used to inference | powervr_grpc |
Model.PowerVR_gRPC.pvr_server | IP of gRPC server | IP address |
Model.PowerVR.input_name | network input name | string |
Model.PowerVR.output_shape | shape of output tensor | list |
python tools/test_egret.py -c ./configs/image_segmentation/HRNet_Contrast_W48.yaml
Some field could be override at command line, e.g. to override the batch_size
python tools/test_egret.py -c ./configs/image_segmentation/HRNet_Contrast_W48.yaml \
-o DataLoader.Eval.sampler.batch_size=1
Model | mIoU (with 5 images) | time(ms) bs=1 |
time(ms) bs=4 |
Download Address |
---|---|---|---|---|
HRNet_Contrast_W48 (d16-w16-b16) |
0.593 | null | null | sftp://transfer.imgtec.com/paddle_models/paddle_segmentation/HRNet_Contrast_W48-AX2185-d16b16w16-ncsdk_2_8-arrch64_linux_gnu.ro |
HRNet_Contrast_W48 (non-quant) |
0.593 | null | null | link |