-
Notifications
You must be signed in to change notification settings - Fork 2
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
Restructure df columns #66
Conversation
…es to pose_estimation_model_str to model_str.
…act subset of frames just after DLC df reformatting. Add options for reading a multianimal DLC dataframe.
Codecov Report
@@ Coverage Diff @@
## main #66 +/- ##
==========================================
- Coverage 35.27% 33.27% -2.00%
==========================================
Files 12 12
Lines 533 574 +41
==========================================
+ Hits 188 191 +3
- Misses 345 383 +38
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…custom hierarchy of ROIs.
… to why initialising column for all video dataframes
Probably, unrelated to your errors, but I get wazp/utils.py:8: error: Skipping analyzing "shapely": module is installed, but missing library stubs or py.typed marker [import]
wazp/utils.py:10: error: Skipping analyzing "shapely.geometry": module is installed, but missing library stubs or py.typed marker [import] when running Anyhow, to be on the safe side, we should add |
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.
Hey @sfmig, good job on untangling that mess of a dataframe into something more manageable. I like the long format.
Besides the small comments I left, I also stumbled on a more fundamental issue.
The dataframe export works, but the "ROI_tag" column consists entirely of empty strings, even though ROIs are defined for one of the exported videos (in jwaspE_nectar-open-close_control.metadata.yaml
).
Based on my reading of the add_ROIs_to_video_dataframe
function, the ROI_tags for this video should have been included in the exported dataframe. Do you also see the same on your end? If yes, something is wrong in the above function (though I cannot quite figure out what).
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.
Looks cool.
I had a play and it does what you want, I think.
In [4]: df.head()
Out[4]:
model_str video_file frame ... likelihood ROI_tag event_tag
0 DLC_resnet50_jwasp_femaleandmaleSep12shuffle1_... jwaspI_nectar-open-close_wateronly_s.avi 0 ... 0.999943 experiment_start
1 DLC_resnet50_jwasp_femaleandmaleSep12shuffle1_... jwaspI_nectar-open-close_wateronly_s.avi 1 ... 0.999911
2 DLC_resnet50_jwasp_femaleandmaleSep12shuffle1_... jwaspI_nectar-open-close_wateronly_s.avi 2 ... 0.999832
3 DLC_resnet50_jwasp_femaleandmaleSep12shuffle1_... jwaspI_nectar-open-close_wateronly_s.avi 3 ... 0.999816
4 DLC_resnet50_jwasp_femaleandmaleSep12shuffle1_... jwaspI_nectar-open-close_wateronly_s.avi 4 ... 0.999826
[5 rows x 9 columns]
In [5]: df.columns
Out[5]:
Index(['model_str', 'video_file', 'frame', 'bodypart', 'x', 'y', 'likelihood',
'ROI_tag', 'event_tag'],
dtype='object', name='')
hey @niksirbi! I pushed the pose data for To quickly check it works as intended, you can run the following on the exported dataframe: Maybe this is a symptom that we should clarify this a bit more....let me know any thoughts 🤔 |
Co-authored-by: Niko Sirmpilatze [email protected]
…ss in dataframe by square brackets access. remove metadata as input.
That makes complete sense. I tested it again now and it works!
I think it's just a symptom of not having solved the data hosting problem properly, as per #33 . |
Restructures the dataframe imported from DLC, to make a dataframe with a single level. Adds ROI per frame and bodypart (and individual if the data is from a multianimal project), and event tags per frame.
Columns in exported dataframe:
*if multi-animal
Features
mypy errors
I had some errors with mypy and pandas, I fixed some but others I couldn't figure out why... I marked those with
# type: ignore
for now. I didn't have errors when running mypy directly, but they did show up with the precommit hooksThis PR addresses issues: