Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMD GPU support with the rocm detector and YOLOv8 pretrained model download #9762

Merged
merged 59 commits into from
Feb 10, 2024

Conversation

harakas
Copy link
Contributor

@harakas harakas commented Feb 9, 2024

Main changes/improvements:

  • new rocm (AMD GPUs) and onnx detector plugins
    • onnx is more of a development thing, openvino runs same/better in general for same inputs
    • currently only yolov8 models supported
    • in theory can process any "normal" onnx files, just needs proper pre and post-processing
    • does not use quantized models so runs full f32
  • yolov8 pre- and postprocessing utility functions
  • yolov8 model automatic download using DOWNLOAD_YOLOV8 environment variable

… box scaling; use cv2.dnn.blobForImage for preprocessing; assert on required model parameters
Copy link

netlify bot commented Feb 9, 2024

Deploy Preview for frigate-docs ready!

Name Link
🔨 Latest commit cfc1bf4
🔍 Latest deploy log https://app.netlify.com/sites/frigate-docs/deploys/65c755c5ffcf0b00084b60c4
😎 Deploy Preview https://deploy-preview-9762--frigate-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@harakas
Copy link
Contributor Author

harakas commented Feb 9, 2024

Here @NickM-27

docker/main/Dockerfile Show resolved Hide resolved
docs/docs/configuration/object_detectors.md Outdated Show resolved Hide resolved
docs/docs/configuration/object_detectors.md Outdated Show resolved Hide resolved
frigate/detectors/yolo_utils.py Outdated Show resolved Hide resolved
@NickM-27
Copy link
Sponsor Collaborator

NickM-27 commented Feb 9, 2024

also one other thing, need to add this to recommended_hardware docs as well

@harakas
Copy link
Contributor Author

harakas commented Feb 9, 2024

also one other thing, need to add this to recommended_hardware docs as well

Added mention:
harakas@8c96d3a

@NickM-27
Copy link
Sponsor Collaborator

NickM-27 commented Feb 9, 2024

just need to get the python checks happy

@harakas
Copy link
Contributor Author

harakas commented Feb 9, 2024

just need to get the python checks happy

What's the best way to do it? It just requires formatting changes? Can you apply it automagically?

@NickM-27 NickM-27 enabled auto-merge (squash) February 9, 2024 15:01
@blakeblackshear blakeblackshear merged commit 44d8cdb into blakeblackshear:dev Feb 10, 2024
10 checks passed
mike2307 pushed a commit to mike2307/frigate that referenced this pull request Feb 11, 2024
…wnload (blakeblackshear#9762)

* ROCm AMD/GPU based build and detector, WIP

* detectors/rocm: separate yolov8 postprocessing into own function; fix box scaling; use cv2.dnn.blobForImage for preprocessing; assert on required model parameters

* AMD/ROCm: add couple of more ultralytics models; comments

* docker/rocm: make imported model files readable by all

* docker/rocm: readme about running on AMD GPUs

* docker/rocm: updated README

* docker/rocm: updated README

* docker/rocm: updated README

* detectors/rocm: separated preprocessing functions into yolo_utils.py

* detector/plugins: added onnx cpu plugin

* docker/rocm: updated container with limite label sets

* example detectors view

* docker/rocm: updated README.md

* docker/rocm: update README.md

* docker/rocm: do not set HSA_OVERRIDE_GFX_VERSION at all for the general version as the empty value broke rocm

* detectors: simplified/optimized yolov8_postprocess

* detector/yolo_utils: indentation, remove unused variable

* detectors/rocm: default option to conserve cpu usage at the expense of latency

* detectors/yolo_utils: use nms to prefilter overlapping boxes if too many detected

* detectors/edgetpu_tfl: add support for yolov8

* util/download_models: script to download yolov8 model files

* docker/main: add download-models overlay into s6 startup

* detectors/rocm: assume models are in /config/model_cache/yolov8/

* docker/rocm: compile onnx files into mxr files at startup

* switch model download into bash script

* detectors/rocm: automatically override HSA_OVERRIDE_GFX_VERSION for couple of known chipsets

* docs: rocm detector first notes

* typos

* describe builds (harakas temporary)

* docker/rocm: also build a version for gfx1100

* docker/rocm: use cp instead of tar

* docker.rocm: remove README as it is now in detector config

* frigate/detectors: renamed yolov8_preprocess->preprocess, pass input tensor element type

* docker/main: use newer openvino (2023.3.0)

* detectors: implement class aggregation

* update yolov8 model

* add openvino/yolov8 support for label aggregation

* docker: remove pointless s6/timeout-up files

* Revert "detectors: implement class aggregation"

This reverts commit dcfe6bb.

* detectors/openvino: remove class aggregation

* detectors: increase yolov8 postprocessing score trershold to 0.5

* docker/rocm: separate rocm distributed files into its own build stage

* Update object_detectors.md

* updated CODEOWNERS file for rocm

* updated build names for documentation

* Revert "docker/main: use newer openvino (2023.3.0)"

This reverts commit dee95de.

* reverrted openvino detector

* reverted edgetpu detector

* scratched rocm docs from any mention of edgetpu or openvino

* Update docs/docs/configuration/object_detectors.md

Co-authored-by: Nicolas Mowen <[email protected]>

* renamed frigate.detectors.yolo_utils.py -> frigate.detectors.util.py

* clarified rocm example performance

* Improved wording and clarified text

* Mentioned rocm detector for AMD GPUs

* applied ruff formating

* applied ruff suggested fixes

* docker/rocm: fix missing argument resulting in larger docker image sizes

* docs/configuration/object_detectors: fix links to yolov8 release files

---------

Co-authored-by: Nicolas Mowen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants