darknet转化为caffe-ssd

caffe-ssd下载:https://share.weiyun.com/50NyOiw

需要安装boost 1.54版本、python2.7、protobuf 2.6.1

boost 1.54下载:https://share.weiyun.com/5kwTbx1

protobuf 2.6.1下载:https://share.weiyun.com/5HzTe0d

安装protobuf:

# 安装protobuf:
    cd protobuf-2.6.1
    ./configure
    make all
    sudo make install
# 检查protobuf是否安装成功
    protoc --version

安装boost:

tar zxvf boost_1_58_0.tar.gz

#设置编译器和所选库
cd boost_1_58_0
./bootstrap.sh --with-libraries=all --with-toolset=gcc
#编译boost
./b2 toolset=gcc
#安装boost
./b2 install --prefix=/usr
ldconfig


#卸载boost的话,直接删除
rm -rf /usr/lib/boost_* 
rm -rf /usr/include/boost

配置caffe-ssd:

将文件 upsample_layer.hpp 放置,caffe_ssd/include/caffe/layers/upsample_layer.hpp

将文件upsample_layer.cpp放置,caffe_ssd/src/caffe/layers/upsample_layer.cpp

将文件upsample_layer.cu放置,caffe_ssd/src/caffe/layers/upsample_layer.cu

 

编辑Makefile文件:

修改opencv这项为:

ifeq ($(USE_OPENCV), 1)
	LIBRARIES += opencv_core opencv_highgui opencv_imgproc

	ifeq ($(OPENCV_VERSION), 3)
		LIBRARIES += opencv_imgcodecs opencv_videoio
	endif
endif

LIBRARIES修改为:

LIBRARIES += glog gflags protobuf boost_system boost_filesystem boost_regex boost_thread stdc++ m hdf5_hl hdf5

编辑Makefile.config文件:

CPU_ONLY := 1
USE_OPENCV := 1
OPENCV_VERSION := 3

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ /usr/include/opencv2/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/ /usr/lib/x86_64-linux-gnu/

编译caffe-ssd:

sudo make all -j8

sudo make py

 

开始转化:

安装pytorch:

#安装pytorch
pip install “自行去官网,选择合适的pytorch版本”
pip install torchvision
pip install numpy

#测试pytorch是否安装成功,进入python环境
import torch
import torchvision
print(torch.cuda.is_available())

借助pytorch转化工具:https://share.weiyun.com/58a6JNC

yolov3,在darknet下的配置文件和权重文件,下载链接:https://share.weiyun.com/5MdbRss

将yolov3-tiny-half_3cls64.cfg文件里的:

#[maxpool]
#size=2
#stride=1

注释掉。

最后执行:

sudo python yolov3_darknet2caffe.py

你可能感兴趣的:(环境配置,系统运维)