PYTHON
cvml
这个作者很懒,什么都没留下…
展开
-
anaconda opencv环境配置
我的电脑是win7 64位,故下载的是anaconda 2.7 64,搭配opencv 2.4.11,在配置的时候,本来想用conda install -c https://conda.binstar.org/menpo opencv 但是这条指令太慢了,于是就访问了https://conda.binstar.org/menpo这个网址,用我大迅雷下载了opencv2.4.11,下载完之后原创 2016-10-22 14:56:17 · 2263 阅读 · 0 评论 -
python numpy 大数组显示不全,解决方案
import numpy as np np.set_printoptions(threshold=np.inf) 或者 np.set_printoptions(threshold='nan')其中threshold表示: Total number of array elements to be print(输出数组的元素数目)...原创 2018-06-12 19:30:06 · 25070 阅读 · 3 评论 -
#coding=utf-8 只能放在第1,2行
#coding=utf-81.只能放在第1,2行中比如在第3行 程序就出错了,其他编码方式也一样。2.#coding = utf-8 会出问题,中间不能有空格:正确的是: #coding=utf-8转自 https://blog.csdn.net/leejearl/article/details/7302091...转载 2018-06-25 17:15:54 · 1985 阅读 · 1 评论 -
mxnet 符号式与命令式
命令式:Numpy, Matlab, Torch,优点在于 Straight-forward. Easy to view the middle level resultsimport mxnet.ndarray as nda = nd.ones((4,4))b = nd.ones((4,4))c = a + bprint(c.asnumpy())符号式: Tensorflow, The...原创 2018-06-27 17:40:38 · 364 阅读 · 0 评论 -
python argparse - _
python argparse中在python程序中是lr-steps,然而程序下面是args.lr_steps,要注意原创 2018-07-10 16:18:33 · 140 阅读 · 0 评论 -
ubuntu 升级python 2.7.14
sudo add-apt-repository ppa:jonathonf/python-2.7sudo apt-get updatesudo apt-get install python2.7python --version原创 2018-07-05 11:56:15 · 1771 阅读 · 0 评论 -
python __call__()
python中 所有的函数都是可调用对象。一个类实例也可以变成一个可调用对象,只需要实现一个特殊方法__call__()。class RandomErasing(object): """ Randomly selects a rectangle region in an image and erases its pixels. 'Random Erasing D...原创 2018-08-14 10:28:35 · 416 阅读 · 0 评论 -
python 求两个list的相同的元素
#coding=utf-8file1=open("/home/xgx/back_data/back_total.list")file2=open("/home/xgx/back_data/mingzhang4/back_plate_image_list_train.list")plate1=[]plate2=[]for file3 in file1: file4=file3.st...原创 2018-08-11 14:10:38 · 2408 阅读 · 0 评论 -
python 求向量模长(一范二范)
import numpy as npx = np.array([1,2,3,4,5])np.linalg.norm(x) 默认为2范数,下面是一范数np.linalg.norm(x,ord=1)原创 2018-09-05 17:07:36 · 72656 阅读 · 0 评论 -
python通配符之glob模块
通配符是一些特殊符号,主要有星号(*)和问号(?),用来模糊搜索文件,“*”可以匹配任意个数个符号, “?”可以匹配单个字符。当查找文件夹时,可以使用它来代替一个或多个真正字符;当不知道真正字符或者需要匹配符合一定条件的多个目标文件时,可以使用通配符代替一个或多个真正的字符。 英文 “globbing”意为统配,python在模块glob中定义了glob()函数,实现了对目录内容进行匹配的...原创 2018-10-03 15:09:26 · 462 阅读 · 0 评论 -
度量python的运行时间
1. time python demo.py2.在脚本中用time.time()原创 2018-10-04 11:17:55 · 512 阅读 · 0 评论 -
python过滤警告和print函数
不显示警告信息,在开头添加 import warnings warnings.filterwarnings("ignore")在开头加上from __future__ import print_function这句之后,即使在python2.X,使用print就得像python3.X那样加括号使用,不加括号就会报错 ...原创 2018-10-04 12:12:49 · 2838 阅读 · 0 评论 -
python 笔记
ccc原创 2018-05-27 11:35:24 · 293 阅读 · 0 评论 -
Python调用C++
12345678/***gcc -o libpycall.so -shared -fPIC pycall.c*/ #include <stdio.h> #include <stdlib.h> int foo(int a, int b) { printf("you input %d and %d\n", a, b); return a+b; } Python调用动态...转载 2018-05-26 14:31:33 · 446 阅读 · 0 评论 -
python 库大全
转自:https://www.zhihu.com/question/24590883/answer/92420471原文链接:Python 资源大全GitHub - jobbole/awesome-python-cn: Python资源大全中文版环境管理管理 Python 版本和环境的工具p – 非常简单的交互式 python 版本管理工具。pyenv – 简单的 Py转载 2016-10-19 14:54:10 · 1182 阅读 · 0 评论 -
python 中文注释
# -*- coding: utf-8 -*-原创 2017-01-23 11:41:54 · 207 阅读 · 0 评论 -
ubuntu anaconda python 安装opencv
正常情况下,安装opencv都是通过conda install 来安装的,可是奈何网速太慢,经过google,发现了一个有用的方法,把opencv安装目录下的cv2.so拷贝到python的site-packages/中, cv2.so通常在编译的lib文件夹下如果是anaconda,请拷贝至~/anaconda2/lib/python2.7/site-packages中;如果是系统的原创 2017-05-11 15:27:54 · 703 阅读 · 0 评论 -
python 创建txt文件
python 创建txt文件,跟打开一样,没有则创建新的import sysimport os file=open("a.txt","a")原创 2017-08-29 20:45:44 · 21617 阅读 · 0 评论 -
pycharm 安装
(1) Copy the pycharm-*.tar.gz to the desired installation location (make sure you have rw permissions for that directory)$ cd Downloads/(2)Unpack the pycharm-*.tar.gz using the following comma转载 2017-09-19 14:34:16 · 523 阅读 · 1 评论 -
python 不可与自带模块重名
如命名一个文件为os.py,会发生想象不到的错误原创 2017-11-15 11:12:16 · 1214 阅读 · 0 评论 -
python os.listdir与os.walk
情况1:在一个目录下面只有文件,没有文件夹,这个时候可以使用os.listdirimport ospath = r'C:\Users\Administrator\Desktop\file'for filename in os.listdir(path): print(os.path.join(path,filename))情况2:递归的情况,一个目录下面既有目录(目录下转载 2017-11-15 11:37:50 · 848 阅读 · 0 评论 -
python opencv 获取图片的宽 高 深度
使用shape来获取图片的宽高深度import cv2import numpy as npfn="baboon.jpg"if __name__ == '__main__': print 'load %s as ...' % fn img = cv2.imread(fn) sp = img.shape print sp sz1 = sp[0]#he原创 2017-11-15 11:49:46 · 45686 阅读 · 2 评论 -
Python生成PASCAL VOC格式的xml标注文件
PASCAL VOC数据集的标注文件是xml格式的。对于py-faster-rcnn 或者ssd,通常以下示例的字段是合适的:annotation> folder>GTSDBfolder> filename>000001.jpgfilename> size> width>500width> height>375height> depth>3depth>转载 2017-11-15 11:52:15 · 2213 阅读 · 0 评论 -
python 中文注释 报错 SyntaxError: Non-ASCII character '\xe5'
在文件首行加上 #coding=utf-8,就可以添加中文注释了原创 2017-12-06 09:00:51 · 816 阅读 · 0 评论 -
python读取caffemodel
#coding=utf-8import caffeif __name__ == "__main__": #文件的存放路径 root = '/home/xgx/Downloads/resnet-protofiles/' caffe.set_mode_cpu net = caffe.Net(root+'ResNet_101_deploy.prototxt原创 2017-12-06 17:54:18 · 617 阅读 · 0 评论 -
python super机制
要理解 super 就得知道 Python 的 MRO, super 的工作是找出 MRO 中的下一个类,它的设计目的是用来解决多重继承时父类的查找问题,所以在单重继承中用不用 super 都没关系,但是使用 super 是一个好的习惯。一般我们在子类中需要调用父类的方法时才会这么用 ...原创 2018-10-05 14:07:55 · 375 阅读 · 0 评论