Skip to content

gRPC server for Object Detection service. This is a personal project of Python implementation of a gRPC service with support for object detection from image and video / camera stream.

License

Notifications You must be signed in to change notification settings

MABatin/grpc-objdet_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC Object Detection Server

gRPC server for Object Detection service. This is a personal project of Python implementation of a gRPC service with support for object detection from image and video / camera stream. For object detection, Ultralytics YOLO 🚀 is utilized, by default pretrained YOLOv8 (coco dataset) model is used. Custom trained model can also be used.

Installation


Use Python version 3.10

Conda Environment

Make sure to have anaconda or miniconda installed

  1. conda create -n grpcenv python=3.10
  2. conda activate grpcenv
  3. cd grpc-ml-server
  4. pip install -r requirements.txt

Virtualenv

  1. cd grpc-ml-server
  2. pip3 install virtualenv (if virtualenv is not installed)
  3. python3 -m virtualenv venv
  4. source venv/bin/activate
  5. pip install -r requirements.txt

Additional

Install PyTorch with CUDA support

  1. Follow the CUDA Installation Guide (Install cuda-11.7)
  2.  pip install torch==1.13.0+cu{CUDA VERSION} torchvision==0.14.0+cu{CUDA VERSION} --extra-index-url https://download.pytorch.org/whl/cu{CUDA VERSION}
    

For system without CUDA

  1.  pip install torch==1.13.0+cpu torchvision==0.14.0+cpu --extra-index-url https://download.pytorch.org/whl/cpu
    

Running the server


Compile proto file

When adding a new service, proto file should be compiled with the following command: bash compile_proto.sh <SERVICE_NAME>

Run server

python server.py --host <HOST> --port <PORT>
[OPTIONAL] --max-workers <MAX_NUM_WORKERS> --model-path <PATH_TO_CUSTOM_MODEL> --model-url <DOWNLOAD_URL>

TODO


  • Implement CORS support for handling request from frontend
  • Add method for multi-image request (unary-unary / stream-unary)
  • Add environment variables
  • Add docker support for deployment

Further improvements


  • Add support for custom model integration
  • Add service for instance / semantic segmentation, object tracking etc.

Contributions are welcome 😃

About

gRPC server for Object Detection service. This is a personal project of Python implementation of a gRPC service with support for object detection from image and video / camera stream.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published