DeepMind Lab的一些python例子—————(Ubuntu22.04系统安装DeepMind Lab)后续

相关资料:

Ubuntu22.04系统安装DeepMind Lab

 

 

======================================================

 

 

 

关于DeepMind Lab的安装见前文:

Ubuntu22.04系统安装DeepMind Lab

 
DeepMind Lab的python文档:
 
 
复制代码
import deepmind_lab
import numpy as np

# Create a new environment object.
lab = deepmind_lab.Lab("demos/extra_entities", ['RGB_INTERLEAVED'],
                       {'fps': '30', 'width': '80', 'height': '60'})
lab.reset(seed=1)

# Execute 100 walk-forward steps and sum the returned rewards from each step.
print(sum([lab.step(np.array([0,0,0,1,0,0,0], dtype=np.intc)) for i in range(0, 100)]))
复制代码

 

 

 

复制代码
import deepmind_lab
import numpy as np

# Construct and start the environment.
env = deepmind_lab.Lab('seekavoid_arena_01', ['RGB_INTERLEAVED'])
env.reset()

# Create all-zeros vector for actions.
action = np.zeros([7], dtype=np.intc)

# Advance the environment 4 frames while executing the all-zeros action.
reward = env.step(action, num_steps=4)

# Retrieve the observations of the environment in its new state.
obs = env.observations()  # dict of Numpy arrays
rgb_i = obs['RGB_INTERLEAVED']
assert rgb_i.shape == (240, 320, 3)
复制代码

 

 

 

import deepmind_lab
import pprint

env = deepmind_lab.Lab('seekavoid_arena_01', [])
observation_spec = env.observation_spec()
pprint.pprint(observation_spec)

 

 

 

===========================================================

 

 

Actions的说明:

https://github.com/deepmind/lab/blob/master/docs/users/actions.md

 

 

 Look left/right and up/down values are in the units 'pixels' and are the number of pixels the mouse would move running at 640x480 at 60 frames per second. (With default mouse speed etc.) (A value of about 57 will rotate the player 360 degrees in one second of game time.)

 

 

 

 

 

 

===========================================

 

 

 

Observations说明:

https://github.com/deepmind/lab/blob/master/docs/users/observations.md

 

 

 

 

===========================================

 

posted on   Angry_Panda  阅读(79)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· 因为Apifox不支持离线,我果断选择了Apipost!

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示