- 博客(8)
- 收藏
- 关注
原创 (高光谱)数据集分割
从img_gt(存储一幅图像每个像素点的标签)中拆分出两部分:将矩阵分成两个相同矩阵,当中的非0部分按设定比例分到两个矩阵中# output:# (array([ 1, 1, 1, ..., 609, 609, 609], dtype=int64),# array([ 96, 97, 115, ..., 270, 271, 278], dtype=int64))indices = np.nonzero(ttt)# [(1, 96),(1, 97),(1, 115),(1, 171),
2021-06-15 21:14:39
1091
原创 ubuntu时间不同步问题
1.安装ntpdate工具sudo apt-get install ntpdate2.将系统时间与网络同步sudo ntpdate cn.pool.ntp.org3.将时间写入硬件hwclock --systohc4.查看时间是否已同步date
2020-09-25 17:06:09
815
转载 浮点数向偶数舍入
例如有效数字超出规定数位的多余数字是1001,它大于超出规定最低位的一半(即0.5),故最低位进1。如果多余数字是0111,它小于最低位的一半,则舍掉多余数字(截断尾数、截尾)即可。对于多余数字是1000、正好是最低位一半的特殊情况,最低位为0则舍掉多余位,最低位为1则进位1、使得最低位仍为0(偶数)。注意这里说明的数位都是指二进制数。举例:要求保留小数点后3位。对于1.0011001,舍入处理后为1.010(去掉多余的4位,加0.001)对于1.0010111,舍入处理后为1.001(去掉多余的4
2020-09-01 19:56:39
829
转载 python基础-enumerate
功能:enumerate()是python的内置函数,用于将一个可遍历的数据对象(如列表、元组或字符串等)组合为一个索引序列,同时列出数据和数据下标,多用于for循环语法:enumerate(a,start)a是可迭代对象,start是计数起始数字示例一:1 li = ["a","b","c","d","e","f"]2 3 for i in enumerate(li):4 print(i)结果:(0, 'a')(1, 'b')(2, 'c')(3, 'd'...
2020-08-17 21:12:57
146
原创 pandas numpy-替换数据
在对数据清理时经常需要对数据进行替换方法1.将df表格中的指定数据替换为0.0# df替换指定元素,将空数据填充为0 df = df.replace(['NR'], [0.0])方法2.将np中空值变为0x_train = np.nan_to_num(x_train)x_val = np.nan_to_num(x_val)y_train = np.nan_to_num(y_train)y_val = np.nan_to_num(y_val)...
2020-07-19 11:30:30
1151
原创 opencv图片操作
opencv图片操作图片载入img = cv2.imread('hw3/training/0_0.jpg')图片数据保存格式opencv python 中imread返回一个ndarray数组保存的图像数据,如图注意自己新建ndarray 保存图片数据,ndarray的数据类型要设置为uint8x = np.zeros((2, 128, 128, 3), dtype=np.uint8) ## 定义两个ndarray保存图片x[0, :, :, :] = img ##第0个ndarray用
2020-07-15 19:03:20
170
原创 ubuntu下anaconda中安装opencv无法使用cv2.imshow等
ubuntu下anaconda中安装opencv无法使用cv2.imshow等错误提示:error:/tmp/build/80754af9/opencv_1512687413662/work/modules/highgui/src/window.cpp:611:error: (-2) The function is not implemented. Rebuild the library withWindows, GTK+ 2.x or Carbon support. If you are on
2020-07-15 16:39:23
700
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人