Use Pytorch to achieve Semantic Segmentation

Code  https://github.com/CSAILVision/semantic-segmentation-pytorch

Related paper  https://arxiv.org/pdf/1608.05442.pdf

ubuntu16.04 + pycharm + python3.5 + cuda9.0 (graphics card 1070)

The version of the relevant library

future        0.18.2  
numpy         1.18.5  
opencv-python 3.4.1.15
Pillow        7.2.0   
pip           19.0.3  
PyYAML        5.3.1   
scipy         1.4.1   
setuptools    40.8.0  
six           1.15.0  
torch         0.4.1   
torchvision   0.2.1   
tqdm          4.55.0  
yacs          0.1.8  

1. Create a ckpt folder under the project path, and download the model folder ade20k-resnet50dilated-ppm_deepsup in http://sceneparsing.csail.mit.edu/model/pytorch and put it in

2. Create a test picture folder test_img under the project path, and put the picture to be tested into it, as shown in the figure:

3. Change the relevant code of the ``--img parameter of the parser to:

parser.add_argument(
        "--imgs",
        default='/home/dl/PycharmProjects/MITSS/test_img',
        required=False,
        type=str,
        help="an image path, or a directory name"
    )

4. The parser's'--cfg' parameter code is changed to: (note that the file name of yaml must correspond to the file name in ckpt)

parser.add_argument(
        "--cfg",
        default="config/ade20k-resnet50dilated-ppm_deepsup.yaml",
        metavar="FILE",
        help="path to config file",
        type=str,
    )

Test Results:

   

  

The segmentation of the big target is not good

  

Guess you like

Origin blog.csdn.net/XLcaoyi/article/details/111938640
Recommended