drive.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Behavioral-Cloning 作者: JustinHeaton 项目源码 文件源码
def telemetry(sid, data):
    # The current steering angle of the car
    steering_angle = data["steering_angle"]
    # The current throttle of the car
    throttle = data["throttle"]
    # The current speed of the car
    speed = data["speed"]
    # The current image from the center camera of the car
    imgString = data["image"]
    image = Image.open(BytesIO(base64.b64decode(imgString)))
    image_array = np.asarray(image)
    image_array = imresize(image_array, (32,64,3)).astype(np.float32)
    image_array = adjust_gamma(image_array)
    transformed_image_array = image_array[None, 12:, :, :].astype(np.float32)
    # This model currently assumes that the features of the model are just the images. Feel free to change this.
    steering_angle = float(model.predict(transformed_image_array, batch_size=1))
    # The driving model currently just outputs a constant throttle. Feel free to edit this.
    throttle = 0.4
    print(steering_angle, throttle)
    send_control(steering_angle, throttle)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号