Exemplo n.º 1
0
    def get_image(self, record):
        from donkeycar.management.makemovie import MakeMovie
        img_arr = copy(super().get_image(record))
        augmentation = pilot_screen().augmentation if pilot_screen().auglist \
            else None
        if augmentation:
            img_arr = pilot_screen().augmentation.augment(img_arr)
        angle = record.underlying['user/angle']
        throttle = get_norm_value(record.underlying[self.throttle_field],
                                  tub_screen().ids.config_manager.config,
                                  rc_handler.field_properties[
                                      self.throttle_field])
        rgb = (0, 255, 0)
        MakeMovie.draw_line_into_image(angle, throttle, False, img_arr, rgb)
        if not self.keras_part:
            return img_arr

        output = self.keras_part.evaluate(record, augmentation)
        rgb = (0, 0, 255)
        MakeMovie.draw_line_into_image(output[0], output[1], True, img_arr, rgb)
        out_record = copy(record)
        out_record.underlying['pilot/angle'] = output[0]
        # rename and denormalise the throttle output
        pilot_throttle_field \
            = rc_handler.data['user_pilot_map'][self.throttle_field]
        out_record.underlying[pilot_throttle_field] \
            = get_norm_value(output[1], tub_screen().ids.config_manager.config,
                             rc_handler.field_properties[self.throttle_field],
                             normalised=False)
        self.pilot_record = out_record
        return img_arr
Exemplo n.º 2
0
    def run(self, args):
        '''
        Load the images from a tub and create a movie from them.
        Movie
        '''
        args, parser = self.parse_args(args)

        from donkeycar.management.makemovie import MakeMovie

        mm = MakeMovie()
        mm.run(args, parser)