PSPNet编译心得

贴上具体的编译过程吧:

step1:clone下caffe,按照caffe官方教程编译caffe(要编译python接口)

step2:进入到PSPNet里面进行编译,编译过程和caffe的编译差不多,在这里我使用了python接口,所以进行以下语句的编译即可:

make pycaffe -j4
make all -j4
make test -j4

在编译pycaffe是可能会出现以下错误:

    如果不适用GPU的话在interp.hpp直接注释掉这条语句即可;

还可能出现下面这个错误:

sudo apt-get install libmatio-dev安装一下就好。

step3:在PSPNet下面建立demo文件夹

下载相应的caffemodel和prototxt文件,然后修改demo.py就可以用训练好的模型进行测试:

import sys
import time
import getopt
import os
import numpy as np
from PIL import Image as PILImage

# Path of the Caffe installation.
_CAFFE_ROOT = "/home/chen/PSPNet/"

# Model definition and model file paths
_MODEL_DEF_FILE = "pspnet50_ADE20K_473.prototxt"  # Contains the network definition
_MODEL_FILE = "pspnet50_ADE20K.caffemodel"  # Contains the trained weights.

sys.path.insert(0, _CAFFE_ROOT + "python")
import caffe

_MAX_DIM = 473


def get_palette(num_cls):
    """ Returns the color map for visualizing the segmentation mask.

    Args:
        num_cls: Number of classes

    Returns:
        The color map
    """

    n = num_cls
    palette = [0] * (n 
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值