自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(97)
  • 收藏
  • 关注

原创 Linux和安卓编译opencv以及cmake使用opencv

官网:https://opencv.org/releases/ 下载Sources包,我测试下载的是3.4.16安卓opencv依赖库:百度一下”linux编译opencv”Linux编译:mkdir buildcd buildcmake -D WITH_TBB=ON -D WITH_EIGEN=OFF -D OPENCV_GENERATE_PKGCONFIG=ON -D BUILD_DOCS=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=O

2022-02-15 13:58:39 2916

原创 转置卷积看这一篇就够

看这一篇就懂了https://www.cnblogs.com/qizhou/p/13895967.html

2022-02-11 15:58:36 1403

原创 pytorch导出onnx

net = Net()dummy_input = torch.randn(1, 3, 224, 224, device='cuda')torch.onnx.export(net, (dummy_input), "1.onnx", verbose=True, input_names=['input1'], output_names=['output1'],opset_version=11)

2022-02-11 15:54:49 842

原创 cmake指定安装路径、make install与uninstall

关于指定指定安装路径、make install与uninstall有2个指定安装路径的地方:cmake参数CMAKE_INSTALL_PREFIX=/path1make DESTDIR=/path2 install假如说你想把opencv装到/usr/local/opencv3.4.16文件夹里面,可以按下面这样做:法1:cmake 。。。 -D CMAKE_INSTALL_PREFIX=/usr/local/opencv3.4.16make install也可以:法2:cmake 。

2021-12-30 17:47:02 3710

原创 pkg-config默认搜索路径

/usr/lib/x86_64-linux-gnu/pkgconfig

2021-12-30 16:13:45 1213

原创 cmake 安卓交叉编译 warning: liblog.so, needed by

事情起源是:将在MNN-master里编译好的libMNN.so单独拿出来,自己创建一个文件夹准备写一个交叉编译的推理demo;链接时语句是:target_link_libraries(main MNN)编译后报错提示:报错是libMNN.so依赖这2个库,于是我们使用交叉编译的ldd来查看安卓架构上的libMNN.so(linux本机的ldd只能用于x86架构的文件)。~/android-ndk-r21e/toolchains/x86_64-4.9/prebuilt/linux-x86_64/b

2021-12-29 15:27:48 3376

原创 C++加了条件编译依然报错multiple definition of原因

看如下例子:以下4个文件在同一目录里:main.cpp:#include<iostream>#include<net.h>using namespace std;int main(){ return 0;}net.h:#ifndef AAA#define AAAvoid print(){}#endifnet.cpp:#include<net.h>CMakeLists.txt:cmake_minimum_requi

2021-12-28 15:04:29 2237 3

原创 C++ Eigen矩阵库矩阵乘法

以下实现的是一个描述子降维从256降到32,一个简单的矩阵乘法实现(N,256)*(256,32)=(N,32)#include <Eigen/Core> //Eigen矩阵乘法start7 = get_current_time();float* new_values1_after_NMS = new float[kp_nums*256];for(int kp_index=0;kp_index<kp_nums;kp_index++){ for(int i=0;i<

2021-12-14 10:33:40 3479

原创 C++thread线程绑定核并起名字

#include <thread> //线程#include <unistd.h> // sysconf #include <sched.h> //sched_setaffinity 绑核#define _GNU_SOURCE #include <sys/prctl.h> //起名用void test_thread(){ int cpus = sysconf(_SC_NPROCESSORS_CONF); //总共多少个CPU核 cons

2021-11-29 10:19:58 1299

原创 在linux交叉编译安卓手机ARM Mali 的OpenCL代码

1.下载交叉编译工具链NDK下载后文件夹名如:android-ndk-r21e2.main.cpp#include<iostream>#include<CL/opencl.h>using namespace std;//根据平台ID得到平台名字string getPlatformName(const cl_platform_id pid) { size_t param_value_size; clGetPlatformInfo(pid, CL_PLATFORM_N

2021-11-01 09:39:57 1359

原创 linux链接库查找的优先顺序

https://my.oschina.net/shelllife/blog/115958

2021-10-26 17:29:41 308

原创 windows+CUDA+opencl+VS2017环境配置

https://blog.csdn.net/CharleeChan/article/details/79955764

2021-10-26 10:11:29 280

原创 C++ 读取txt每一行得到的string有问题

