paddlepaddle-c++预测代码

参考GitHub:

https://github.com/yangninghua/deeplearning_backbone

makefile文件: 

CC      = gcc
CPP     = g++
AR = ar
RM      = rm -f

#Define the resource compiler.
RC = windres

## debug flag  
DBG_ENABLE := 0

OS = $(shell uname)

## source file path  
SRC_PATH  := ./src/
SRC_PATH_EXT := 

## target file name  
TARGET     := vis_demo

## get all source files  
SRCS := $(foreach spath, $(SRC_PATH), $(wildcard $(spath)*.c) $(wildcard $(spath)*.cpp))

## all .o based on all .c/.cpp
OBJS = $(SRCS:.c=.o)
OBJS := $(OBJS:.cpp=.o) 
OBJS := $(OBJS:.cc=.o) 

## macro define
DEFS := __LINUX__ OS_LINUX _FILE_OFFSET_BITS=64

#if freeimage is static-linked use this !
#DEFS += FREEIMAGE_LIB

## need libs, add at here  
LIBS := mklml_intel iomp5 mkldnn paddle_fluid glog gflags protobuf snappystream snappy z xxhash cudart cublas cudnn

## used headers  file path  
INCLUDE_PATH := /usr/local/cuda/include \
./libs/third_party/install/protobuf/include \
./libs/paddle/include \
./libs/paddle/ \
./include \
./libs/third_party/install/glog/include \
./libs/third_party/install/gflags/include \
./libs/third_party/install/xxhash/include \
./libs/third_party/install/snappy/include \
./libs/third_party/install/snappystream/include \
./libs/third_party/install/zlib/include \
./libs/third_party/boost \
./libs/third_party/eigen3 \
./libs/third_party/install/mklml/include \
./libs/third_party/install/mkldnn/include

#$(warning $(INCLUDE_PATH))

## used include librarys file path  
LIBRARY_PATH := /usr/local/cuda/lib64 \
./libs/third_party/install/protobuf/lib \
./libs/third_party/install/snappy/lib \
./libs/third_party/install/snappystream/lib \
./libs/third_party/install/zlib/lib \
./libs/third_party/install/glog/lib \
./libs/third_party/install/gflags/lib \
./libs/third_party/install/xxhash/lib \
./libs/third_party/install/mklml/lib \
./libs/third_party/install/mkldnn/lib \
/usr/lib/x86_64-linux-gnu \
./libs



## debug for debug info, when use gdb to debug  
ifeq (1, ${DBG_ENABLE})   
CFLAGS += -D_DEBUG -g -DDEBUG=1 
else
CFLAGS += -O3 -DNDEBUG
endif

#for ENCYPT flags

# rpath https://blog.csdn.net/kevin_darkelf/article/details/40891593
# https://blog.csdn.net/lusic01/article/details/89214976
ifeq ($(OS), Linux)
LIBS += dl rt pthread
CFLAGS += -fPIC
TARGET_EXT := 
LIBRARY_PATH += 
LDFLAGS += -Wl,--rpath=./libs
endif

CFLAGS += -msse4.2 -march=core2 -pipe $(foreach m, $(DEFS), -D$(m)) 
  
## get all include path  
CFLAGS  += $(foreach dir, $(INCLUDE_PATH), -I$(dir))  

CXXFLAGS += $(CFLAGS) -std=c++11

## get all library path  
LDFLAGS += -lpthread $(foreach lib, $(LIBRARY_PATH), -L$(lib))
  
## get all librarys  
LDFLAGS += $(foreach lib, $(LIBS), -l$(lib))

RCFLAGS ?= -DNDEBUG

default: all

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o: %.cpp
	$(CPP) $(CXXFLAGS) -c $< -o $@
	
all: $(OBJS) $(RESOURCE)
	$(CPP) $(CXXFLAGS) -shared -o $(TARGET)$(TARGET_EXT) $(OBJS) $(RESOURCE) $(LDFLAGS)

clean:  
	$(RM) $(OBJS) $(TARGET).* $(RESOURCE)

命令:

./vis_demo \
--modeldir=./dataset/se_resnext50/model \
--data=./dataset/se_resnext50/data.txt \
--refer=./dataset/se_resnext50/result.txt \
--use_gpu=1

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值