- Download the pre-trained fcn_resnet_101_coco image segmentation model's state_dict from the following URL :
https://download.pytorch.org/models/fcn_resnet101_coco-7ecb50ca.pth
wget https://download.pytorch.org/models/fcn_resnet101_coco-7ecb50ca.pth
-
Create a model archive file and serve the fcn model in TorchServe using below commands
torch-model-archiver --model-name fcn_resnet_101 --version 1.0 --model-file examples/image_segmenter/fcn/model.py --serialized-file fcn_resnet101_coco-7ecb50ca.pth --handler image_segmenter --extra-files examples/image_segmenter/fcn/fcn.py,examples/image_segmenter/fcn/intermediate_layer_getter.py mkdir model_store mv fcn_resnet_101.mar model_store/ torchserve --start --model-store model_store --models fcn=fcn_resnet_101.mar curl http://127.0.0.1:8080/predictions/fcn -T examples/image_segmenter/fcn/persons.jpg
-
Output
[[[11.49452 11.49452 11.49452 ... 10.846567 10.846567
10.846567 ]
[11.49452 11.49452 11.49452 ... 10.846567 10.846567
10.846567 ]
[11.49452 11.49452 11.49452 ... 10.846567 10.846567
10.846567 ]
...
[10.028987 10.028987 10.028987 ... 9.980104 9.980104
9.980104 ]
[10.028987 10.028987 10.028987 ... 9.980104 9.980105
9.980105 ]
[10.028987 10.028987 10.028987 ... 9.980104 9.980105
9.980105 ]]
[[-2.524181 -2.524181 -2.524181 ... -1.4157648 -1.4157648
-1.4157648 ]
[-2.524181 -2.524181 -2.524181 ... -1.4157648 -1.4157648
-1.4157648 ]
[-2.524181 -2.524181 -2.524181 ... -1.4157648 -1.4157648
-1.4157648 ]
...
[-0.52271044 -0.52271044 -0.52271044 ... -0.910931 -0.910931
-0.910931 ]
[-0.52271044 -0.52271044 -0.52271044 ... -0.910931 -0.910931
-0.910931 ]
[-0.52271044 -0.52271044 -0.52271044 ... -0.910931 -0.910931
-0.910931 ]]
[[-1.1300591 -1.1300591 -1.1300591 ... -0.88538504 -0.88538504
-0.88538504]
[-1.1300591 -1.1300591 -1.1300591 ... -0.88538504 -0.88538504
-0.88538504]
[-1.1300591 -1.1300591 -1.1300591 ... -0.88538504 -0.88538504
-0.88538504]
...
[-1.1726367 -1.1726367 -1.1726367 ... -1.6144376 -1.6144376
-1.6144376 ]
[-1.1726367 -1.1726367 -1.1726367 ... -1.6144376 -1.6144376
-1.6144376 ]
[-1.1726367 -1.1726367 -1.1726367 ... -1.6144376 -1.6144376
-1.6144376 ]]
...
[[-0.27236405 -0.27236405 -0.27236405 ... -0.791381 -0.79138106
-0.79138106]
[-0.27236405 -0.27236405 -0.27236405 ... -0.791381 -0.79138106
-0.79138106]
[-0.27236405 -0.27236405 -0.27236405 ... -0.791381 -0.79138106
-0.79138106]
...
[-0.16645516 -0.16645516 -0.16645516 ... 0.4377911 0.4377911
0.4377911 ]
[-0.16645516 -0.16645516 -0.16645516 ... 0.4377911 0.4377911
0.4377911 ]
[-0.16645516 -0.16645516 -0.16645516 ... 0.4377911 0.4377911
0.4377911 ]]
[[-0.70757735 -0.70757735 -0.70757735 ... -1.0088179 -1.0088179
-1.0088179 ]
[-0.70757735 -0.70757735 -0.70757735 ... -1.0088179 -1.0088179
-1.0088179 ]
[-0.70757735 -0.70757735 -0.70757735 ... -1.0088179 -1.0088179
-1.0088179 ]
...
[ 0.44139242 0.44139242 0.44139242 ... 0.28535858 0.28535858
0.28535858]
[ 0.44139242 0.44139242 0.44139242 ... 0.28535858 0.28535858
0.28535858]
[ 0.44139242 0.44139242 0.44139242 ... 0.28535858 0.28535858
0.28535858]]
[[-0.47415262 -0.47415262 -0.47415262 ... -0.4314881 -0.43148813
-0.43148813]
[-0.47415262 -0.47415262 -0.47415262 ... -0.4314881 -0.43148813
-0.43148813]
[-0.47415262 -0.47415262 -0.47415262 ... -0.4314881 -0.43148813
-0.43148813]
...
[ 0.04289126 0.04289126 0.04289126 ... -0.42638034 -0.42638034
-0.42638034]
[ 0.04289126 0.04289126 0.04289126 ... -0.42638034 -0.42638034
-0.42638034]
[ 0.04289126 0.04289126 0.04289126 ... -0.42638034 -0.42638034]