Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ pip install -e .
openrl --version
```

**Tips**:无需安装,通过Colab在线试用OpenRL: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/15VBA-B7AJF8dBazzRcWAxJxZI7Pl9m-g?usp=sharing)

## 使用Docker

OpenRL目前也提供了包含显卡支持和非显卡支持的Docker镜像。
如果用户的电脑上没有英伟达显卡,则可以通过以下命令获取不包含显卡插件的镜像:

```bash
sudo docker pull openrllab/openrl-cpu
```
Expand Down
2 changes: 2 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ After installation, users can check the version of OpenRL through command line:
openrl --version
```

**Tips**: No installation required, try OpenRL online through Colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/15VBA-B7AJF8dBazzRcWAxJxZI7Pl9m-g?usp=sharing)

## Use Docker

OpenRL currently provides Docker images with and without GPU support.
Expand Down
14 changes: 11 additions & 3 deletions openrl/envs/vec_env/base_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# limitations under the License.

""""""
import sys
import warnings
from abc import ABC, abstractmethod
from typing import Any, List, Optional, Sequence, Union
Expand All @@ -24,6 +25,8 @@

from openrl.envs.vec_env.utils.util import tile_images

IN_COLAB = "google.colab" in sys.modules


class BaseVecEnv(
ABC,
Expand Down Expand Up @@ -158,10 +161,15 @@ def render(self, mode: Optional[str] = None) -> Optional[np.ndarray]:
# Create a big image by tiling images from subprocesses
bigimg = tile_images(imgs)
if mode == "human":
import cv2 # pytype:disable=import-error
if IN_COLAB:
from google.colab.patches import cv2_imshow

cv2_imshow(bigimg[:, :, ::-1])
else:
import cv2 # pytype:disable=import-error

cv2.imshow("Vec_Env:{}".format(self.env_name), bigimg[:, :, ::-1])
cv2.waitKey(1)
cv2.imshow("Vec_Env:{}".format(self.env_name), bigimg[:, :, ::-1])
cv2.waitKey(1)
elif mode in [None, "rgb_array"]:
return bigimg
else:
Expand Down