Skip to content

Fixing the failing detect_video method #128

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions detecto/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ def detect_video(model, input_file, output_file, fps=30, score_filter=0.6):

# Create the box around each object detected
# Parameters: frame, (start_x, start_y), (end_x, end_y), (r, g, b), thickness
cv2.rectangle(frame, (box[0], box[1]), (box[2], box[3]), (255, 0, 0), 3)
cv2.rectangle(frame, (int(box[0]), int(box[1])), (int(box[2]), int(box[3])), (255, 0, 0), 3)

# Write the label and score for the boxes
# Parameters: frame, text, (start_x, start_y), font, font scale, (r, g, b), thickness
cv2.putText(frame, '{}: {}'.format(label, round(score.item(), 2)), (box[0], box[1] - 10),
cv2.putText(frame, '{}: {}'.format(label, round(score.item(), 2)), (int(box[0]), int(box[1]) - 10),
cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0), 3)

# Write this frame to our video file
Expand Down