
python
Chauncey_Wang
这个作者很懒,什么都没留下…
展开
-
matplotlib如何设置grid密度,如何设置网格线密度
谈谈如何设定matplotlib中grid的密度原创 2022-06-03 14:24:28 · 11056 阅读 · 5 评论 -
os.listdir在linux和windows下结果不同(os.listdir乱序)
需要注意的是,windows下的os.listdir等价于linux下的sorted(os.listdir)原创 2022-05-01 13:01:39 · 1345 阅读 · 0 评论 -
labelimg安装与操作
Ubuntu下安装请使用pip3 install labelimgwindows下使用pip install labelimg安装成功后通过命令行打开Ubuntu下打开的指令是labelImg注意字母img的i需要大写windows下打开指令是labelimg不需要i大写打开效果用于设定 标注文件的存放地址用于打开需要标注的图片文件夹设置默认标签w 新建标注a 上一张图片d 下一张图片空原创 2021-11-14 15:31:44 · 7146 阅读 · 0 评论 -
Python的树、图以及为什么没有链表(转载)
图可以看NetworkXhttps://networkx.org/documentation/stable/tutorial.html树可以看libtreehttps://github.com/caesar0301/treelib为什么没有链表,参考为什么python标准库没有实现链表转载 2021-09-01 13:01:53 · 375 阅读 · 0 评论 -
字符标签转数字编码、独热编码 及独热编码转数字编码
有些数据集给的标签是字符串形式,比如wisdm,在放进网络之前,需要转为数字型的编码这可以通过pd.Categorical(a).codes实现如import numpy as npimport pandas as pda = ["standing", "sitting", "jogging", "walking", "upstairs", "downstairs", "standing"]num_label = pd.Categorical(a).codesprint(num_la原创 2021-08-31 19:13:13 · 5214 阅读 · 0 评论 -
UserWarning: Argument interpolation should be of type InterpolationMode instead of int 解决方案
不幸遇到了如下的警告/home/chauncey/.local/lib/python3.8/site-packages/torchvision/transforms/functional.py:364: UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum. warnings.warn( 有些解释是用In原创 2021-08-24 20:14:29 · 12345 阅读 · 17 评论 -
tkinter canvas教程(转载)
Python tkinter Canvas画布完全攻略转载 2021-06-06 14:21:07 · 137 阅读 · 0 评论 -
如何查看tkinter可用的字体有哪些
from tkinter import Tk, fontroot = Tk()font.families()原创 2021-04-19 19:54:26 · 2292 阅读 · 0 评论 -
tkinter点击按钮实现图片的切换
tkinter是python的标准Tk GUI工具包的接口,在windows下如果你安装的python3,那在安装python的时候,就已经自动安装了tkinter了如果是在linux系统中,则不会自动安装tkinter,需要通过sudo apt-get install python-tk手动安装首先先介绍一下,tkinter本身只支持gif等少数几个图片格式,如果图片并不复杂,建议直接右击图片,进入编辑,在画图界面将图片另存为gif格式就可以使用了(连png和jpeg都不支持。。。.原创 2021-04-07 11:12:26 · 7438 阅读 · 16 评论 -
不要用C语言的思维 来思考python的or(或)
我真的学会python了吗?在写这篇博客前,我问我自己本来觉得python简单,就很少去纠结python语法的细节直到今天,发现了自己C语言思维惯性导致的bug这个bug产生的主要原因是对于python运算符or的理解特地写下这篇博客,解释一下python中or和C语言中||的不同先看python代码,i = 1if i == (2 or 3 or 1): print("yes")else: print("not")你觉得结果是什么呢,按C语言的思维套.原创 2020-11-13 15:58:05 · 172 阅读 · 0 评论 -
关于python中的[:, -1, :] [:, :, -1] [-1, :, :]
其实是个比较简单的知识点,但是因为经常忘记,在此记录一下以[:, -1, :]为例冒号代表该维度的全部元素-1代表该维度的最后一个元素如output = np.array([i for i in range(8)]).reshape(2, 2, 2)print(output)输出的是[[[0 1] [2 3]] [[4 5] [6 7]]]而经过[:, -1, :]处理后print(output[:, -1, :])变成[[2 3] [6原创 2020-11-03 21:39:27 · 2125 阅读 · 0 评论