From e389772d84475cbc38d4002dc37d8e959f9beb04 Mon Sep 17 00:00:00 2001 From: Josh Bailey Date: Tue, 10 Oct 2023 07:29:01 +0000 Subject: [PATCH] yolov8 example. --- docker/Dockerfile.torchserve | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docker/Dockerfile.torchserve b/docker/Dockerfile.torchserve index 46640b90..79e4400d 100644 --- a/docker/Dockerfile.torchserve +++ b/docker/Dockerfile.torchserve @@ -13,3 +13,21 @@ RUN pip config set global.no-cache-dir false && \ cd .. && \ rm -rf serve RUN /usr/local/bin/torchserve --help + +## example usage with YOLOv8 (https://github.com/pytorch/serve/tree/v0.8.2/examples/object_detector/yolo/yolov8): + +# docker build -f Dockerfile.torchserve . -ts iqtlabs/gamutrf-torchserve +# docker run -ti iqtlabs/gamutrf-torchserve bash +# apt-get update && apt-get install -y curl wget +# pip3 install torch-model-archiver +# cd /tmp +# git clone https://github.com/pytorch/serve -b v0.8.2 +# cd serve/examples/object_detector/yolo/yolov8 +# pip install -r requirements.txt +# wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt +# torch-model-archiver --model-name yolov8n --version 1.0 --serialized-file yolov8n.pt --handler custom_handler.py +# mkdir model_store +# mv yolov8n.mar model_store/. +# torchserve --start --model-store model_store --ncs +# curl -X POST "localhost:8081/models?model_name=yolov8n&url=yolov8n.mar&initial_workers=4&batch_size=2" +# curl http://127.0.0.1:8080/predictions/yolov8n -T persons.jpg & curl http://127.0.0.1:8080/predictions/yolov8n -T bus.jpg