Large CLI Jobs #1627
Unanswered
jramborger78
asked this question in
Help!
Large CLI Jobs
#1627
Replies: 1 comment 7 replies
-
Update: This is a python script that I am testing right now for the first portion from what I have gathered looking around through the Guides section and what not. As mentioned, not seeing a csv option as I am way more adept at R than Python graphing and analyses. Thanks guys. SCRIPT: import subprocess
import os
# Set paths to the centroid and centered models
centroid = "C:/Users/jramb/Documents/Sleap/models/1_centroid_model/training_config.json"
centered = "C:/Users/jramb/Documents/Sleap/models/1_centered_model/training_config.json"
# Set parameters for SLEAP tracking
parameters = "--tracking.tracker simple --tracking.similarity instance --tracking.match hungarian --tracking.track_window 5 --tracking.post_connect_single_breaks 0 --verbosity json --no-empty-frames"
# Set path to the directory containing videos
video_path = "C:/Users/jramb/Videos/Raspi_Vids/Row_B/Coc/C22_Coc_B_LgA14"
# Set path to inference result location
inf_path = "C:/Users/jramb/Documents/Sleap/results/track"
# Set path to analysis output location
out_path = "C:/Users/jramb/Documents/Sleap/results/analyses"
# Step 1: Use SLEAP to run inference on each video and convert slp to h5
for video_file in os.listdir(video_path):
if video_file.endswith(".mp4"):
video_path_full = os.path.join(video_path, video_file)
video_name_no_ext = os.path.splitext(video_file)[0]
# Run sleap-track
track_command = f"sleap-track -m \"{centroid}\" -m \"{centered}\" {parameters} -o \"{inf_path}/{video_name_no_ext}.slp\" \"{video_path_full}\""
subprocess.run(track_command, shell=True)
# Run sleap-convert
convert_command = f"sleap-convert \"{inf_path}/{video_name_no_ext}.slp\" --format analysis \"{out_path}/{video_name_no_ext}.analysis.h5\""
subprocess.run(convert_command, shell=True) |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey guys,
Thank you for the continued help, I was able to improve my model from #1612 to now 1000 frames and a bit better outcomes and ready to start tracking. Tracking has gone well for the first test video and exporting the data to a csv (somehow keep having trouble with python in some way to use h5 and unfamiliar with MATLAB) to play around with in R that I am most familiar with.
I am attempting to put together a script that is purely CLI based using OSG's supercomputers to run the many many videos we have. Not 100% sure if this is going to be as easy as I hope considering the need to correct tracks, although each of our videos is a single animal and notice that as long as there isn't two tracks on the same image it seems avoidable by simply cleaning the csv.
Long story short, the hope is to have a script that takes in a folder as a path and runs inference on each video and exports the analyses as a csv. But sleap-convert I do not see a csv option. Not sure if you guys have say a base iteration I can adjust for this portion. Next would be for each csv to then run through R as I have been playing around with a script that then runs them through R, interpolates the missing, and running a few analyses and saving as such.
Any pointers or best practices are much appreciated! Of course the hope is to have it all automated with a press of "play" but even tips on points that would require human-in-the-loop would save time in trying to write an all encompassing script instead of a couple of scripts. But like what I have seen thus far. Thanks guys.
Beta Was this translation helpful? Give feedback.
All reactions