Skip to content

Commit

Permalink
Replace spaces with underscores in behavior labels within video file …
Browse files Browse the repository at this point in the history
…paths

only
  • Loading branch information
healthonrails committed Oct 31, 2024
1 parent 04a5e78 commit 409a794
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions annolid/behavior/data_loading/video_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def process_csv_and_extract_segments(csv_path, video_file_path):
for row in reader:
recording_time = float(row["Recording time"])
# Replace spaces in behavior with underscores
behavior = row["Behavior"].replace(" ", "_")
behavior = row["Behavior"]
event = row["Event"]

if event == "state start":
Expand All @@ -66,7 +66,7 @@ def process_csv_and_extract_segments(csv_path, video_file_path):
stop_events.remove(matching_stop_event)

# Add video name and behavior with underscores in the segment path
video_segment_path = f"{OUTPUT_VIDEO_FOLDER}/{video_name}_{behavior}_{start_time}-{end_time}.mp4"
video_segment_path = f"{OUTPUT_VIDEO_FOLDER}/{video_name}_{behavior.replace(" ","_")}_{start_time}-{end_time}.mp4"
extract_video_segment(
video_file_path, start_time, end_time, video_segment_path)
entries.append(create_annotation_entry(
Expand Down

0 comments on commit 409a794

Please sign in to comment.