Drive the car's YOLO detection
Enter the car's system, end the car program, enter "ip (ip is the car's ip): 8888" in the browser, enter the password "yahboom" Then log in Enter the path Rider-pi_class/5.AI Visual Recognition Course/10. YOLO detection and run yolo.ipynb. Or enter the command in the terminal to directly start the python script
cd /home/pi/Rider-pi_class/5.AI Visual Recognition Course/10. YOLO detectionpython3 yolo.pyAfter running the source code, you can see that the car can detect objects

x def yoloFast(self,target="camera"): ret='' self.open_camera() if self.yolo==None: self.yolo = yoloXgo('/home/pi/model/Model.onnx', ['person','bicycle','car','motorbike','aeroplane','bus','train','truck','boat','traffic light','fire hydrant','stop sign','parking meter','bench','bird','cat','dog','horse','sheep','cow','elephant','bear','zebra','giraffe','backpack','umbrella','handbag','tie','suitcase','frisbee','skis','snowboard','sports ball','kite','baseball bat','baseball glove','skateboard','surfboard','tennis racket','bottle','wine glass','cup','fork','knife','spoon','bowl','banana','apple','sandwich','orange','broccoli','carrot','hot dog','pizza','donut','cake','chair','sofa','pottedplant','bed','diningtable','toilet','tvmonitor','laptop','mouse','remote','keyboard','cell phone','microwave','oven','toaster','sink','refrigerator','book','clock','vase','scissors','teddy bear','hair drier','toothbrush'], [352,352],0.66) if target=="camera": self.open_camera() success,image = self.cap.read() else: image=np.array(Image.open(target)) datas = self.yolo.run(image) b,g,r = cv2.split(image) image = cv2.merge((r,g,b)) image = cv2.flip(image,1) if datas: for data in datas: XGOEDU.rectangle(self,image,data['xywh'],"#33cc00",2) xy= (data['xywh'][0], data['xywh'][1]) XGOEDU.text(self,image,data['classes'],xy,1,"#ff0000",2) value_yolo = data['classes'] ret=(value_yolo,xy) imgok = Image.fromarray(image) #Turn the color back r,g,b = cv2.split(image) image1 = cv2.merge((b,g,r)) cv2.imshow('frame', image1)#Displayed on the terminal self.display.ShowImage(imgok) if ret=='': return None else: return retmy_edu = my_yolo()#Cycle through camera recognition, press c to exitwhile True: result=my_edu.yoloFast() #Default parameters, camera recognition is used by default print(result) if cv2.waitKey(1) & 0xFF == ord('q'): breakThrough the source code, the car calls the edu API library and detects objects by turning on the camera.