GithubHelp home page GithubHelp logo

demo-0424's Introduction

Demo

About

This repository contains an implementation of the Yolo object detection model's inference. The endpoint requires uploading an image or video. The code will automatically detect our device (CPU/CUDA). If our device is using CPU, the code will utilize the ONNX model (.onnx), and if our device is using GPU, it will employ the PyTorch model (.pt).

Installation

  • clone the repository

      git clone https://github.com/BillyBSig/Demo-0424.git
    
  • download the YOLO model following these link

    • pytorch model

        https://drive.google.com/file/d/1FKzxILrtQlQ-wLK_AmxvhjtKl-Yhmakc/view?usp=sharing
      
    • onnx model

        https://drive.google.com/file/d/1LpBmCS7WUSdrRZFHkiFfgmmsujzQInNO/view?usp=sharing
      
  • Put these model in model directory

      ├── Lmodel/
      |   ├── yolov8n.onnx
      |   ├── yolov8n.pt
    
  • run the code on CLI

      uvicorn main:app --host 0.0.0.0 --port 7373 --reload
    
  • The end point will serve locally in http://127.0.0.1:7373/upload

Docker instruction

  • build the docker image

      docker build -t yolo_api .
    
  • run the docker following this step:

    • Create and/or copy the output directory that contain the video or image output process e.g:

      D:\YoloDemo\detect

    • if we use the GPU cuda, run

        docker run --gpus all -d  -p 7373:7373 -v local//output-detect:/app/detect --name yolo_api_serve yolo_api
      
      • change the local//output-detect with our local output directory e.g :

        docker run --gpus all -d -p 7373:7373 -v D:\YoloDemo\detect:/app/detect --name yolo_api_serve yolo_api

      • the output will using the internal docker path e.g:

          {"path": "/app/detect/2024-04-21-153032/meeting.jpg"}
        

      Then in our local device, output will save in local output directory/2024-04-21-153032/meeting.jpg

    • if we use the CPU only, then run

        docker run -d  -p 7373:7373 -v loca//output-detect:/app/detect --name yolo_api_serve yolo_api
      
      • change the local//output-detect with our local output directory

        e.g :

        docker run -d -p 7373:7373 -v D:\YoloDemo\detect:/app/detect --name yolo_api_serve yolo_api

demo-0424's People

Contributors

billybsig avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.