当前位置: 首页 > news >正文

代理网站地址黑山网站建设

代理网站地址,黑山网站建设,上海网站建设哪家便宜,中卫网站推广网络营销一、安装和入门 1.1 AI2-THOR使用要求 操作系统: Mac OS X 10.9, Ubuntu 14.04显卡:DX9(着色器型号 3.0)或 DX11,功能级别为 9.3。CPU:支持 SSE2 指令集。Python 2.7 或 Python 3.5Linux 用户…

一、安装和入门

1.1 AI2-THOR使用要求

  • 操作系统: Mac OS X 10.9+, Ubuntu 14.04+
  • 显卡:DX9(着色器型号 3.0)或 DX11,功能级别为 9.3。
  • CPU:支持 SSE2 指令集。
  • Python 2.7 或 Python 3.5+
  • Linux 用户:启用了 GLX 模块的 X 服务器

1.2 使用 pip 安装

  您可以使用 pip 安装 AI2-THOR。创建 Python 2.7/3.5/3.6 虚拟环境,

conda create -n ai2thor_env python=3.6

  然后进入虚拟环境

conda activate ai2thor_env

  然后安装ai2thor

pip install ai2thor

  在运行以下代码之前,请确保正在运行带有 OpenGL 的 X 服务器,并且已为您的显卡安装了 OpenGL 扩展。

import ai2thor.controller
controller = ai2thor.controller.Controller()
controller.start()

  第一次使用控制器时,包含 3D 场景的游戏环境将被下载到 $HOME/.ai2thor。二进制文件的大小约为 500MB。

二、概念

  • Agent: 胶囊形状的实体,可在场景中导航并与物体互动。

  • Scene: AI2-THOR 中的场景代表一个虚拟房间,代理可以在其中导航并与之互动。有 4 个场景类别,每个类别有 30 个独特的场景: 厨房、起居室、卧室、浴室。

  • Action: 让代理在场景中执行的离散命令(例如,向前移动、向右旋转、拾取对象)

  • Sim Object: 可以与代理互动的对象。根据 “对象类型”(Object Type)所定义的 “承受能力”(affordanced),"对象 "具有一系列交互功能。

  • Object Visibility: 当一个对象满足三个条件时,它就被认为是可见的: 它必须位于摄像机的视口内,必须与 Agent 的中心距离在一个阈值范围内(默认值:1.5 米),并且从摄像机发射的光线必须在不首先击中其他障碍物的情况下击中该对象。请注意,图像中渲染的物体并不总是对 Agent 可见。例如,1.5 米阈值之外的物体可以在图像中看到,但对 Agent 来说将被报告为不可见。

  • Object Interactability: 如果一个物体被标记为可见,并且没有任何其他物体遮挡,那么这个物体就是可交互的。大多数对象只要也是可见的,就是可交互的,但有些对象是透明的,这可能会导致对象被报告为透过它们是可见的。例如,玻璃淋浴门后面有一个海绵物体。玻璃门将被标记为 "可见 "和 “可交互”,但海绵仅为 “可见”。如果试图与海绵进行交互,就会出现错误,因为无法通过玻璃门接触到海绵,只能看到海绵。

  • Receptacle: 一种可以容纳另一个物体的物体。例如 桌面、杯子、沙发、床、桌子、碗等。有些容器无法在场景中移动,它们大多是无法移动的大型物体(台面、水槽等)。有些收纳盒还可以打开和关闭(微波炉、橱柜、抽屉等),而有些收纳盒还可以被代理拿起来移动(盘子、碗、盒子等)。

三、示例

  我们提供了一些示例来展示如何使用 AI2-THOR。

3.1 简单示例

  一个简单的示例,将代理向前移动一步并返回相应的图像和元数据。

import ai2thor.controller
controller = ai2thor.controller.Controller()
controller.start()# Kitchens: FloorPlan1 - FloorPlan30
# Living rooms: FloorPlan201 - FloorPlan230
# Bedrooms: FloorPlan301 - FloorPlan330
# Bathrooms: FloorPLan401 - FloorPlan430controller.reset('FloorPlan28')
controller.step(dict(action='Initialize', gridSize=0.25))event = controller.step(dict(action='MoveAhead'))# Numpy Array - shape (width, height, channels), channels are in RGB order
event.frame# Numpy Array in BGR order suitable for use with OpenCV
event.cv2image()# current metadata dictionary that includes the state of the scene
event.metadata

3.2 调用复杂操作的示例

  拿起杯子, 打开微波炉, 把杯子放在微波炉里

  要拾取对象,代理必须首先导航到有可拾取/可见对象的区域。通常,它应该通过一系列 MoveAhead、RotateLeft、RotateRight 命令来完成。在这里,我们直接传送到一个已知的位置,那里有一个杯子。

