Sign inSign up

degirum/dg_compiler_api

By degirum

•Updated over 1 year ago

Image
0

490

degirum/dg_compiler_api repository overview

⁠dg_compiler_api

The degirum/dg_compiler_api Docker image is a lightweight, efficient tool for programmatic model compilation—eliminating the need for the Degirum Streamlit UI. This API allows you to compile your models by passing the required configuration parameters directly.

⁠Supported Model Types

  • ONNX/TFLite Models
  • YOLO PyTorch Checkpoints

⁠YOLO PyTorch Checkpoints

⁠1. YOLO PyTorch Checkpoint Compilation

⁠YOLO Versions
  • yolov5
  • yolov8
⁠Supported Runtime Devices
  • hailort-hailo8-quant
  • hailort-hailo8l-quant
  • tflite-cpu-quant
  • tflite-cpu-float
  • tflite-edgetpu-quant
  • openvino-cpu-quant
  • openvino-cpu-float
  • openvino-npu-quant
  • openvino-npu-float
  • openvino-gpu-quant
  • openvino-gpu-float
  • n2x-orca1-quant
  • n2x-orca1-float
  • n2x-cpu-quant
  • n2x-cpu-float
  • rknn-rk3566-quant
  • rknn-rk3566-float
  • rknn-rk3568-quant
  • rknn-rk3568-float
  • rknn-rk3588-quant
  • rknn-rk3588-float
  • memryx-mx3-float

⁠2. ONNX/TFLite Model Compilation

⁠Model Formats
  • onnx-fp32
  • tflite-fp32
  • tflite-int8
⁠Runtime Devices
⁠ONNX
  • hailort-hailo8-quant
  • hailort-hailo8l-quant
  • tflite-cpu-quant
  • tflite-cpu-float
  • tflite-edgetpu-quant
  • openvino-cpu-quant
  • openvino-cpu-float
  • openvino-npu-quant
  • openvino-npu-float
  • openvino-gpu-quant
  • openvino-gpu-float
  • n2x-orca1-quant
  • n2x-orca1-float
  • n2x-cpu-quant
  • n2x-cpu-float
  • rknn-rk3566-quant
  • rknn-rk3566-float
  • rknn-rk3568-quant
  • rknn-rk3568-float
  • rknn-rk3588-quant
  • rknn-rk3588-float
  • memryx-mx3-float
⁠TFLITE
  • hailort-hailo8-quant
  • hailort-hailo8l-quant
  • tflite-cpu-quant
  • tflite-cpu-float
  • tflite-edgetpu-quant
  • n2x-orca1-quant
  • n2x-orca1-float
  • n2x-cpu-quant
  • n2x-cpu-float
  • rknn-rk3566-quant
  • rknn-rk3566-float
  • rknn-rk3568-quant
  • rknn-rk3568-float
  • rknn-rk3588-quant
  • rknn-rk3588-float
  • memryx-mx3-float
⁠Preprocessing Options
⁠Pad Methods
  • stretch
  • letterbox
  • crop-first
  • crop-last
⁠Resize Methods
  • nearest
  • bilinear
  • area
  • bicubic
  • lanczos
⁠Postprocessing Options
⁠Output Types
  • Yolov5-Detect
  • Yolov8-Detect
  • Yolov8-Pose
  • Yolov8-Segment
  • Classification
  • None
⁠Calibration
  • Images: Upload .jpg/.jpeg files or use COCO128 images for quant models.

⁠JSON Templates

⁠YOLO PyTorch Checkpoint Example
{
  "model_name": "model_name",
  "model_version": 1,
  "image_width": 640,
  "image_height": 640,
  "calibration_images": "",
  "OutputNMSThreshold": "0.6",
  "MaxDetectionsPerClass": "100",
  "OutputConfThreshold": "0.3",
  "MaxDetections": "100",
  "UseRegularNMS": true,
  "MaxClassesPerDetection": "1",
  "upload_url": "https://cs.degirum.com/zoo/v1/public/models/",
  "cloud_zoo_url": "degirum/<model_zoo_name>",
  "cloud_zoo_token": "<degirum token>",
  "yolo_version": "yolov8",
  "device_type": ["openvino-cpu-float"],
  "upload_zip_cloud": false,
  "calib_img_path": "assets/coco128/images",
  "num_calib_imgs": 10,
  "separate_outputs": true
}

⁠JSON Template

Below is an example params.json template that can be used to compile your model for ONNX and TFLite model files:

{
    "model_name": "model_name",
    "model_version": 1,
    "image_width": 640,
    "image_height": 640,
    "calibration_images": "",
    "OutputNMSThreshold": "0.6",
    "MaxDetectionsPerClass": "100",
    "OutputConfThreshold": "0.3",
    "MaxDetections": "100",
    "UseRegularNMS": true,
    "MaxClassesPerDetection": "1",
    "upload_url": "https://cs.degirum.com/zoo/v1/public/models/",
    "cloud_zoo_url": "degirum/<model_zoo_name>",
    "cloud_zoo_token": "<degirum token>",
    "device_type": ["openvino-cpu-quant"],
    "upload_zip_cloud": false,
    "separate_outputs": true,
    "output_postprocess_type": "Yolov8-Detect",
    "model_format": "onnx-fp32",
    "input_pad_method": "letterbox",
    "input_resize_method": "bilinear",
    "input_img_norm_enabled": true,
    "input_norm_mean": "[0.0, 0.0, 0.0]",
    "input_norm_std": "[1.0, 1.0, 1.0]"
}

⁠How to Use

  1. Use the following command to start the Docker container:

    docker run -p 8535:8535 --mount type=bind,source=<zoo_folder_path>,target=/output_files degirum/dg_compiler_api
    
  2. Run the Python API script with custom args:

    python3 dg_compiler_api_usage.py --json_file params.json --model_file checkpoint.(pt, onnx, tflite) --class_file coco.yaml --calib_images_folder ./calib_images_folder
    

Tag summary

Content type

Image

Digest

sha256:c5373d134…

Size

12.5 GB

Last updated

over 1 year ago

docker pull degirum/dg_compiler_api