You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried adapting your approach during training to some pre-existing code of mine,
however I am constantly met with the ValueError. My model is different from yours, but essentially does the same procedure. My original training approach had a check for while not done, but as the first episode quits early (?) There would always be some error, and hence I wanted to try your approach. https://gist.github.com/EXJUSTICE/0df29caedee2a72a7e5faf7aa88cbd03
After investigating, it's clear to me that the error is from the preprocessing function, where you call to transform the preprocessed image to size 84,84 using sci-image. I changed your code to ensure that grayscaling happened as well. The transformation cannot occur with an empty array of zeros?
def preprocess_observation(frame):
# Crop and resize the image into a square, as we don't need the excess information
cropped = frame[60:-60,30:-30]
normalized = cropped/255.0
# Improve image contrast See if works
#img[img==color] = 0
# Next we normalize the image from -1 to +1 See if works
#img = (img - 128) / 128 - 1
img_gray = rgb2gray(normalized)
preprocessed_frame = transform.resize(img_gray, [84,84])
return preprocessed_frame
The text was updated successfully, but these errors were encountered:
Hi,
I'm having the same problem, with the exception of I'm not really adapting the code (I am adapting it to newer versions of python and packages: tf.compat.v1 is a thing). I tried to get around the ValueError problem with:
IndexError: index 0 is out of bounds for axis 0 with size 0
Perhaps this can be interpreted as the state passed in as a frame is an empty array (or smaller than 40 x 60, as there's potentially cropping that happens). If you come across a solution, I'm all ears!
The initial state/frame is empty. Because transform.resize upsamples, only 1 pixel is necessary (not sure if there's a reason to use more, but more complexity meant more problems for me). Trying to give an array of zeros wouldn't run: Apparently I needed a 2- or 3- tuple. Giving a 3- tuple (each pixel, in my case, is RGB) failed on normalizing, because division doesn't work with tuples. Finally got:
Hello,
I've tried adapting your approach during training to some pre-existing code of mine,
however I am constantly met with the ValueError. My model is different from yours, but essentially does the same procedure. My original training approach had a check for while not done, but as the first episode quits early (?) There would always be some error, and hence I wanted to try your approach.
https://gist.github.com/EXJUSTICE/0df29caedee2a72a7e5faf7aa88cbd03
After investigating, it's clear to me that the error is from the preprocessing function, where you call to transform the preprocessed image to size 84,84 using sci-image. I changed your code to ensure that grayscaling happened as well. The transformation cannot occur with an empty array of zeros?
The text was updated successfully, but these errors were encountered: