
python
Lwang2018
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【python学习笔记】Python中*args 和**kwargs的用法
多个实参,放到一个元组里面,以*开头,可以传多个参数;**是形参中按照关键字传值把多余的传值以字典的方式呈现*args:(表示的就是将实参中按照位置传值,多出来的值都给args,且以元祖的方式呈现)示例def foo(x,*args): print(x) print(args) foo(1,2,3,4,5)#其中的2,3,4,5都给了args结果1(2, 3, 4...原创 2019-01-21 14:49:26 · 649 阅读 · 0 评论 -
AttributeError: module 'types' has no attribute 'FileType'
在使用parallel python的时候报错File “/usr/local/lib/python3.5/dist-packages/pptransport.py”, line 120, in initif isinstance(r, types.FileType) and isinstance(w, types.FileType):AttributeError: module ‘type...原创 2019-01-20 16:41:39 · 4177 阅读 · 0 评论 -
python中的__init__()和__call__()
在python中,int()函数的意义等同于类的构造器(同理,del()等同于类的析构函数)。因此,init()方法的作用是创建一个类的实例。class Flower(object): def __init__(self,color): self.color = color print('color is', color) rose = Flower(...原创 2019-03-04 10:10:46 · 782 阅读 · 2 评论 -
python读取hdr格式的医学图片
最近参加iSeg2019的比赛,拿到的数据是hdr格式的,每组数据组包含2个文件,一个为数据文件,其扩展名为.img,包含二进制的图像资料;另外一个为头文件,扩展名为.hdr,包含图像的元数据。使用nibabel 读取,然后用simpleitk保存为nii文件import nibabel as nibimport SimpleITK as itkimg_path = ...save_pa...原创 2019-08-15 11:47:48 · 3661 阅读 · 16 评论 -
关于numpy一些函数的用法
np.newaxisnp.newaxis的作用就是选取部分的数据增加一个维度比如我原来的三维nii数据维数是(128,128,96)input_x = nib.load(os.path.join(img_path, img_name)).get_data() #读取nii文件x_batch = input_x[np.newaxis, :, :, :, np.newaxis]print...原创 2019-08-13 09:46:27 · 465 阅读 · 0 评论 -
tensorflow: 模型恢复及使用模型进行测试
tensorflow模型选择采用ckpt文件格式进行保存的时候,会有四个文件:checkpoint3D_unet18001.ckpt.meta3D_unet18001.ckpt.index3D_unet18001.ckpt.data-00000-of-00001把这四个看做一个整体即可,不用单独处理。aim_shape = (128,128,96)def prediction(m...原创 2019-08-13 10:02:47 · 549 阅读 · 0 评论 -
Python map() 函数 zip()函数
map()函数:map() 会根据提供的函数对指定序列做映射。第一个参数 function 以参数序列中的每一个元素调用 function 函数,返回包含每次 function 函数返回值的新列表。map() 函数语法:map(function, iterable, ...)function – 函数iterable – 一个或多个序列实例:>>> map(la...原创 2019-08-22 19:24:42 · 254 阅读 · 0 评论