Exemple #1
0
 def run(self, img_arr):
     img_arr = img_arr[60:, :]
     img_arr = img_arr.reshape((1, ) + img_arr.shape)
     angle_binned, throttle = self.model.predict(img_arr)
     #angle_certainty = max(angle_binned[0])
     angle_unbinned = utils.linear_unbin(angle_binned)
     return angle_unbinned, throttle[0][0]
 def run(self, img_arr, son_arr): ##@@## take sonic data as 'son_arr'
     img_arr = img_arr.reshape((1,) + img_arr.shape)
     son_arr=  np.array(son_arr).reshape(1,3)  ##@@## 
     angle_binned, throttle = self.model.predict([img_arr, son_arr]) ##@@## put son_arr into model
     #angle_certainty = max(angle_binned[0])
     angle_unbinned = utils.linear_unbin(angle_binned)
     return angle_unbinned, throttle[0][0]
Exemple #3
0
    def run(self, img_arr):
        img_arr = undistort(img_arr, balance=0.55)[9:79,:,:]

        img_arr = img_arr.reshape((1,) + img_arr.shape)
        angle_binned, throttle = self.model.predict(img_arr)
        #angle_certainty = max(angle_binned[0])
        angle_unbinned = utils.linear_unbin(angle_binned)
        return angle_unbinned, throttle[0][0]
Exemple #4
0
    def parse_outputs(self, outputs):
        res = []
        for iO, output in enumerate(outputs):            
            if len(output.shape) == 2:
                if iO == self.STEERING:
                    steering_angle = linear_unbin(output)
                    res.append(steering_angle)
                elif iO == self.THROTTLE:
                    throttle = linear_unbin(output, N=output.shape[1], offset=0.0, R=0.5)
                    res.append(throttle)
                else:
                    res.append( np.argmax(output) )
            else:
                for i in range(output.shape[0]):
                    res.append(output[i])

        self.on_parsed_outputs(res)
Exemple #5
0
 def run(self, son_arr):
     ##@@##img_arr = img_arr.reshape((1,) + img_arr.shape)
     son_arr = np.array(son_arr).reshape(1, 3)  ####################
     angle_binned, throttle = self.model.predict([son_arr
                                                  ])  ####################
     #angle_certainty = max(angle_binned[0])
     angle_unbinned = utils.linear_unbin(angle_binned)
     return angle_unbinned, throttle[0][0]
Exemple #6
0
 def inference(self, img_arr, other_arr):
     # print("get action")
     #print("return max q prediction")
     q_value = self.model.predict(img_arr)
     # convert q array to steering value
     return linear_unbin(q_value[0]), 0.7