Closed patrickduhaime closed 5 years ago
Ok got it to work... After investigation, the problem was this line:
screen = cv2.cvtColor(screen, cv2.COLOR_BGR2GRAY)
I imported rgb2gray from skimage.color
from skimage.color import rgb2gray
And changed to gray using this line:
screen = np.stack([rgb2gray(screen[i]) for i in range(screen.shape[0])])
I am glad you had this figured out.
Hello,
I trainned a custom image prediction model using this script:
Here is how I grabbed my images while driving a car simulator (https://www.crazygames.com/game/modern-car-racing):
This is how I converted the images to the file format needed by ImageAI:
Here is how I test the model :
The issue is if I uncomment this line: #screen = cv2.imread("8p.jpeg")
I get this output:
left:99.99867677688599 right:0.0013042812497587875 brake:2.696586136607948e-05 forward:3.564269990263824e-07
which is just fine, this image was taken from the left folder of the trainning data, If I cmment the line I get this error:
ValueError: Error when checking input: expected input_1 to have 4 dimensions, bu t got array with shape (1, 224, 224)
Thank you