Code Monkey home page Code Monkey logo

cerebro's Introduction

Deploy YOLO

This fork uses Replicate's ๐Ÿฃ Cog system to quickly deploy Ultralytic's ๐Ÿš€ PyTorch implementation of YOLOv5.

See Cog and YOLOv5 for full documentation on training, testing and deployment.

Quickstart

Convenience script for Ubuntu
# Install and run pretrained Cog
sudo utils/Install.sh
# Test endpoint
python3 utils/Endpoint.py
Prerequisites

Install Docker and then install the newest version of Cog

# Use Docker convenience script if you dare
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Download and configure Cog binary
sudo curl -o /usr/local/bin/cog -L https://github.com/replicate/cog/releases/latest/download/cog_`uname -s`_`uname -m`
sudo chmod +x /usr/local/bin/cog
(Optional) CPU Configuration

If you want to deploy with a CPU change line 2 in cog.yml to false:

build:
  gpu: false
Inference

Test the pretrained model with

cog predict -i image=@data/images/zidane.jpg

This will output a JSON list of all detections by default:

{
  'status': 'succeeded',
  'output': '[
    {
      "xmin":751.9083251953,
      "ymin":45.5722045898,
      "xmax":1148.5522460938,
      "ymax":716.2182006836,
      "confidence":0.8750465512,
      "class":0,
      "name":"person"
    },
    ...
  ]'
}

You can also add an additional format argument to change the label output

cog predict -i image=@data/images/zidane.jpg -i format=yolo
Deployment

STARTER: Deploy the model locally at http://localhost:5000 using the below premade scripts.

# To run on GPU
docker/run_gpu.sh
# OR to run on CPU
docker/run_cpu.sh
# Send test image once the container is running
curl http://localhost:5000/predict -X POST -F input=@docs/zidane.jpg

You should see the same JSON output from the Inference step.

ADVANCED: Deploy in the cloud using the Cloudflare Tunnel guide

To-do

  • Add more label types
  • Simplify JSON extraction
  • Bridge to Jetson platform
  • Training tutorial with Roboflow

cerebro's People

Contributors

jimothyjohn 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.