Skip to content

Commit

Permalink
chore(bio): remove point display, smaller font and reduce cost, and b…
Browse files Browse the repository at this point in the history
…etter log message for failed ancillary fetch in strided track
  • Loading branch information
danellecline committed Nov 17, 2024
1 parent e9fe692 commit c05b37f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions aipipeline/projects/bio/run_strided_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ def display_tracks(frames, tracks, frame_num, out_video):
if pt is not None:
# Offset to the right by 10 pixels for better visibility on small objects
center = (int(pt[0]) + 10, int(pt[1]))
radius = 10
color = (255, 255, 255)
thickness = 1
frame = cv2.circle(frame, center, radius, color, thickness)
font = cv2.FONT_HERSHEY_SIMPLEX
fontScale = 3
fontScale = 1
# Draw the track track_id with the label, e.g. 1:Unknown
frame = cv2.putText(frame, f"{track.id}:{label}", center, font, fontScale, color, thickness,
cv2.LINE_AA)
Expand Down Expand Up @@ -157,7 +155,7 @@ def run_inference_track(
iso_start_datetime = datetime.strptime(iso_start, "%Y-%m-%dT%H:%M:%SZ")
ancillary_data_start = get_ancillary_data(md['dive'], config_dict, iso_start_datetime)
if ancillary_data_start is None or "depthMeters" not in ancillary_data_start:
logger.error(f"Failed to get ancillary data for {md['dive']}")
logger.error(f"Failed to get ancillary data for {md['dive']} {iso_start_datetime}")
return
if ancillary_data_start["depthMeters"] < min_depth:
logger.info(f"{video_path.name} depth {ancillary_data_start['depthMeters']} "
Expand Down Expand Up @@ -205,7 +203,7 @@ def run_inference_track(
detections.append(t_loc)

# Run the tracker and clean up the localizations
tracks = tracker.update_batch((start_frame, end_frame), frame_stack, detections=detections, max_cost=30)
tracks = tracker.update_batch((start_frame, end_frame), frame_stack, detections=detections, max_frames=900, max_cost=10)
display_tracks(frame_stack_full, tracks, start_frame, out_video)
clean(output_path)
all_loc = []
Expand All @@ -225,7 +223,7 @@ def run_inference_track(
ancillary_data = get_ancillary_data(md['dive'], config_dict, loc_datetime)

if ancillary_data is None or "depthMeters" not in ancillary_data:
logger.error(f"Failed to get ancillary data for {md['dive']}")
logger.error(f"Failed to get ancillary data for {md['dive']} {iso_start_datetime}")
continue

new_loc = {
Expand Down

0 comments on commit c05b37f

Please sign in to comment.