Skip to main content

Gym Distractions

PyPI codecov

This package provides a number of distractions that can be added to pixel based gym environments. It directly includes the creation of MuJoCo Environments with these distractions.

Installation

Release install from pypi

pip install gym-distractions

Installation of latest from GIT Repository

pip install -e git+https://github.com/sebimarkgraf/gym-distractions.git

Using MuJoCo Environments

Use the MuJoCo environments by importing it and using the make() method.

import gym_distractions

env = gym_distractions.make(domain_name,
                    task_name,
                    distract_type,
                    ground,
                    difficulty,
                    background_dataset_path,
                    train_or_val,
                    seed,
                    visualize_reward,
                    from_pixels,
                    height,
                    width,
                    camera_id,
                    frame_skip,
                    episode_length,
                    environment_kwargs,
                    time_limit,
                    channels_first
                    )

The following is the explanation of the parameters which used to control the background/foreground, and the rest of the parameters are the same as the original dmc2gym code.

distract_type             : choice{'color', 'noise', 'dots', 'videos'}, default: None
ground                    : choice{'background', 'forground', 'both'}, default: None,
                            'both' only used for 'videos' distractor, 'color' and 'noise' only have 'background'
difficulty                : choice{'easy', 'medium', 'hard'}, default: 'hard'
                            only useful for 'dots' and 'videos' distractor
                            when use 'dots' distractor, set num_dots to: 'hard'=16, 'medium'=8, 'easy'=5;
                            when use 'videos' distract type, set num_video to: 'hard'=all, others the same as 'dots'
intensity                 : 0-1, default: 1
                            distracting intensity(non-transparency?): 1 is all distrated, 0 is same as original env
background_dataset_path   : where you put your video/image dataset, only useful for 'videos'
train_or_val              : choice{'train', 'val'}, default: None
                            when use DAVIS Dataset, can divided it to train-set and validation-set

when you use 'dots', by default, distractors are repeated, and movements of dots obey the dynamics of an ideal gas with no collison. If you want to change those default settings, or you want to modify sizes/velocitys/positions/quantity/or some others of dots, you can modify them in file 'background_source.py', class 'RandomDotsSource' by yourself.

Attribution

Based on work of:

  • Philipp Becker
  • Yiping Wei
  • Yitian Yang

Citing This Work

If you find this work helpful, please cite the corresponding publication

TODO

Metadata

Release files for gym-distractions 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gym-distractions 0.1.1
File Size Uploaded
gym-distractions-0.1.1.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gym-distractions 0.1.1
File Interpreter ABI Platform
gym_distractions-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / gym-distractions-0.1.1.tar.gz

Download URL gym-distractions-0.1.1.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9cdc6fbafd8710f0e6139806a5bbb78f1b4059d0c20f2e705d65872ab602206d
BLAKE2b-256 checksum
How to use checksums
d90a2965c0a791793b263f9c34b16d85e079bbff5e2561340ba7aaa2dc6efdcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / gym_distractions-0.1.1-py3-none-any.whl

Download URL gym_distractions-0.1.1-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1f486c8723f2466d03db41ee0fc8e96f0fae182fb3176b29cc7afc51019dbf0
BLAKE2b-256 checksum
How to use checksums
01272a043d9f1a096a992b0360f0b36a44c77fd3494b30318365aaefcbca5320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page