-
Notifications
You must be signed in to change notification settings - Fork 114
Import multiple DLC datasets from a folder #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #437 +/- ##
========================================
Coverage 60.40% 60.41%
========================================
Files 119 119
Lines 17945 17979 +34
========================================
+ Hits 10840 10862 +22
- Misses 7105 7117 +12
Continue to review full report at Codecov.
|
sleap/gui/commands.py
Outdated
print("Merged labels:") | ||
merged_labels.describe() | ||
|
||
merged_labels.save("{}.slp".format(params["filename"])) | ||
merged_labels.save("{}.pkg.slp".format(params["filename"]), | ||
with_images=True) # comment this out to skip saving with embedded images |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this -- the labels will be loaded from memory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
sleap/gui/commands.py
Outdated
@staticmethod | ||
def do_action(context: "CommandContext", params: dict): | ||
|
||
csv_files = glob("{}/*/*.csv".format(params["dirname"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Prefer f-strings to .format(), i.e., glob(f"{params['dirname']}/*/*.csv")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
sleap/gui/commands.py
Outdated
if len(dirname) == 0: | ||
return False | ||
params["dirname"] = dirname | ||
params["filename"] = "converted_dlc_dataset" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above -- filename not needed. This op should not do any I/O. User can save the labels from File -> Save after importing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just missing the tests and we're good to go :)
coords,x,y,x,y,x,y,x,y,x,y,x,y | ||
labeled-data/video/img000.png,0,1,2,3,4,5,6,7,8,9,10,11 | ||
labeled-data/video/img001.png,12,13,,,15,16,17,18,,,20,21 | ||
labeled-data/video/img002.png,22,23,24,25,26,27,,,,,, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change a couple of these numbers so we can test that we're not just importing the same thing twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split the 2 files to have a bit more realistic test. One has labels from the first 2 frames, the other one from the last frame. Also added the images for manual verification via UI
PTAL |
Import multiple DLC datasets in a folder.
Assuming a folder structure like this:
user can select the
'labeled-data'
folder in the dialog, and then all'*.csv'
files 2 levels below will be imported and merged into a singleSleap
dataset.Fixes #412