- 博客(103)
- 收藏
- 关注
原创 读取文件linux-to--window1
由上图可以知道:我之前在colab上运行该代码时,没有出现这个问题,说明linux时支持这种文件命名格式的,但是在window上运行的时候,通过找原因。出现这个Invalid argument的原因是window系统不支持这个命名格式,不能用‘:’号,要将其改为其他的符号,我选择了‘_’,亲测成功...
2020-06-08 22:10:33
173
原创 tensorflow2.2自定义层
1.most TensorFlow APIs are usable with eager execution.
2020-06-05 21:51:45
379
原创 tf.data.Dataset.batch
combines consecutive elements of this dataset into batches. 两种情况取决于是否要最后那个个数不足的batchdataset = tf.data.Dataset.range(8)dataset = dataset.batch(3)print(list(dataset.as_numpy_iterator()))输出[array([0, 1, 2], dtype=int64), array([3, 4, 5], dtype=int64), a
2020-05-27 21:53:42
2136
原创 numpy一个数组的存储、读取/多个数组的存储、读取 np.save/np.savez/np.load
numpy 数组的存储一个数组的情况method1: 可取 save--->.npy ----.load()method2:savez--->.npz---->load() 是能存取,但是显示不出来method3 savez(,a=a)---->npz--->load 可取多个数组的情况method1: save--->npy---->load虽然没有报错,但其实只能存取一个数组method2: savez ----npz-----load一个数组的情况meth
2020-05-27 17:41:52
5316
原创 data structure/查看所形成的数据的结构
如何查看tensorflow创建的数据的结构1.dataset.element_spec 看的没有那么清楚,因为还有数据类型夹杂着2. print(dataset)1.dataset.element_spec 看的没有那么清楚,因为还有数据类型夹杂着import tensorflow as tf# for threedataset1 = tf.data.Dataset.from_tensor_slices(tf.random.uniform([4,10])) # a single component
2020-05-27 15:26:16
448
原创 Data structure:Dataset.element_spec/
1.用Dataset.element_spec查看一个elementde 的类型 (1 ) fit in a single componentimport tensorflow as tfimport pathlibimport matplotlib.pyplot as pltimport numpy as npdataset1 = tf.data.Dataset.from_tensor_slices(tf.random.uniform([4,10]))print(dataset1.eleme
2020-05-26 22:31:33
1111
原创 Dataset object 如何消耗数据三种方式:for/next/reduce
Dataset object 消耗数据的三种方式for 逐个元素输出创造一个Python iterator,用next 逐个消耗 **特别需要注意其用法使用reduce 一次性使用全部的元素==注意==for 逐个元素输出因为Dataset object is a Python iterable.import tensorflow as tfdataset = tf.data.Dataset.from_tensor_slices([8,3,0,8,2,1])print(dataset)for
2020-05-26 21:25:55
755
原创 zip() 将两个列表的对应元素组对,成为一个个元组
###testa = [5,6]b = [7,8]c = zip(a,b)for i in c: print(i)输出(5, 7)(6, 8)
2020-05-26 16:29:01
1857
原创 将特征与标签相结合成为数据集:form_tensor_slices() /tf.data.Dataset.zip两种方法
方法一 :将两个tensor结合起来import tensorflow as tf# two tensors can be combined into one Dataset object.# method1:features = tf.constant([[1,3],[2,1],[3,3]]) # 3*2 tensorlabels = tf.constant(['a','b','c']) # 3*1 tensor 这个表述很重要,知道tensor是怎么定义维度的print(features
2020-05-26 16:28:03
1131
原创 一维列表,二维列表,元组,字典制作数据集
一维列表import tensorflow as tf## for 1D tensor produce **scalar tensor elements**dataset = tf.data.Dataset.from_tensor_slices([1,2,3])print(type(dataset))for element in dataset: print(element)输出<class 'tensorflow.python.data.ops.dataset_ops.T
2020-05-26 15:54:52
1108
原创 tensorflow加载数据后数据的类型,tf.newaxis的使用
one# 将程序导入您的程序from __future__ import absolute_import,division,print_function,unicode_literalsimport tensorflow as tf#加载并准备MNIST数据集mnist = tf.keras.datasets.mnist(x_train,y_train),(x_test,y_test) = mnist.load_data()print(x_train[0])x_train,x_test =
2020-05-26 11:15:18
1042
原创 输出指定范围内的随机数random.random/ random.uniform
位置:F:\pyqt_practice\0514test_one_shot_training_sequencepy\testrandom.pyimport random # use venv virtual environment#***********************one test random.random()********************************************88# def random(self):# """Get the next
2020-05-17 17:15:12
584
原创 利用pycharm建立虚拟环境以及安装包
step onestep twostep three注意弄完后一定要关掉项目,重新启动一次,否则1.teminal 中显示的还是原本的环境,而不是新建立好的虚拟环境,弄了我很长时间都不知道哪里错了2.就算在界面中添加安装包,都好几次显示安装不成功。step four我选择在terminal 安装指定的包...
2020-05-15 12:09:55
3167
1
原创 subprocess应用验证与建立模板
位置:F:/pyqt_practice/test_one_shot_training_multi_region_py/code/testprocess.py注:usetotest.py 与testprocess.py 文件的相对位置是,两者处于同一个文件夹中。subprocess应用验证与建立模板==usetotest.py====用testprocess.py去进行验证====caseone====casetwo====casethree====casefour====casefive==综上所述:
2020-05-11 00:41:55
140
原创 验证cv2.imwrite以及np.save的覆盖性、创建文件夹
位置:f:/qyqt_practice/test/test_imwrite_npsave1.在同一个文件夹内多次imwrite同一个图片,是否会写入多个图片2.在不同文件夹内多从imwrote同一个图片,是否会写入多个图片3.在同一个文件夹内多次np.save同一个图片数据,是否会保存多个.npy文件4.在不同文件夹内多次np.save同一个图片数据,是否会保存多个.npy文件运行前:#这个Python文件是用来测试# 1.在同一个文件夹内多次imwrite同一个图片,是否会写入多个图片#
2020-05-09 18:03:42
6349
4
原创 以命令行形式打开Python文件,但是默认是记事本
one window系统的cmdpycharm 中的Terminalanaconda promt改变默认打开程雪
2020-05-06 10:23:20
2615
原创 argparse的简单使用及注意事项
此模块是受optparse启发的命令行解析库"""Command-line parsing libraryThis module is an optparse-inspired command-line parsing library that: - handles both optional and positional arguments - produces high...
2020-05-06 09:55:43
433
原创 one 信号连接 multiple信号
class Demo(QWidget): def __init__(self): super(Demo,self).__init__() self.label = QLabel('label') self.btn = QPushButton('button') # 一个信号与多个槽函数连接 self.btn.c...
2020-04-27 19:03:03
191
原创 a信号连接b信号,b信号连接槽函数
# a信号与b信号连接# 使得一个信号是间接触发槽函数,# #另一个信号仍然是直接触发槽函数, # #这里增加了信号与信号之间的联系以及先后顺序的问题,以及传递关系# 多个信号都与一个槽函数连接class Demo(QWidget): def __init__(self): super(Demo,self).__init__() self.lab...
2020-04-27 18:41:10
278
原创 multiple 信号 和 one 槽函数
class Demo(QWidget): def __init__(self): super(Demo,self).__init__() self.label = QLabel('label') self.btn = QPushButton('button') ## 连接函数 这里有两个信号 self.btn....
2020-04-27 18:19:16
192
原创 one信号连接one槽函数
class HaHa(QWidget): def __init__(self): super(Demo,self).__init__() self.resize(120,120) self.label = QLabel("label") self.btn = QPushButton('button') # 增加...
2020-04-27 17:48:41
174
原创 登录界面【username: password: log in : signin】
class Demo(QWidget): def __init__(self): super(Demo,self).__init__() self.user_line = QLineEdit() self.pwd_line = QLineEdit() self.btn_login = QPushButton("Log in ...
2020-04-27 16:34:48
2514
原创 登录界面网格结构
class Demo(QWidget): def __init__(self): super(Demo,self).__init__() self.username = QLabel("username:",self) self.user_line = QLineEdit() self.pwd = QLabel("passw...
2020-04-27 16:13:34
180
原创 登录界面 表格结构
#method1:class Demo(QWidget): def __init__(self): super(Demo,self).__init__() self.username = QLabel("username:",self) self.user_line = QLineEdit() self.pwd = QL...
2020-04-27 15:40:49
289
原创 布局嵌套
# 这里主要关注的是布局嵌套import sysfrom PyQt5.QtWidgets import QApplication,QWidget,QVBoxLayout,QHBoxLayout,QLabel,QLineEditclass Demo(QWidget): def __init__(self): super(Demo,self).__init__()...
2020-04-27 15:09:20
318
原创 查询Python2 以及Python3 关键字
python2(3)step1: 在终端输入pyhton(3)step2: help("keywords")如下图所示:
2020-04-26 22:56:02
140
原创 labelme 转换数据操作过程
labelme操作流程labelme 安装labelme 标注流程打开图片方法一:Open方法二:Open Dir图像放缩画图(注意要按时针顺序进行标注)保存图像labelme生成标注图像one:labelme 安装看前面的博客【数据标注labelme虚拟环境及安装】labelme 标注流程打开图片方法一:Openopen: 打开单张图片方法二:Open DirOpen Dir:...
2020-04-25 18:12:38
1693
2
原创 3.10【单张图片处理过程】
原本import globimport jsonimport osimport os.path as ospimport numpy as npimport PIL.Imageimport labelmeimport sysinput_dir = './cat_test/' # 里面是含有json文件所处的文件夹output_dir = 'data_dataset_voc' ...
2020-04-25 10:41:54
332
原创 3.4AttributeError: module 'labelme.utils' has no attribute 'label_colormap'
尝试一:conda activate labelpip uninstall labelmeconda install labelme -c conda-forge参考关于 -c conda-forge 的解释:linklink出现An HTTP error occurred when trying to retrieve this URL.HTTP errors are o...
2020-04-25 10:24:00
1338
原创 3.9 【AttributeError: module 'labelme.utils' has no attribute 'draw_label'】
origin:我的解决办法:输出draw.pyimport ioimport numpy as npimport PIL.Imageimport PIL.ImageDrawdef label_colormap(N=256): def bitget(byteval, idx): return ((byteval & (1 <<...
2020-04-25 10:20:35
1119
1
原创 3.5【分割路径名,提取文件名】
for label_file in glob.glob(osp.join(input_dir,'*json')): print(label_file) label_file = label_file.replace('\\','/') # 这里跟generateLab有出入 print("label_file:",label_file) print("type ...
2020-04-24 16:29:47
754
原创 3.3join与列表,元组的结合【可以用来将每个元素弄成一行一行的】
一、列表的情况test_list = ['1','2','3','4','5']test_list输出['1', '2', '3', '4', '5']二 、元组的情况test_tuple=('a','b','c','d','e')test_tuple输出('a', 'b', 'c', 'd', 'e')三、 写入txt文件 以tuple为例with open('...
2020-04-24 10:56:21
274
原创 3.2 【读取txt 文件中的每一行】(readlines, enumerate, strip,assert)
note:labels 变量是txt 文件的所在路径(可以是绝对路径,也可以是相对路径./.....)label.txt 文件中的内容为labels = './label.txt' # 文件的相对路径a = open(labels).readlines()print(a)输出['__ignore__\n', '__background__\n', 'cat']for i ,...
2020-04-24 01:17:36
931
原创 3.1【用来判断异常,若异常存在,退出系统的样例】检测是否已经存在文件夹,若存在,则系统退出
one 若output_dir 已经存在 exit(...) exit([status]) Exit the interpreter by raising SystemExit(status). If the status is omitted or None, it defaults to zero (i.e., suc...
2020-04-24 00:15:23
148
原创 The following packages are not available from the current channels:
conda install packagenameCollecting package metadata:doneSolving enviroment:failedPackagesNotFoundError: The following packages are not avaliable form current channels:packagename改为 pip install...
2020-04-23 13:25:53
996
原创 数据标注labelme虚拟环境及安装
step1:再anaconda中创建虚拟环境以专门用来做数据标注的环境打开anaconda promtconda info --envsconda create -n label python=3.7conda activate labelpip install labelme查看是否有labelme这个包conda list直接在label虚拟环境下【在prompt窗...
2020-04-15 13:24:47
1672
1
原创 在jupyter notebook 打开已经建立好了的虚拟环境
1.打开Anaconda Prompt,输入conda info -e2.输入conda activate name(name是你想切换的环境)3.conda install ipykernel 安装必要插件4.python -m ipykernel install --name Name 将环境添加到Jyputer中(Name是此环境显示在Jyputer中的名称,可自定义)原本jupyt...
2020-04-01 22:47:22
4041
1
原创 重新安装anaconda后能否将已有的虚拟环境放回安装后的envs文件夹且能检测出来?pycharm 能否用?
step1: 这是重新安装anaconda 中的envs 文件夹:空空如也step2:用anaconda查询,也只有base环境step3:所以重新安装anaconda后能够将已有的虚拟环境防护安装后的envs文件家中,且能检测出虚拟环境来。step4:之前:现在:验证是否能够使用这些虚拟环境:pycharm可以运行...
2020-04-01 16:54:01
6150
4
原创 保存好已建好的虚拟环境下重装Anaconda
step1:将虚拟环境文件envs 复制在别的盘。通过我的博客中【验证单独将特定虚拟环境文件夹单独放在别的盘,pycharm能否应用到虚拟环境】。step 2:为了保证如果step1中的envs 在我重装Anaconda后,虚拟环境运行不了了,我仍然可以根据每个环境中包的版本信息重新建立虚拟环境。因此我通过anaconda navigator 把所有虚拟环境所包含的包信息都截图保存。...
2020-04-01 15:49:52
3742
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