Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.
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 integrations/ultralytics/deepsparse/deepsparse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class YoloPostprocessor:
output shapes
"""

def __init__(self, image_size: Tuple[int]):
def __init__(self, image_size: Tuple[int] = (640, 640)):
self._image_size = image_size
self._grids = {} # Dict[Tuple[int], torch.Tensor]

Expand Down
6 changes: 4 additions & 2 deletions integrations/ultralytics/deepsparse/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import flask
from deepsparse import compile_model
from deepsparse.utils import arrays_to_bytes, bytes_to_arrays
from deepsparse_utils import postprocess_nms, pre_nms_postprocess
from deepsparse_utils import YoloPostprocessor, postprocess_nms
from flask_cors import CORS


Expand Down Expand Up @@ -121,6 +121,8 @@ def create_and_run_model_server(
engine = compile_model(model_path, batch_size, num_cores)
print(engine)

postprocessor = YoloPostprocessor()

app = flask.Flask(__name__)
CORS(app)

Expand All @@ -145,7 +147,7 @@ def predict():

# post-processing
postprocess_start_time = time.time()
outputs = pre_nms_postprocess(outputs)
outputs = postprocessor.pre_nms_postprocess(outputs)
postprocess_time = time.time() - postprocess_start_time
print(f"Post-processing, pre-nms time: {postprocess_time * 1000.0:.4f}ms")

Expand Down