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

Update dependency versions, add TensorRT execution provider #15

Merged
merged 3 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10"]

steps:
- uses: actions/checkout@v3
Expand Down
7 changes: 5 additions & 2 deletions fast_track/object_detection/object_detector_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ def __init__(self, weights_path: str, names: List[str], image_shape: Tuple[int,
visualize: boolean value to visualize outputs.
"""
super().__init__(weights_path, names, image_shape, visualize)

self.providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
self.providers = [
'TensorrtExecutionProvider',
'CUDAExecutionProvider',
'CPUExecutionProvider'
]
self.session = None
self.input_shape = None
self.input_names = None
Expand Down
4 changes: 2 additions & 2 deletions fast_track/object_detection/third_party/yolo_nas/yolo_nas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from typing import List, Optional, Tuple

import super_gradients
import numpy as np
import torch

Expand Down Expand Up @@ -35,6 +34,7 @@ def __init__(self, weights_path: str,
visualize: boolean value to visualize outputs.
"""
super().__init__(weights_path=weights_path, names=names, image_shape=image_shape, visualize=visualize)
import super_gradients
self.model = super_gradients.training.models.get(self.weights_path, pretrained_weights=pretrained)
if torch.cuda.is_available():
self.model = self.model.cuda()
Expand All @@ -49,7 +49,7 @@ def detect(self,
Returns:
Tuple[List[int], List[float], List[np.ndarray]]: Postprocessed output (class_ids, scores, boxes).
"""
detections = next(iter(self.model.predict(image)))
detections = self.model.predict(image)
boxes = detections.prediction.bboxes_xyxy.tolist()
class_ids = detections.prediction.labels.astype(int).tolist()
scores = detections.prediction.confidence.tolist()
Expand Down
2 changes: 1 addition & 1 deletion fast_track/object_detection/third_party/yolov8/yolov8.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np
import torch
from ultralytics import YOLO
from ultralytics.yolo.utils import ops
from ultralytics.utils import ops

from ...object_detector import ObjectDetector
from ...object_detector_onnx import ObjectDetectorONNX
Expand Down
30 changes: 14 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "fast_track"
version = "0.6.1"
version = "0.6.2"
description = "Object detection and tracking pipeline"
readme = "README.md"
keywords = [
Expand All @@ -13,35 +13,33 @@ keywords = [
"object-detection",
"ai",
]
license = { text = "MIT LICENE" }
license = { file = "LICENSE.txt" }
authors = [{ name = "Nate Haddad", email = "nhaddad2112@gmail.com" }]
maintainers = [{ name = "Nate Haddad", email = "nhaddad2112@gmail.com" }]
requires-python = ">=3.8, <3.11"
dependencies = [
"numpy < 1.24.0",
"pyyaml >= 6.0",
"opencv-python >= 4.6.0.66",
"onnxruntime >= 1.13.1",
"torch >= 1.13.1",
"scipy >= 1.9.3",
"ultralytics >= 8.0.92",
"super-gradients >= 3.1.1",
"pylint >= 2.17.4",
"numpy==1.23.0",
"pyyaml == 6.0.1",
"opencv-python == 4.9.0.80",
"onnxruntime == 1.13.1",
"torch == 2.2.0",
"scipy == 1.12.0",
"ultralytics == 8.1.9",
"super-gradients == 3.6.0",
"pylint == 3.0.3",
]
classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",

]

[project.optional-dependencies]
gpu = [
"onnxruntime-gpu",
"onnxruntime-gpu==1.17.0",
]
bytetrack = [
"lap >= 0.4.0",
"Cython >= 0.29.32",
"lap == 0.4.0",
"Cython == 3.0.8",
"cython-bbox @ git+https://github.com/samson-wang/cython_bbox.git#egg=cython-bbox",
]
gradio = [
Expand Down
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Run file for camera_perception """
""" Run file for fast_track """

import cv2
import yaml
Expand Down
Loading