Feature - stitching multiple video streams#133
Conversation
220d2be to
637e77b
Compare
0c0926b to
aba37b4
Compare
e987781 to
9b77947
Compare
9b77947 to
3bf73b4
Compare
e4a51c5 to
8cb1ef9
Compare
| default=0, | ||
| help="Number of frames to remove from the end (default: 0).", | ||
| ) | ||
| def workflow( |
There was a problem hiding this comment.
changes from the original here:
- removed all the error checking that happens in the middle: if there are errors we should raise them in the processing methods themselves, otherwise casting to
Recordingvalidates that the frame counts are identical between the video and the metadata csv - didn't override the
output_dirin the denoise config: we should use that if it's present, if it should output to another directory, the config should be changed.
otherwise should be the same. please try this out and see if it breaks your workflow, lmk what needs to change or what i have broken
sneakers-the-rat
left a comment
There was a problem hiding this comment.
ok returning to you @t-sasatani - managed to take about a thousand lines off while adding the dataset models, I didn't try and retrofit everything here to use them, but hopefully it's clear why they might be useful: we should avoid trying to juggle a million paths manually and should instead create a model of how all this stuff fits together. In the future this should also be some metadata file rather than being based on file naming conventions, but again trying to just set us up for future steps, and it ended up being simpler to add the dataset models now than having multiple different methods for validating and locating metadata files/etc.
I think the major observable difference here is in path manipulation, i am trying to go for a model where all the data for a given dataset stays in that directory, and for now a lot of that is flat with filenames to indicate what things are, but trying not to have multiple different directories where files from the same dataset are stored. once we get a better handle on how we want to organize files we can add back in more subdirectory structure within the context of a dataset.
give this a run and see if it does all you expect it to - the tests do pass, and they seem to test the major functionality, but i want to be sure i didn't break anything you are relying on (if there is anything that breaks when you run it, lmk and i can write more tests)
|
if you're good with this, would you do the honors of writing the changelog and then feel free to merge :) otherwise lmk if changes requested |
|
|
||
| STITCH_DATA_DIR = Path(__file__).parent / "data" / "stitch" | ||
|
|
||
| EXPECTED_STITCHED_VIDEO_HASH = "69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9" |
There was a problem hiding this comment.
Noticed the output file name was different, and this hash you changed to seems to be a hash for an empty output.
>>> import hashlib
>>> print(hashlib.new('blake2s').hexdigest())
69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9
There was a problem hiding this comment.
Holy shit good catch lmao thank you
|
I haven't read through all the changes yet, but I at least ran the script locally and made some fixes.
|
As in the metadata has an extra frame that is not in the video? Or what? Maybe we just trim that from the metadata?
What about a |
|
|
ok added those, will need to write tests for the --force flag and whatnot |
|
ok i'm gonna merge this puppy and please raise issues with anything that comes up!!! |
This PR adds a stitching function for multiple data streams based on device metadata. Also makes frame index operations rigorous to support this.
The metadata CSV for testing stitching is also inflating the line count, but I'm sorry that this ended up quite long.
Functions
Main updates
mio/process/stitch.py: Main part that scores multiple recording videos from a bundle, gets the best ones, and exports while tracking and adjusting the metadata too.mio/process/video.py: Made the frame index tracking much more rigorous and better path resolving for getting a data bundle after running.mio/cli/process.py: AddworkflowandstitchCLI commands alongside the existingdenoise, add interactive prompts to proceed/quit when metadata validation fails.mio/models/stitch.py: Model for tracking frames from multiple video sources.mio/utils.py: Added some validation functions and formatters for video-metadata pairs.tests/test_process/test_stitch.py: Testing for stitching and cropping frames. Tests stuff like alignment of video and metadata, video hash, etc.📚 Documentation preview 📚: https://miniscope-io--133.org.readthedocs.build/en/133/