download地址:http://pypi.python.org/packages/source/n/nose/nose-1.0.0.tar.gz#md5=47a4784c817afa6ef11a505b574584ed $ tar xzvf nose-1.0.0.tar.gz $ python setup.py install
在linux服务器安装nose: 运行命令 : easy_install nose或者使用 pip:pip install nose或者到官网https://pypi.python.org/ pypi/nose下载包, Ungzip、untar解压, cd到包所在的新目录, 运行:python setup.py install注意:用第三种方法无法使用第三方nose插件安装之后,运行nosetestcd 在windows系统下安装nose: 下载安装python https://www.python.org/downloads/windows/, 安装时勾选添加python所在目录到环境变量 setuptools, https://pypi.python.org/pypi/setuptools 解压,并在cmd中切换到该目录, 运行命令 python easy_install.py nose
二、nose2 nose2[21] 是 nose[22] 的继任者。它们的理念都是让编写和运行测试用例变得更容易。 nose2 则借助内建的 **import**()[23] 导入模块,并且是先全部载入,再执行用例 nose2 并不支持 nose 所支持的所有测试用例项目结构,比如如下用例文件的结构在 nose2 中就不受支持 nose2 则不支持包级别的测试前置和清理函数 子测试 nose2 除了支持使用测试生成器来实现子测试外,还支持使用参数化测试(Parameterized tests)[24]来实现子测试 nose2 nose 和 nose2 在用例编写、测试夹具、子测试上做出改进,已经能让日常用例编写工作变得更加容易和灵活。 /ionelmc/nose-htmloutput [21]nose2: https://github.com/nose-devs/nose2 [22]nose: https://nose.readthedocs.io
今天我要带大家一起探索nose2的魅力,从安装到高级用法,手把手教你用这个强大的工具武装自己的代码!nose2是什么?nose2是Python单元测试框架的"下一代",它是nose测试框架的继任者。 基于unittest2构建,保留了nose灵活性的同时,提供了更可靠的测试发现和执行功能。与原始的nose相比,nose2有更清晰的架构和更好的插件系统。 为什么选择nose2?你可能会问:已经有unittest和pytest了,为什么还要学nose2? 不需要任何额外配置,nose2就能找到并执行你的测试!nose2的测试发现机制nose2如何找到测试? 这篇教程介绍了nose2的基础使用方法和一些高级特性,但nose2的功能远不止于此。随着你对测试的深入理解,你会发现nose2提供了满足各种测试需求的工具和选项。
#md5=46782809578c8fd29912c124d2420842 $ tar xzvf coverage-3.4.tar.gz $ python setup.py install 3 安装nose download地址: http://pypi.python.org/packages/source/n/nose/nose-1.0.0.tar.gz #md5=47a4784c817afa6ef11a505b574584ed $ tar xzvf nose-1.0.0.tar.gz $ python setup.py install 4:测试安装结果,直接执行nosetests命令即可
# 在端口5000上以调试模式运行应用程序 if __name__ == "__main__": app.debug = True app.run(port=5000) 后,我们使用Nose 运行单元测试通过发出以下命令,Nose将遍历我们的单元测试文件,找到所有 TestCase对象并执行每个以test_为前缀的方法 : nosetests - v test_app 。 Conference is not Rob's Blog Party, instead found: %s" % dial_children[0].text) 现在使用Nose Conference is not Rob's Blog Party, instead found: %s" % dial_children[0].text) 完美–让我们使用Nose 我们编写了一个快速的会议应用程序,使用Nose对它进行了测试,然后将这些测试重构为可以与所有应用程序一起使用的通用案例。
格式类别顺序不和这个对应,而以labels文件夹classes.txt为准):["drink","eat","fight","investigating","jumpontopof","lying","nose-poke-elsewhere ","nose-to-nose","other","playwithtoy","run","sitting","sleep","standing","walk"]每个类别标注的框数:drink 框数 = 409eat 框数 = 3738fight 框数 = 506investigating 框数 = 6915jumpontopof 框数 = 6lying 框数 = 2760nose-poke-elsewhere 框数 = 43nose-to-nose 框数 = 551other 框数 = 2playwithtoy 框数 = 92run 框数 = 108sitting 框数 = 394sleep 框数 = 8356standing
'nose_contour_right1']['x'], res['nose_contour_right1']['y']], [res['nose_contour_right2 ']['y']], [res['nose_left']['x'], res['nose_left']['y']], [res['nose_right ']['x'], res['nose_bridge1']['y']], [res['nose_bridge2']['x'], res['nose_bridge2']['y ']], [res['nose_bridge3']['x'], res['nose_bridge3']['y']], [res['nose_tip ']['x'], res['nose_tip']['y']], [res['nose_left_contour1']['x'], res['nose_left_contour1
nose是Python的一个第三方单元测试框架。 这意味着,如果要使用nose,需要先显式安装它: >pip install nose Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: nose in d:\python3\lib\site-packages (1.3.7) 简单的例子: import nose def () 运行结果: 温馨提示: nose已经进入维护模式,从github (https://github.com/nose-devs/nose/commits/master)上可以看到,nose最近的一次代码提交还是在 继承nose的是nose2,但要注意的是,nose2并不支持nose的全部功能,它们的区别可以参见: https://nose2.readthedocs.io/en/latest/differences.html
nose_position_h = left_distance/(left_distance+right_distance) nose_position_v = nose_point[ 0][1]-cheek_points[0][1] # 获得鼻子和脸颊定位点的高度相对值,以此作为抬头/低头的判断 return nose_position_h, nose_position_v , nose_position_v = self.get_nose_distance(face_landmark) # 转换成摄像头可显示的格式 img_rgb # 获取头部运动数据,并控制飞机 nose_position_h, nose_position_v, lips_distance = head_post.classify_pose(video=generate_image ) #print(nose_position_h, nose_position_v, lips_distance) # 该语句用来查看评估参数如何设计 if nose_position_h < 0.22
= t.xcor() y_nose = t.ycor() t.circle(30, 62) # 8 t.circle(200, 15) # 9 # 【鼻子】 t.pu() #penup t.goto (x_nose, y_nose + 25) t.seth(90) t.pd() t.begin_fill() t.circle(8) t.end_fill() # 【眼睛】 t.pu() t.goto( x_nose + 48, y_nose + 55) t.seth(90) t.pd() t.begin_fill() t.circle(8) t.end_fill() # 【耳朵】 t.pu() t.color ('#444444') t.goto(x_nose + 100, y_nose + 110) t.seth(182) t.pd() t.circle(15, 45) t.color('black') () t.goto(x_nose + 314, y_nose - 125) t.pd() t.seth(-95) t.fd(25) t.circle(-5, 150) t.fd(2) t.hideturtle
= parser.has("nose") ? \n" "\t-nose=<nose_cascade> : Specify the haarcascade classifier for nose detection. and nose in image.jpg. nose_cascade.empty()) { vector<Rect_<int> > nose; detectNose(ROI, nose nose_cascade.empty()) nose_cascade.detectMultiScale(img, nose, 1.20, 5, 0|CASCADE_SCALE_IMAGE
比如: 键 nose_bridge 表示鼻梁 键 chin 表示脸颊 我们需要根据每个 face_landmark,给对应的头像戴上口罩。 获得鼻子和脸颊的特征点 import numpy as np nose_bridge = face_landmark['nose_bridge'] nose_point = nose_bridge[len (nose_bridge) * 1 // 4] nose_v = np.array(nose_point) chin = face_landmark['chin'] chin_len = len(chin [0] - nose_point[0]) rotated_mask_img = mask_img.rotate(angle, expand=True) # calculate mask location center_x = (nose_point[0] + chin_bottom_point[0]) // 2 center_y = (nose_point[1] + chin_bottom_point
假设在应用场景中要求人员从左往右横排站立,最多检出3人,我们则可以通过人体中的鼻子关键点(nose)进行定位,nose点的x小于屏幕宽度33%则为左,大于33%小于66%则为中,大于66%则为右,代码调整如下 = hu.keypoints.find(x => x.name == 'nose');if (! nose)return false;//人体结构中的坐标为相机图像中的坐标,计算出在屏幕中的渲染坐标let x = nose.x * that.previewRate + that.previewOffsetX = hu.keypoints.find(x => x.name == 'nose');if (! nose)return false;//人体结构中的坐标为相机图像中的坐标,计算出在屏幕中的渲染坐标let x = nose.x * that.previewRate + that.previewOffsetX
工具 下载https://pypi.python.org/pypi/distribute/0.7.3 unzip解压 进入目录下执行: sudo python setup.py install 三、nose 工具 安装说明:http://nose.readthedocs.org/en/latest/ sudo easy_install nose 获取帮助 nosetests -h 四、virtualenv 链接: pip from http://pypi.python.org/pypi/pip distribute from http://pypi.python.org/pypi/distribute nose from http://pypi.python.org/pypi/nose/ virtualenv from http://pypi.python.org/pypi/virtualenv
nose_cascade.load( nose_cascade_name ) ){ printf("--(!) std::vector<Rect> nose; nose_cascade.detectMultiScale( faceROI, nose, 1.1, 2, 0 |CASCADE_SCALE_IMAGE , Size(30, 30) ); for ( size_t j = 0; j < nose.size(); j++ ) { Point nose_center( faces[i].x + nose[j].x + nose[j].width/2, faces[i].y + nose[j].y + nose[j].height/2 ); int radius = cvRound( (nose[j].width + nose[j].height)*0.25 ); circle( frame, nose_center, radius, Scalar( 0, 255, 0 ),
比如: 键 nose_bridge 表示鼻梁 键 chin 表示脸颊 我们需要根据每个 face_landmark,给对应的头像戴上口罩。 获得鼻子和脸颊的特征点 import numpy as np nose_bridge = face_landmark['nose_bridge'] nose_point = nose_bridge[len (nose_bridge) * 1 // 4] nose_v = np.array(nose_point) chin = face_landmark['chin'] chin_len = len(chin [0] - nose_point[0]) rotated_mask_img = mask_img.rotate(angle, expand=True) # calculate mask location center_x = (nose_point[0] + chin_bottom_point[0]) // 2 center_y = (nose_point[1] + chin_bottom_point
二、用例编写 同 nose 一样,pytest 支持函数、测试类形式的测试用例。 三、用例发现和执行 unittest 和 nose 所支持的用例发现和执行能力,pytest 均支持。 、nose2的风格迥异,它不但能实现 setUp 和 tearDown这种测试前置和清理逻辑,还其他非常多强大的功能。 我们不妨罗列一个横向对比表,来总结下这些单元测试框架的异同: unittest nose nose2 pytest 自动发现用例 ✔ ✔ ✔ ✔ 指定(各级别)用例执行 ✔ ✔ ✔ ✔ 支持 assert 甚至,连 nose2 在官方文档[18]上都建议大家使用 pytest,这得是多大的敬佩呀!
nose - to - nose(鼻对鼻):识别猪只之间的这种互动行为,有助于了解猪只的社交关系和群体动态。 nose-to-nose other playwithtoy run sitting sleep standing walk 【训练数据集介绍】 数据集格式:Pascal VOC格式+YOLO格式 ","nose-to-nose","other","playwithtoy","run","sitting","sleep","standing","walk"] 每个类别标注的框数: drink 框数 框数 = 43 nose-to-nose 框数 = 551 other 框数 = 2 playwithtoy 框数 = 92 run 框数 = 108 sitting 框数 = 394 sleep 框数 1 1 0.862 1 0.995 0.796 nose-to-nose 18 33 0.959 0.97 0.983 0.893 other 1 1 1 0 0.995 0.895 playwithtoy
================================================== 那么,在这些工作做完之后,还需要知道:如果想要使用在PyGraphics包中的测试,必须下载并安装Nose 包,此时不需要另外找Nose包下载了,直接利用cmd。 说明:打开cmd进入命令提示行,电脑要联网的,在命令提示行中输入 C:\Python27\Scripts\easy_install nose 回车(如果一刚开始你的Python安装路径不是这个,亲,卸了重装吧啊啊 ,此时会自动下载,即Nose会自动安装完成。 下载过程见图; 在IDLE中再试一下 >>>import media 不会再报错。