使用如下的方法,逐行读取txt文件,cout显示的时候异常string s;fstream f("classes.txt");vector<string> classes;while(!f.eof()){ getline(f,s); classes.push_back(s); cout << s << endl; /* for(auto ss:s) { cout << s <&

2021-09-23 17:29:13 321

原创 python-opencv cv2:按比例resize图片

img = cv2.resize(img,None,fx=0.5,fy=0.5,interpolation=cv2.INTER_AREA)分别设定长宽倍数,可以大于1,可以小于1

2021-09-17 20:42:54 1872

原创 C++:define和typedef的区别

define: 发生在预处理阶段,是简单的文本替换。typedef: 发生在编译阶段,定义一个类型的别名,用于处理复杂类型以下代码以定义int*型指针为例:可以看到p2部分报错;pint1 p1,p2 等于 int* p1,p2;只有p1是int*型指针,p2依然是int型;pint2 p3,p4 等于 p3,p4;两个都是指针。因为typedef是类型定义,所以int*默认被合在一起了...

2021-09-15 10:32:11 75

原创 python-opencv cv2并排显示两幅图

import numpy as npimport cv2if __name__ == '__main__': img1 = cv2.imread img2 = cv2.imread imgs = np.hstack([img1, img2]) cv2.imshow('1',imgs)

2021-09-13 15:14:04 6429

原创 /lib/x86_64-linux-gnu/libm.so.6: undefined reference to `__strtof128_nan@GLIBC_PRIVATE‘

/lib/x86_64-linux-gnu里存在libm.so.6和libc.so.6,这2个是软连接用ll显示可以看到libm.so.6 -> libm-2.27.solibc.so.6 -> libc-2.23.so他们指向的实际库文件版本不一致用ln -s 软连接名 实际库文件名来使得他俩的版本号一致,就可以了...

2021-09-06 17:24:32 3480 2

原创 C++计算时间花费

这2种引用方法都试一下,不同系统不一样#include <time.h>#include <sys/time.h>double get_current_time(){ struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0;}double start, end;printf("time : %f ms\n",

2021-08-30 11:29:14 278

原创 cv2保存为jpg图像数值不对解决办法

代码如下:情况是需要保存一张resize过后的图片,再次读进来发现像素值完全不一样。经过多次读写,分别输出了前5个像素值,和所有像素的总和。import cv2img = cv2.imread('../ILSVRC2012_val_00049999.JPEG') #就是上面那张图print(img[0,0,:])img1 = cv2.resize(img,(224,224))print(img1[:5,0,0],img1.sum())cv2.imwrite('ILSV224.jpg',img1

2021-08-25 16:28:48 959

原创 BN层反向传播公式推导

最后loss对参数的总梯度,是所有的梯度之和前向:xi^=xi−μσ2\hat{x_i} = \frac{x_i-\mu}{\sqrt{\sigma^2}}xi​^​=σ2​xi​−μ​y=γxi+βy=\gamma x_i+\betay=γxi​+β基本求导:∂σ2∂μ=1m∑i=1m[−2(xi−μ)]\frac{\partial \sigma^{2}}{\partial \mu}= \frac{1}{m}\sum_{i=1}^{m}[-2(x_i-\mu)]∂μ∂σ2​=

2021-08-23 17:15:40 551

原创 linux查找目录中所有文件中关键字

grep "要查找的字符串" * -r会递归查找所有子目录中文件不止能查找文本文件,还能查找库文件如 .so文件中

2021-08-13 14:31:39 7030

原创 关于MNN框架读取图片遇到的问题:undefined reference to `stbi_load‘

遇到undefined reference to ‘stbi_load’ 这种问题一般都是使用了某些未定义的函数,说明这个函数没有被定义到。项目情况是要在安卓平台用MNN执行模型推理,安卓平台不可能放下opencv那么大的库,所以不能用opencv进行读取图片,所以参考了MNN提供的demo进行图片读取。参考MNN-master\demo\exec\pictureRecognition.cpp所写出的问题代码如下:#include "stb_image.h"......int width, hei

2021-08-10 10:51:19 1488

原创 C++、opencv、图像旋转

在ubuntu系统上,用KDevelop开发环境写的代码,所以有main.cpp和CMakeLists.txt两个文件。没有KDevelop也可以,直接mkdir build && cd build && cmake … && makemain.cpp#include <iostream>#include <string>#include <math.h>#include <opencv2/core/cor

2021-08-03 17:40:36 513

原创 一个简单的cmake编译C++的例子来学习各个内容

本例实现一个简单的helloworld的程序的编译共包含3个文件libHelloSLAM.cpp libHelloSLAM.h main.cpplibHelloSLAM.h#ifndef LIBHELLOSLAM_H_#define LIBHELLOSLAM_H_void printHello();#endiflibHelloSLAM.cpp#include <iostream>using namespace std;void printHello(){

2021-07-26 19:30:23 119

原创 机器学习实战-Logistic回归

1.数据处理testSet.txt:-0.017612 14.053064 0-1.395634 4.662541 1-0.752157 6.538620 0-1.322371 7.152853 00.423363 11.054677 00.406704 7.067335 10.667394 12.741452 0-2.460150 6.866805 10.569411 9.548755 0-0.026632 10.427743 00.850433 6.920334 11.3471

2021-03-10 13:42:08 142

转载 深度学习模型压缩与优化加速(转载)

https://blog.csdn.net/nature553863/article/details/81083955

2021-03-03 17:56:45 162 1

原创 MATLAB-Harris角点检测

参考链接:https://blog.csdn.net/zaishuiyifangxym/article/details/89515923%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Harris角点检测算法 Matlab code%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2021-02-05 16:57:15 353

原创 python查看函数、类所在的定义文件

import sysimport osprint(os.path.abspath(sys.modules[你要查的类.__module__].__file__))

2021-01-21 16:11:51 3824

原创 matplotlib双y轴

plt.subplot()import numpy as np import matplotlib.pyplot as plt x = np.arange(0, 100) plt.subplot(221) plt.plot(x, x) plt.subplot(222) plt.plot(x, -x) plt.subplot(223) plt.plot(x, x ** 2) plt.subplot(224) plt.plot(x, np.

2021-01-21 11:52:55 125

原创 python在外部给类或实例添加成员函数

给实例添加或者修改成员函数import typesclass People(): def __init__(self): self.age=10 self.name='Bob' def show_age(): print(self.age)def show_name(self): print(self.name)def show_age_new(self): print(self.age+1)p=People()

2021-01-19 14:16:04 3916 2

原创 机器学习实战-python手写感知机

import timeimport numpy as npimport matplotlib.pyplot as plt#训练数据x=np.array([[3.54,1.97],[3.01,2.55],[7.55,-1.58],[2.11,0],[8.12,1.27], [7.11,-0.98],[8.61,2.05],[2.32,0.26],[3.63,1.73],[0.34,-0.89], [3.12,0.29],[2.12,-0.78],[0.

2020-11-06 17:19:29 250 2

原创 机器学习实战-python手写线性回归

import numpy as npimport matplotlib.pyplot as pltplt.ion()x = np.array([1.3854, 1.2213, 1.1009, 1.0655, 0.9503])y = np.array([2.1332, 2.0162, 1.9138, 1.8621, 1.8016])w=0.5b=0.5lr=0.01loss=0square = lambda x:x*xpx=np.linspace(0,2,10)while Tr.

2020-11-05 23:12:24 724 2

原创 python sorted使用key对字典值进行排序

key意思是先获取关键值在进行排序,lambda是固定的词,这是一个函数的意思,x表示自变量,即dic.items()的每一项,那么x[1]就是每一项的value值了,默认升序;如果要降序那就是对-x[1]进行升序

2020-08-13 15:35:37 389

原创 C++优先队列priority_queue基本使用

小顶堆: 小的先出#include<functional>#include <queue>int main(){ vector<int> v = { 1,2,6,4,5,7,3 }; priority_queue<int, vector<int>, greater<int> > m; //小顶堆 for (int i = 0; i < v.size(); i++) { m.push(v[i]); } wh

2020-08-11 01:03:51 64

原创 华为上机笔试题

1.老师想知道从某某同学当中,分数最高的是多少,现在请你编程模拟老师的询问。当然,老师有时候需要更新某位同学的成绩.输入包括多组测试数据。每组输入第一行是两个正整数N和M(0 < N <= 30000,0 < M < 5000),分别代表学生的数目和操作的数目。学生ID编号从1编到N。第二行包含N个整数,代表这N个学生的初始成绩,其中第i个数代表ID为i的学生的成绩接下来又M行,每一行有一个字符C(只取‘Q’或‘U’),和两个正整数A,B,当C为’Q’的时候, 表示这是一

2020-07-28 22:01:29 421

原创 C++归并排序

可通,备份#include<iostream>using namespace std;#define len(a) sizeof(a)/sizeof(int)void mergeArray(int arr[], int first, int mid, int last, int temp[]){ int i = first; int j = mid + 1; int m = mid; int n = last; int k = 0; while (i <= m &

2020-07-10 17:00:37 96

原创 C++函数求数组长度

还不理解#include <iostream>using namespace std;template <typename T, int N>int getlen(T(&)[N]) { return N;}int main() { int ary[] = { 1, 2, 3 }; cout << getlen(ary) << endl;}

2020-07-08 16:31:10 1070

转载 C++数组传递

转自:https://www.cnblogs.com/it89/p/11068654.html#include "stdio.h"#include "stdlib.h"//接受一个数组参数的函数:void SampleArrayParam1( int * a, int length ){ for( int i = 0; i < length; i++ ) { printf( "%d ", a[i] ); } printf( "\n" );}vo

2020-07-08 16:08:30 455

原创 排序算法-python

冒泡排序#coding=UTF-8import numpy as np#生成10个0~99的随机数a=np.random.randint(0,100,10)print(a)#假设n个数,总共需要进行n-1趟排序for i in range(1,len(a)): # [1,...,n-1] #第i趟索引从1到n-i+1 for j in range(1,len(a)-i+1): # [1,...,n-i+1] # 当前数比前一个小,与前一个互换位置

2020-05-11 16:24:48 176

原创 caffe:BN层转batchnorm+scale修改prototxt

#coding=UTF-8import syssys.path.insert(0,'/home/cdli/ECO2/caffe_3d/python')import copyfrom caffe.proto import caffe_pb2from google.protobuf import text_formatimport googledef create_layer(base...

2020-04-07 10:53:02 280

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除