测出来的时间为:
解决方法为:
struct timeval tpstart,tpend;
float timeuse;
gettimeofday(&tpstart,NULL);
int index = HST_ClerkDetect(handle, img.data, img.cols, img.rows);//目标分类
gettimeofday(&tpend,NULL);
timeuse=1000000*(tpend.tv_sec-tpstart.tv_sec)+ tpend.tv_usec-tpstart.tv_usec;
timeuse/=1000000;
printf("HST_ClerkDetect: time cost %f s\n",timeuse);
头文件用这个#include <sys/time.h>
现在的时间为:
caffe 自带的测速:
这个是最准确的 但是因为检测到之后还需要一些处理 所以时间比forward 的时间长4ms 是正常的。
暂时理解到这个层次