Skip to content

Commit

Permalink
refactor(prediction): simplify ONNX prediction by removing batch proc…
Browse files Browse the repository at this point in the history
…essing loop
  • Loading branch information
kshitijrajsharma committed Nov 23, 2024
1 parent e6b4108 commit 0d65604
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions predictor/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ def run_prediction(
elif model_type == "yolo":
predict_yolo(model, image_paths, prediction_path, confidence)
elif model_type == "onnx":
for i in range((len(image_paths) + BATCH_SIZE - 1) // BATCH_SIZE):
image_batch = image_paths[BATCH_SIZE * i : BATCH_SIZE * (i + 1)]
preds = predict_onnx(model, image_batch, prediction_path, confidence)
# for i in range((len(image_paths) + BATCH_SIZE - 1) // BATCH_SIZE):
# image_batch = image_paths[BATCH_SIZE * i : BATCH_SIZE * (i + 1)]
predict_onnx(model, image_paths, prediction_path, confidence)

else:
raise RuntimeError("Loaded model is not supported")
Expand Down

0 comments on commit 0d65604

Please sign in to comment.