Skip to content

Commit

Permalink
feat: add yolov11 deepstream
Browse files Browse the repository at this point in the history
  • Loading branch information
quangdungluong committed Sep 30, 2024
1 parent c79f543 commit 281332f
Show file tree
Hide file tree
Showing 58 changed files with 4,661 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": ["@commitlint/config-conventional"],
"defaultIgnores": true,
"rules": {
"body-leading-blank": [1, "always"],
"body-max-line-length": [2, "always", 100],
"footer-leading-blank": [1, "always"],
"footer-max-line-length": [2, "always", 10000],
"header-max-length": [2, "always", 200],
"subject-case": [
2,
"never",
[]
],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test"
]
]
}
}
76 changes: 76 additions & 0 deletions .github/workflows/pr-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "Lint PR"

on:
pull_request:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: write

jobs:
pr-title:
name: Validate PR title
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true

commitlint:
name: Validate commit messages
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- uses: wagoid/commitlint-github-action@v6
id: commitlint
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configFile: ./.commitlintrc
- uses: buildingcash/json-to-markdown-table-action@v1
if: always() && (steps.commitlint.outcome != 'success')
id: table
with:
json: ${{ steps.commitlint.outputs.results }}
- uses: marocchino/sticky-pull-request-comment@v2
if: always() && (steps.commitlint.outcome != 'success')
with:
header: commitlint-error
message: |
**All commits** in this PR need to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and [.commitlintrc](${{ github.server_url }}/${{ github.repository }}/blob/${{ github.head_ref || github.ref_name }}/.commitlintrc).
Details:
${{ steps.table.outputs.table }}
- if: ${{ steps.commitlint.outcome == 'success' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: commitlint-error
delete: true
20 changes: 20 additions & 0 deletions .github/workflows/style-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: style-check

on:
pull_request:
branches: [master, develop]
push:
branches: [master, develop]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Clone the repo
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: run pre-commit
uses: pre-commit/[email protected]
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Dependency directories
node_modules/
.husky

# Model weights
*.pt
*.onnx
*.engine
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
args: ["--unsafe"]
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: detect-aws-credentials
args: ["--allow-missing-credentials"]
- id: detect-private-key
- id: check-added-large-files
args: ["--maxkb=750"]
- id: debug-statements
- repo: https://github.com/ambv/black
rev: 22.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]
language_version: python3.9
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
hooks:
- id: clang-format
types_or: [c++, c, cuda]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: ["--write-changes"]
additional_dependencies:
- tomli
68 changes: 67 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,67 @@
# DeepStream-YOLOv11
# DeepStream-YOLOv11

## Introduction
This repository offers plug-and-play custom parsers tailored for YOLOv11 AI models in DeepStream. Ideal for developers looking to streamline model parsing in DeepStream applications.

## Requirements
This repository supports DeepStreamSDK version 6.2, 6.3, 6.4, and 7.0 on Jetson and dGPU platform. You can follow [this guide](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Installation.html) for detailed installation instructions.
>Note: I prefer using Docker containers on both dGPU and Jetson platforms. These containers provide a convenient, out-of-the-box way to deploy DeepStream applications by packaging all associated dependencies within the container.
## Supported Models

### Object Detection

- YOLOv11

## Usage

### 1. Clone the repository
```bash
https://github.com/quangdungluong/DeepStream-YOLOv11
cd DeepStream-YOLOv11
```

### 2. Build Custom Parser Function
```bash
bash scripts/compile_nvdsinfer.sh
```

### 3. Convert Models to ONNX
Export the ONNX model file. Check the [documentation](./docs/) for more detailed instructions.

### 4. Convert Models ONNX to TensorRT
Convert ONNX model to a TensorRT engine using [trtexec](https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#trtexec).

### 5. Edit the `config_primary_yolov11` file
Edit the `configs/config_primary_yolov11.txt` file according to your model.
```
[property]
...
model-engine-file=yolo11s_b1_fp32.engine
...
num-detected-classes=80
...
# 0: FP32, 1: INT8, 2:FP16
network-mode=0
...
parse-bbox-func-name=NvDsInferParseYolo
...
custom-lib-path=../libs/nvdsinfer_customparser_yolo/libnvds_infercustomparser_yolo.so
```

### 6. Edit the `deepstream_app_config` file
Edit the `deepstream_app_config.txt` file according to your GIE config file.
```
[primary-gie]
...
config-file=config_primary_yolov11.txt
```

### 7. Run DeepStream Application
```bash
deepstream-app -c deepstream_app_config.txt
```

## Reference

- [DeepStream-YOLO](https://github.com/marcoslucianops/DeepStream-Yolo)
23 changes: 23 additions & 0 deletions configs/config_primary_gie.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-color-format=0
model-engine-file=yolo11s_b1_fp32.engine
labelfile-path=labels.txt
batch-size=1
network-mode=0
num-detected-classes=80
interval=0
gie-unique-id=1
process-mode=1
network-type=0
cluster-mode=2
maintain-aspect-ratio=1
symmetric-padding=1
parse-bbox-func-name=NvDsInferParseYolo
custom-lib-path=../libs/nvdsinfer_customparser_yolo/libnvds_infercustomparser_yolo.so

[class-attrs-all]
nms-iou-threshold=0.45
pre-cluster-threshold=0.25
topk=300
23 changes: 23 additions & 0 deletions configs/config_primary_yolov11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-color-format=0
model-engine-file=yolo11s_b1_fp32.engine
labelfile-path=labels.txt
batch-size=1
network-mode=0
num-detected-classes=80
interval=0
gie-unique-id=1
process-mode=1
network-type=0
cluster-mode=2
maintain-aspect-ratio=1
symmetric-padding=1
parse-bbox-func-name=NvDsInferParseYolo
custom-lib-path=../libs/nvdsinfer_customparser_yolo/libnvds_infercustomparser_yolo.so

[class-attrs-all]
nms-iou-threshold=0.45
pre-cluster-threshold=0.25
topk=300
Loading

0 comments on commit 281332f

Please sign in to comment.