Closed rokhmatf closed 2 years ago
It should be working now. I tested it with the dmhouse environment.
after I run the command python render_video.py --path /home/rokhmat/thesis/robot-visual-navigation dmhouse
, there is an error as below:
(robotvn) rokhmat@b401:~/tesis/robot-visual-navigation/python$ python render_video.py --path /home/rokhmat/tesis/robot-visual-navigation dmhouse
Traceback (most recent call last):
File "render_video.py", line 1, in <module>
import gym
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/__init__.py", line 4, in <module>
from gym.core import (
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/core.py", line 7, in <module>
from gym import spaces
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/spaces/__init__.py", line 1, in <module>
from gym.spaces.space import Space
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/spaces/space.py", line 15, in <module>
from gym.utils import seeding
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/utils/seeding.py", line 7, in <module>
from numpy.random import Generator
ImportError: cannot import name 'Generator' from 'numpy.random' (/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/numpy/random/__init__.py)
there seems to be a problem with the gym version, should I change to an older version?
This is a wrong numpy version. If you start with a fresh environment and install all requirements.txt
you should not have this problem.
I have started with a new environment and installed all the requirements.txt
, but I got an error with cv2
(robotvn) rokhmat@b401:~/tesis/robot-visual-navigation/python$ python render_video.py --path=/home/rokhmat/tesis/robot-visual-navigation dmhouse
Traceback (most recent call last):
File "render_video.py", line 4, in <module>
import cv2
ModuleNotFoundError: No module named 'cv2'
so I installed cv2
by conda install -c conda-forge opencv -y
,but after successfully installing cv2
(opencv 4.5.4), there was an error like yesterday
(robotvn) rokhmat@b401:~/tesis/robot-visual-navigation/python$ python render_video.py --path=/home/rokhmat/tesis/robot-visual-navigation dmhouse
Traceback (most recent call last):
File "render_video.py", line 1, in <module>
import gym
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/__init__.py", line 4, in <module>
from gym.core import (
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/core.py", line 7, in <module>
from gym import spaces
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/spaces/__init__.py", line 1, in <module>
from gym.spaces.space import Space
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/spaces/space.py", line 15, in <module>
from gym.utils import seeding
File "/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/gym/utils/seeding.py", line 7, in <module>
from numpy.random import Generator
ImportError: cannot import name 'Generator' from 'numpy.random' (/home/rokhmat/anaconda3/envs/robotvn/lib/python3.8/site-packages/numpy/random/__init__.py)
I have found the problem, i tried using opencv with an previous version (4.5.2) and in my case it worked.
I installed opencv by pip install opencv-python==4.5.2.*
then run the command to render the video and produce the terminal output as below
(try-robotvn) rokhmat@b401:~/zzz-test/robot-visual-navigation/python$ python render_video.py --path=/home/rokhmat/zzz-test/robot-visual-navigation dmhouse
/home/rokhmat/anaconda3/envs/try-robotvn/lib/python3.8/site-packages/deep_rl/common/util.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
from collections import OrderedDict, Callable
Registering trainer turtlebot
Registering trainer turtlebot-noprior
Registering trainer turtlebot-unreal
Registering trainer turtlebot-unreal-noprior
Registering trainer turtlebot-a2c
Registering trainer turtlebot-a2c-noprior
Registering trainer dmhouse-a2c
Registering trainer dmhouse-unreal
Registering trainer dmhouse-ppo
Registering trainer dmhouse-ppo-a2cvn
Registering trainer turtlebot-ppo-a2cvn
Registering trainer dmhouse-ppo-unreal
Registering trainer dmhouse-dqn
Registering agent dmhouse-dqn
Registering trainer dmhouse
Registering agent turtlebot-noprior
Registering agent turtlebot
Registering agent dmhouse
Registering agent dmhouse-a2c
Registering agent dmhouse-ppo
Registering agent dmhouse-unreal
Registering agent turtlebot-a2c
Registering agent turtlebot-unreal
Registering agent turtlebot-a2c-noprior
Registering agent turtlebot-unreal-noprior
/home/rokhmat/anaconda3/envs/try-robotvn/lib/python3.8/site-packages/dmhouse/__init__.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
but the resulting video has a low resolution, can I produce a video with a higher resolution?
Sorry, currently I don't have the capacity to write the wrapper to render video in higher res. But you can easily do it yourself and I will be happy to accept the PR. In order to do that, you can implement a wrapper that will construct the inner env with higher res and store and downsample the observations.
I've found a way to get better rendering results, I was inspired by the colab you provided. basically I just increase the plot size and save the animation with better quality. I think the results are quite satisfactory. thank you very much.
I made an issue based on answer from https://github.com/jkulhanek/robot-visual-navigation/issues/4#issuecomment-1080374996 and i still can't run command
python render_video.py
, my terminal output like belowis there something missing from the command I ran? or are there steps i have to do? Previously I have downloaded the pre-trained models that you provide. Thanks for your attention. I’m looking forward to your reply.