Skip to content

Commit

Permalink
Update monitoring scripts
Browse files Browse the repository at this point in the history
Save raw frames only when something is detected and only once in case of multiple detections.
  • Loading branch information
maxsitt committed Feb 1, 2023
1 parent 2a148f7 commit 5d3714a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions yolov5_tracker_save_hqsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,12 @@ def store_data(frame, tracklets):

# Save full raw HQ frame (e.g. for training data collection)
if args.save_raw_frames:
timestamp = datetime.now().strftime("%Y%m%d_%H-%M-%S.%f")
raw_path = f"{save_path}/raw/{timestamp}_raw.jpg"
cv2.imwrite(raw_path, frame)
# save only once in case of multiple detections
for i, t in enumerate(tracklets):
if i == 0:
timestamp = datetime.now().strftime("%Y%m%d_%H-%M-%S.%f")
raw_path = f"{save_path}/raw/{timestamp}_raw.jpg"
cv2.imwrite(raw_path, frame)

def record_log():
"""Write information about each recording interval to .csv file."""
Expand Down
9 changes: 6 additions & 3 deletions yolov5_tracker_save_hqsync_nopj.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,12 @@ def store_data(frame, tracklets):

# Save full raw HQ frame (e.g. for training data collection)
if args.save_raw_frames:
timestamp = datetime.now().strftime("%Y%m%d_%H-%M-%S.%f")
raw_path = f"{save_path}/raw/{timestamp}_raw.jpg"
cv2.imwrite(raw_path, frame)
# save only once in case of multiple detections
for i, t in enumerate(tracklets):
if i == 0:
timestamp = datetime.now().strftime("%Y%m%d_%H-%M-%S.%f")
raw_path = f"{save_path}/raw/{timestamp}_raw.jpg"
cv2.imwrite(raw_path, frame)

def record_log():
"""Write information about each recording interval to .csv file."""
Expand Down

0 comments on commit 5d3714a

Please sign in to comment.