Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

ouster-lidar/yolov5-ouster-lidar-example

 
 

Repository files navigation

YOLOv5_Ouster-example

Our goal is to identify persons with an OS0-128 lidar sensor and trigger an alarm when the relative distance between the two people is less than 1.8 meters. Detailed instructions can be found in the blog post Object Detection and Tracking using Deep Learning and Ouster Python SDK

Install

  1. Clone repo and install required packages in a Python>=3.7.0 environment, including PyTorch>=1.7.
git clone https://github.com/fisher-jianyu-shi/yolov5_Ouster-lidar-example 
cd yolov5_Ouster-lidar-example 
pip install -r requirements.txt  
  1. Install the Ouster Python SDK (more details here)
python3 -m pip install --upgrade pip
  1. Download the sample lidar data, and save both the PCAP and JSON files in the source directory

Inference with detect.py

detect.py (from original YOLOv5 repo) runs inference on a variety of sources (images, videos, video streams, webcam, etc.) and saves results to runs/detect
For example, to detect people in an image using the pre-trained YOLOv5s model with a 40% confidence threshold, we simply have to run the following command in a terminal in the source directory:

python detect.py --class 0 --weights yolov5s.pt --conf-thres=0.4 --source example_pic.jpeg --view-img 

This will automatically save the results in the directory runs/detect/exp as an annotated image with a label and the confidence levels of the prediction.

Inference with detect_pcap.py

To run inference on lidar data (pcap file) using custom-trained weights, simply run:

python detect_pcap.py --class 0 --weights best.pt --conf-thres=0.4 --source Ouster-YOLOv5-sample.pcap --metadata-path Ouster-YOLOv5-sample.json  --view-img

To calculate the relative distance between two people:

python detect_pcap.py --class 0 --weights best.pt --conf-thres=0.4 --source Ouster-YOLOv5-sample.pcap --metadata-path Ouster-YOLOv5-sample.json  --view-img --social-distance

About

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.3%
  • Other 1.7%