Skip to content

Unable to generate GIF image #2

Description

@RL-is-too-difficult

Hello author: I downloaded the movie version v0.2.2.12, but I'm not sure if this is the correct version of the movie you wrote in your code. However, I encountered some issues while generating GIF images. If the render mode is selected as rgb_array:

images. append (np. squeeze (self. env. render (mode='rgb_array ')), an error will be generated:

Traceback (most recent call last):
File "C:\Users\liu\Desktop\PRD-MAPPO-main\Agent MPE\MA_Controller\main.py", line 66, in
ma_controller.run()
File "C:\Users\liu\Desktop\PRD-MAPPO-main\Agent MPE\MA_Controller\multiagent1.py", line 160, in run
images.append(np.squeeze(self.env.render(mode='rgb_array')))
File "C:\Users\liu\Desktop\PRD-MAPPO-main\Agent MPE\MA_Controller\multiagent-particle-envs\multiagent\environment.py", line 332, in render
results.append(self.viewers[i].render(return_rgb_array = mode=='rgb_array'))
File "C:\Users\liu\Desktop\PRD-MAPPO-main\Agent MPE\MA_Controller\multiagent-particle-envs\multiagent\rendering.py", line 101, in render
arr = np.fromstring(image_data.data, dtype=np.uint8, sep='')
AttributeError: 'ImageData' object has no attribute 'data'

If the mode is selected as human, an error will occur:

Traceback (most recent call last):
File "C:\Users\liu\Desktop\PRD-MAPPO-main\Agent MPE\MA_Controller\main.py", line 66, in
ma_controller.run()
File "C:\Users\liu\Desktop\PRD-MAPPO-main\Agent MPE\MA_Controller\multiagent1.py", line 233, in run
self.make_gif(np.array(images),self.gif_path)
File "C:\Users\liu\Desktop\PRD-MAPPO-main\Agent MPE\MA_Controller\multiagent1.py", line 127, in make_gif
clip = ImageSequenceClip(list(images), fps=fps).resize(scale)
File "D:\anaconda\envs\PRD-MAPPO\lib\site-packages\moviepy\video\io\ImageSequenceClip.py", line 133, in init
if with_mask and (self.sequence[0].shape[2]==4):
IndexError: tuple index out of range
May I ask if you have a solution to this problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions