simoninithomas/Deep_reinforcement_learning_Course

Deep Q-Learning: ValueError: zero-size array to reduction operation minimum which has no identity

btyu opened this issue · 1 comments

btyu commented

When I run cells of "Deep Q learning with Doom.ipynb" in Deep Q-Learning part, error occurs in the 11th cell (Step 6). Here is the info:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-289a4b5c1934> in <module>()
     10         # First we need a state
     11         state = game.get_state().screen_buffer
---> 12         state, stacked_frames = stack_frames(stacked_frames, state, True)
     13 
     14     # Random action

<ipython-input-6-bf05256e1e9f> in stack_frames(stacked_frames, state, is_new_episode)
      6 def stack_frames(stacked_frames, state, is_new_episode):
      7     # Preprocess frame
----> 8     frame = preprocess_frame(state)
      9 
     10     if is_new_episode:

<ipython-input-5-90faeed1717d> in preprocess_frame(frame)
     32 
     33     # Resize
---> 34     preprocessed_frame = transform.resize(normalized_frame, [84,84])
     35 
     36     return preprocessed_frame

D:\Anaconda3\lib\site-packages\skimage\transform\_warps.py in resize(image, output_shape, order, mode, cval, clip, preserve_range)
    133         out = warp(image, tform, output_shape=output_shape, order=order,
    134                    mode=mode, cval=cval, clip=clip,
--> 135                    preserve_range=preserve_range)
    136 
    137     return out

D:\Anaconda3\lib\site-packages\skimage\transform\_warps.py in warp(image, inverse_map, map_args, output_shape, order, mode, cval, clip, preserve_range)
    817                                      mode=ndi_mode, order=order, cval=cval)
    818 
--> 819     _clip_warp_output(image, warped, order, mode, cval, clip)
    820 
    821     return warped

D:\Anaconda3\lib\site-packages\skimage\transform\_warps.py in _clip_warp_output(input_image, output_image, order, mode, cval, clip)
    568     """
    569     if clip and order != 0:
--> 570         min_val = input_image.min()
    571         max_val = input_image.max()
    572 

D:\Anaconda3\lib\site-packages\numpy\core\_methods.py in _amin(a, axis, out, keepdims)
     27 
     28 def _amin(a, axis=None, out=None, keepdims=False):
---> 29     return umr_minimum(a, axis, None, out, keepdims)
     30 
     31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):

ValueError: zero-size array to reduction operation minimum which has no identity

I searched for that, and people say

This error happens when you have an empty mask (all zeros) https://github.com/matterport/Mask_RCNN/issues/47

I don't know how to fix it. So I ask you for help.
Thank you very much!

btyu commented

I ran the jupyter notebook file by updating to another folder, with configuration files copied from my vizdoom lib folder, and the problem occurred. I ran the script with the configuration files in the same folder, and it worked. I guess it was because the vizdoom configuration files. Problem solved.