Skip to content

muhammedakyuzlu/yolov5-libtorch-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

A LibTorch inference implementation of the yolov5 object detection algorithm. only CPU is supported.

Dependencies

  • Ubuntu 20
  • OpenCV 4.5
  • LibTorch 1.10.2+cpu

Setup

$ cd /path/to/libtorch_yolo5
$ wget https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.10.2%2Bcpu.zip
$ unzip libtorch-shared-with-deps-1.10.2+cpu.zip
$ mkdir build && cd build
$ cmake .. && make

run

   ./libtorch-yolov5 [OPTION...]

   --weights arg      path to model.torchscript.pt
   --classes arg      path to classes name  coco.name
   -i                 image or video/stream default:video
   --source arg       path to source
   --conf-thresh arg  object confidence threshold (default: 0.4)
   --iou-thresh arg   IOU threshold for NMS (default: 0.5)
   --show             display results
   -h, --help         Print usage

video

./libtorch-yolov5 --weights ../weights/yolov5s.torchscript --classes ../weights/coco.names --source ../videos/t2.mp4 [--show] [--conf-thresh] [--iou-thresh]

camera by index

./libtorch-yolov5 --weights ../weights/yolov5s.torchscript --classes ../weights/coco.names --source 0 [--show] [--conf-thresh] [--iou-thresh]

image

./libtorch-yolov5 --weights ../weights/yolov5s.torchscript --classes ../weights/coco.names --source ../images/bus.jpg -i [--show] [--conf-thresh] [--iou-thresh]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published