![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
numpy
小帆97
通信工程
展开
-
numpy打乱某维度数据
生成一个数组,按照一定的顺序打乱第三个维度的数据import numpy as npa = np.arange(24).reshape(2,4,3)#a = a[:,:,:,np.newaxis]print(a)#a1 = a[:,:,0]#a2 = a[:,:,1]#a3 = a[:,:,2]a1 = a[:,:,0].transpose()a2 = a[:,:,1].tran...原创 2020-02-12 00:04:19 · 2032 阅读 · 0 评论 -
numpy 图像矩阵拼接
import cv2import numpy as np img=cv2.imread(r'C:\Users\Administrator\Desktop\test\conv3_1\260011113.jpg')# 读入图片img2=cv2.imread(r'C:\Users\Administrator\Desktop\test\conv3_1\264011119.jpg')img3=cv...原创 2018-12-04 14:48:53 · 3861 阅读 · 0 评论 -
基于numpy实现CNN中卷积
def conv_padding(img,filter_size_x,filter_size_y): x_padding=int((filter_size_x-1)/2) y_padding=int((filter_size_y-1)/2) return np.pad(img,((y_padding,y_padding), (x_padding,x_padding...原创 2018-12-06 00:51:13 · 1597 阅读 · 0 评论 -
python knn
写了一半,保存一下import pickleimport numpy as npimport osimport matplotlib.pyplot as plt#from knn import KNearestNeighborclass KNearestNeighbor(object): """ a kNN classifier with L2 distance """ d...原创 2019-04-17 21:42:36 · 292 阅读 · 0 评论