import ai2thor.controller
controller = ai2thor.controller.Controller()
controller.start()controller.reset('FloorPlan28')
controller.step(dict(action='Initialize', gridSize=0.25))controller.step(dict(action='Teleport', x=-2.5, y=0.900998235, z=-3.0))
controller.step(dict(action='LookDown'))
event = controller.step(dict(action='Rotate', rotation=180))
# In FloorPlan28, the agent should now be looking at a mug
for o in event.metadata['objects']:if o['visible'] and o['pickupable'] and o['objectType'] == 'Mug':event = controller.step(dict(action='PickupObject', objectId=o['objectId']), raise_for_failure=True)mug_object_id = o['objectId']break# the agent now has the Mug in its inventory
# to put it into the Microwave, we need to open the microwave firstevent = controller.step(dict(action='LookUp'))
event = controller.step(dict(action='RotateLeft'))event = controller.step(dict(action='MoveLeft'))
event = controller.step(dict(action='MoveLeft'))
event = controller.step(dict(action='MoveLeft'))
event = controller.step(dict(action='MoveLeft'))event = controller.step(dict(action='MoveAhead'))
event = controller.step(dict(action='MoveAhead'))
event = controller.step(dict(action='MoveAhead'))
event = controller.step(dict(action='MoveAhead'))
event = controller.step(dict(action='MoveAhead'))
event = controller.step(dict(action='MoveAhead'))for o in event.metadata['objects']:if o['visible'] and o['openable'] and o['objectType'] == 'Microwave':event = controller.step(dict(action='OpenObject', objectId=o['objectId']), raise_for_failure=True)receptacle_object_id = o['objectId']breakevent = controller.step(dict(action='PutObject',receptacleObjectId=receptacle_object_id,objectId=mug_object_id), raise_for_failure=True)# close the microwave
event = controller.step(dict(action='CloseObject',objectId=receptacle_object_id), raise_for_failure=True)

3.3 多智能体示例

  此示例说明如何在多代理设置中运行 AI2-THOR。

import ai2thor.controller
controller = ai2thor.controller.Controller()
controller.start()# agentCount specifies the number of agents in a scene
multi_agent_event = controller.step(dict(action='Initialize', gridSize=0.25, agentCount=2))# print out agentIds
for e in mult_agent_event.events:print(e.metadata['agentId'])# move the second agent ahead, agents are 0-indexed
multi_agent_event = controller.step(dict(action='MoveAhead', agentId=1)) 

3.4 多线程示例

  此示例演示如何以多线程方式运行代理的多个实例。

mport threading
import time
import ai2thor.controllerthread_count = 8def run():controller = ai2thor.controller.Controller()controller.start()# 100 is an arbritary numberfor _ in range(100):t_start = time.time()controller.reset('FloorPlan1')controller.step({'action' : 'Initialize', 'gridSize' : 0.25})print('init time', time.time() - t_start)t_start_total = time.time()for _ in range(10):controller.step({'action' : 'MoveAhead'})controller.step({'action' : 'RotateRight'})total_time = time.time() - t_start_totalprint('total time', total_time, 20 / total_time, 'fps')threads = [threading.Thread(target=run) for _ in range(thread_count)]
for t in threads:t.daemon = Truet.start()time.sleep(1)for t in threads:# calling join() in a loop/timeout to allow for Python 2.7# to be interrupted with SIGINTwhile t.isAlive():t.join(1)print('done')

3.5 一个示例结果

在这里插入图片描述

参考文献

[1] https://allenai.github.io/ai2thor-v2.1.0-documentation/installation#

[2] https://ai2thor.allenai.org/

http://www.yayakq.cn/news/314890/

相关文章:

  • 淘宝美工做兼职的网站小说网站建设目的
  • 365房产南京网站网站建设技术咨询协议
  • 网站建设丷金手指专业十五摄影师都在哪些网站发布作品
  • 南宁电子商务网站建设西部数码成品网站
  • wordpress.htmlseo优化排名工具
  • 网站建设实例手机wordpress登陆
  • 做网站公司还有没有活路mysql asp网站
  • 做网站有必要?dede古风类网站源码
  • 内蒙古生产建设兵团四师三十四团知青网站做公众号的公司是什么公司
  • 网站301多久网站开发验收规范
  • 网站源码44444kt好听的公司名字大全集
  • 做网站需要多钱网站建设公司普遍存在劣势
  • 关于加强内网网站建设的通知建设部网站官网四库一平台
  • 代码重构网站网站页面图片尺寸
  • 石家庄网站建设规划北京房地产开发商排名
  • 做图客网站手机建网站详细步骤
  • 青岛高端网站开发公司如何建立自己生活网站
  • ppt模板免费下载网站 知乎佛山网络推广培训
  • 服务范围 网站建设公司小程序致美发型设计
  • 高端网站建设谷美网站建设需准备什么
  • 云渲染网站开发网站定制论坛
  • 长尾关键词挖掘网站基于html5开发的网站开发
  • 做装修网站好赚钱吗wordpress特定账户注册
  • 网站建设图片居中代码江北区网站建设
  • 苏州企业网站建设设计制作公司免费软件app有哪些
  • 网站制作 商务东莞市住房建设局网站首页
  • 德州建设小学网站山西做二级建筑资料在哪个网站
  • 网站建设与优化网站开发的目的 实习报告
  • 建筑公司网站需求wordpress创建文档系统
  • iis7.5部署网站济宁百度竞价推广