Skip to content

Save df3d results adjacent to data folder, not inside it. Closes #46 - #59

Merged
jasper-tms merged 3 commits into
masterfrom
issue-46
Jun 13, 2025
Merged

jasper-tms merged 3 commits into
masterfrom
issue-46

Conversation

@jasper-tms

Copy link
Copy Markdown
Member

I've been using this updated code for a while because, as @azmaite says on #46, it's annoying to have the df3d results folder inside the folder with a zillion images. I have finally pushed this change. I think I changed the path in the tests file to work with the updated location that the results are now saved to, but I'd be eager to get @Dominic-DallOsto to confirm when possible.

@Dominic-DallOsto

Copy link
Copy Markdown
Contributor

Just to check the default directory structure that we use:

Is the folder that contains the images usually something like <date-and-experiment-name>/FlyN/00N_<trial-name>/behData/images ?

And this folder contains the videos / images. So if we input this folder, the results will be saved at <date-and-experiment-name>/FlyN/00N_<trial-name>/behData/df3d and that should be fine?

The only issue I see is if your images for each trial aren't saved in a subdirectory for that trial, so that ../df3d is the same for multiple trials and gets overwritten.

@Dominic-DallOsto

Copy link
Copy Markdown
Contributor

Maybe the output folder command line argument could be an absolute folder? And if this isn't provided we save to ../<folder-name>_df3d by default?

Just trying to think of what's the most graceful way of handling this?

@jasper-tms

Copy link
Copy Markdown
Member Author

You're absolutely right that the proposed changes would cause a problem when ../df3d is the same for multiple trials. That isn't a problem currently given our standard data structure, but still, we shouldn't leave this possible issue.

  • The SeptaCam software saves images inside <date-and-experiment-name>/FlyN/00N_<trial-name>/behData/images as you said
  • Different people's jpg -> mp4 conversion scripts put the mp4 files either at behData/images/camera_N.mp4 or behData/camera_N.mp4. (Mine for instance sets the video directory to be one up from the image directory, here)
  • df3d expands mp4 files back into a series of jpgs in the same directory as the mp4 files (so for me those temporary jpgs end up not in behData/images/ but just in behData/)
  • It'd be nice to have the df3d results files not be within the same folder as the thousands of expanded jpgs for the sake of navigating the folders

Previously a df3d-cli command with the input folder argument being ./behData (the folder containing the videos, as required) would write results to ./behData/df3d. The current set of commits change it to write instead to ./df3d, but yea, then trying to run df3d-cli sequentially on folders named ./behData and ./behData2 would both put their results in the same ./df3d folder, overwriting one another. Let's solve that by having df3d put results in ./behData_df3d when run on ./behData. ./behData2_df3d when run on ./behData2, etc. OK with you?

@Dominic-DallOsto

Copy link
Copy Markdown
Contributor

Sounds good!

@jasper-tms

Copy link
Copy Markdown
Member Author

OK I think the behavior is now what we want:

  • df3d-cli data/reference/ -v --order 0 1 2 3 4 5 6 --video-2d --video-3d puts df3d results in ./data/reference_df3d/
  • df3d-cli data/reference/ --output-folder foo -v --order 0 1 2 3 4 5 6 --video-2d --video-3d puts df3d results in ./foo/

So I think we now have a reasonable default when an argument is not provided, but when the user provides a path, it can be anywhere on the computer - previously --output-folder foo would have put results in ./data/reference/foo/, but that reduces flexibility by forcing the output folder to be inside the input folder. Sound OK Dom?

Hmm some tests failed, I'll need to see why.

@Dominic-DallOsto

Copy link
Copy Markdown
Contributor

Yeah, I think both paths should be relative to the place where the code is currently run. But absolute paths should also be possible.

Like --output-folder foo = ./foo and --output-folder /foo = /foo

It's a bit weird that the output folder would be interpreted relative to the input folder.

@jasper-tms

Copy link
Copy Markdown
Member Author

I confirmed this also works with absolute paths (--output-folder ~/Desktop/df3d_test). I'll go ahead and merge this PR then since I think we've converged.

@jasper-tms
jasper-tms merged commit 9d53076 into master Jun 13, 2025
@jasper-tms
jasper-tms deleted the issue-46 branch June 13, 2025 12:31
Dominic-DallOsto added a commit that referenced this pull request Jun 13, 2025
Dominic-DallOsto added a commit that referenced this pull request Jun 13, 2025
…eo data (#61)

* Add a new tests for the default output dir and update `output_folder` parameter of Core
Tests [#59](#59)

* Run formatter on tests

* Revert changes to video_pose3d.mp4 test data introduced in 3a1424a

* Update imports in test script
Fixes warning that `df3d.video` was being overshadowed by a variable called `video`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants