AttributeError: 'NoneType' object has no attribute 'cvtColor'
See original GitHub issueI get the following error on running: python train.py --algo a2c --env SpaceInvadersNoFrameskip-v4
Terminal Output:
========== SpaceInvadersNoFrameskip-v4 ==========
Seed: 1398960405
Default hyperparameters for environment (ones being tuned will be overridden):
OrderedDict([('ent_coef', 0.01),
('env_wrapper',
['stable_baselines3.common.atari_wrappers.AtariWrapper']),
('frame_stack', 4),
('n_envs', 16),
('n_timesteps', 10000000.0),
('policy', 'CnnPolicy'),
('policy_kwargs',
'dict(optimizer_class=RMSpropTFLike, '
'optimizer_kwargs=dict(eps=1e-5))'),
('vf_coef', 0.25)])
Using 16 environments
Creating test environment
Stacking 4 frames
Wrapping into a VecTransposeImage
Stacking 4 frames
Wrapping into a VecTransposeImage
Using cuda device
Log path: logs/a2c/SpaceInvadersNoFrameskip-v4_4
Traceback (most recent call last):
File "train.py", line 178, in <module>
exp_manager.learn(model)
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/utils/exp_manager.py", line 189, in learn
model.learn(self.n_timesteps, **kwargs)
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/stable_baselines3/a2c/a2c.py", line 198, in learn
reset_num_timesteps=reset_num_timesteps,
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/stable_baselines3/common/on_policy_algorithm.py", line 227, in learn
total_timesteps, eval_env, callback, eval_freq, n_eval_episodes, eval_log_path, reset_num_timesteps, tb_log_name
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/stable_baselines3/common/base_class.py", line 420, in _setup_learn
self._last_obs = self.env.reset() # pytype: disable=annotation-type-mismatch
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/stable_baselines3/common/vec_env/vec_transpose.py", line 98, in reset
return self.transpose_observations(self.venv.reset())
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/stable_baselines3/common/vec_env/vec_frame_stack.py", line 58, in reset
observation = self.venv.reset() # pytype:disable=annotation-type-mismatch
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/stable_baselines3/common/vec_env/dummy_vec_env.py", line 61, in reset
obs = self.envs[env_idx].reset()
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/gym/core.py", line 237, in reset
return self.env.reset(**kwargs)
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/gym/core.py", line 277, in reset
return self.env.reset(**kwargs)
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/gym/core.py", line 265, in reset
return self.observation(observation)
File "/home/ubuntu/src/rl-baselines3/rl-baselines3-zoo/.venv/lib/python3.7/site-packages/stable_baselines3/common/atari_wrappers.py", line 202, in observation
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
AttributeError: 'NoneType' object has no attribute 'cvtColor'
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
python - cvtcolor in Cv2 - no attribute - Stack Overflow
AttributeError : 'module' object has no attribute 'cvtcolor' is because of a typo. it's cvtColor with a capital C in there. voting to...
Read more >OpenCV: Resolving NoneType errors - PyImageSearch
AttributeError : 'NoneType' object has no attribute 'something'. Where something can be replaced by whatever the name of the actual attribute ...
Read more >AttributeError: 'NoneType' object has no attribute 'copy' why?
Solution 1. Are you sure each directory is populated? If they are not, you can fix your code by checking that img exists/...
Read more >kaurkarmveergci/haarcascaded - Jovian
cvtColor (image, cv2. ... AttributeError Traceback (most recent call last) ... img.copy() AttributeError: 'NoneType' object has no attribute 'copy'.
Read more >attributeerror: module 'cv2' has no attribute 'inter_area'
Have you verified your webcam works? The error tells cv2.VideoCapture(0) object hasn't been created as cap so that it's no cap.read() ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
“pip install opencv-python” is ok for me.
I resolved the issue, so I had a problem with my installation. I didn’t install
libx11
. I came to know about the issue by runningimport cv2
in python interactive session on my container. I don’t know why the baselines compresses this error message 😦