A recorder for open ai gym. you can easily add a text on the frame
Project description
gym_recorder
A recorder for open ai gym.
you can easily add a text on the frame like this.
install
pip install gym_record
usage
import gym
from gym_recorder import Recorder
src_env = gym.make("CartPole-v1")
env = Recorder(src_env, episode_num=10)
for ep in range(10):
obs = env.reset()
done = False
while not done:
action = env.action_space.sample()
n_obs, reward, done, info = env.step(action)
env.txtqueue.append(f"episode:{ep}")
env.txtqueue.append(f"obs:{obs}")
env.txtqueue.append(f"action:{action}")
env.txtqueue.append(f"reward:{reward}")
env.txtqueue.append(f"next obs:{n_obs}")
tips
this library depends on opencv-python. so you may need some library to use opencv. this is .Dockerfile example to resolve it.
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y libgl1-mesa-dev
if you use docker, you have to set "SDL_VIDEODRIVER" to "dummy".
add this to your .Dockerfile
ENV SDL_VIDEODRIVER=dummy
or simply add this to your script.
import os
os.environ["SDL_VIDEODRIVER"] = "dummy"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gym-record-0.0.2.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file gym-record-0.0.2.tar.gz
.
File metadata
- Download URL: gym-record-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aa699aeccdea2c2f89cb91fe1a6b7587856d93375189928893ec58ecd5aa5ce |
|
MD5 | 391e9cf1f5fdcbe1843dae475a368703 |
|
BLAKE2b-256 | b0299eff31ddaf646de7dfb24efcb560ca04fce33b198c1e8e5db76529550661 |
File details
Details for the file gym_record-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: gym_record-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd5f41b5a960f9e941bb8b1fc628d4c3f138a4e1d9a2f531c71ab1ff3bdb53d0 |
|
MD5 | 744990e1200f8a89944d318c6ba2b8d8 |
|
BLAKE2b-256 | cb3eeec9398df8833340f8de98b4d315fb01a915e20b651866ce70967dc051c4 |