udacity / CarND-Behavioral-Cloning-P3

Starting files for the Udacity CarND Behavioral Cloning Project
https://www.udacity.com/drive
MIT License
438 stars 1.71k forks source link

Video error: AttributeError: 'numpy.ndarray' object has no attribute 'save' #18

Closed vdt closed 7 years ago

vdt commented 7 years ago

This is similar to https://github.com/udacity/CarND-Behavioral-Cloning-P3/issues/11
please have to look at my drive.py ( https://github.com/vdt/CarND-Behavioral-Cloning/blob/master/drive.py )

$ python drive.py model-016.h5 run1 -----> gives error Video error: AttributeError: 'numpy.ndarray' object has no attribute 'save'

vdt commented 7 years ago

Changed to ->:

image = Image.open(BytesIO(base64.b64decode(data["image"]))) try: image2 = np.asarray(image) # from PIL image to numpy array image2 = utils.preprocess(image2) # apply the preprocessing image3 = image2[None, :, :, :] # the model expects 4D array

        # predict the steering angle for the image
        steering_angle = float(model.predict(image3, batch_size=1))

it works now